| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // TODO(jmesserly): this file needs to be refactored, it's a port from | 5 // TODO(jmesserly): this file needs to be refactored, it's a port from |
| 6 // package:dev_compiler's tests | 6 // package:dev_compiler's tests |
| 7 /// General type checking tests | 7 /// General type checking tests |
| 8 library test.src.task.strong.checker_test; | 8 library test.src.task.strong.checker_test; |
| 9 | 9 |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 } | 1369 } |
| 1370 ''' | 1370 ''' |
| 1371 }); | 1371 }); |
| 1372 | 1372 |
| 1373 testChecker('generic method override', { | 1373 testChecker('generic method override', { |
| 1374 '/main.dart': ''' | 1374 '/main.dart': ''' |
| 1375 class Future<T> { | 1375 class Future<T> { |
| 1376 /*=S*/ then/*<S>*/(/*=S*/ onValue(T t)) => null; | 1376 /*=S*/ then/*<S>*/(/*=S*/ onValue(T t)) => null; |
| 1377 } | 1377 } |
| 1378 | 1378 |
| 1379 // These work because they're exactly equal FunctionTypes | |
| 1380 class DerivedFuture<T> extends Future<T> { | 1379 class DerivedFuture<T> extends Future<T> { |
| 1381 /*=S*/ then/*<S>*/(/*=S*/ onValue(T t)) => null; | 1380 /*=S*/ then/*<S>*/(/*=S*/ onValue(T t)) => null; |
| 1382 } | 1381 } |
| 1383 | 1382 |
| 1384 class DerivedFuture2<A> extends Future<A> { | 1383 class DerivedFuture2<A> extends Future<A> { |
| 1385 /*=B*/ then/*<B>*/(/*=B*/ onValue(A a)) => null; | 1384 /*=B*/ then/*<B>*/(/*=B*/ onValue(A a)) => null; |
| 1386 } | 1385 } |
| 1387 | 1386 |
| 1388 // These don't work but should. | |
| 1389 class DerivedFuture3<T> extends Future<T> { | 1387 class DerivedFuture3<T> extends Future<T> { |
| 1390 /*=/*severe:INVALID_METHOD_OVERRIDE should be pass*/S*/ then/*<S>*/(
Object onValue(T t)) => null; | 1388 /*=S*/ then/*<S>*/(Object onValue(T t)) => null; |
| 1391 } | 1389 } |
| 1392 | 1390 |
| 1393 class DerivedFuture4<A> extends Future<A> { | 1391 class DerivedFuture4<A> extends Future<A> { |
| 1394 /*=/*severe:INVALID_METHOD_OVERRIDE should be pass*/B*/ then/*<B>*/(
Object onValue(A a)) => null; | 1392 /*=B*/ then/*<B>*/(Object onValue(A a)) => null; |
| 1395 } | 1393 } |
| 1396 ''' | 1394 ''' |
| 1397 }); | 1395 }); |
| 1398 | 1396 |
| 1399 testChecker('unary operators', { | 1397 testChecker('unary operators', { |
| 1400 '/main.dart': ''' | 1398 '/main.dart': ''' |
| 1401 class A { | 1399 class A { |
| 1402 A operator ~() {} | 1400 A operator ~() {} |
| 1403 A operator +(int x) {} | 1401 A operator +(int x) {} |
| 1404 A operator -(int x) {} | 1402 A operator -(int x) {} |
| (...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2471 | 2469 |
| 2472 baz1() sync* { yield* (/*info:DYNAMIC_CAST*/x); } | 2470 baz1() sync* { yield* (/*info:DYNAMIC_CAST*/x); } |
| 2473 Iterable baz2() sync* { yield* (/*info:DYNAMIC_CAST*/x); } | 2471 Iterable baz2() sync* { yield* (/*info:DYNAMIC_CAST*/x); } |
| 2474 Iterable<int> baz3() sync* { yield* (/*warning:DOWN_CAST_COMPOSITE*/x);
} | 2472 Iterable<int> baz3() sync* { yield* (/*warning:DOWN_CAST_COMPOSITE*/x);
} |
| 2475 Iterable<int> baz4() sync* { yield* new Iterable<int>(); } | 2473 Iterable<int> baz4() sync* { yield* new Iterable<int>(); } |
| 2476 Iterable<int> baz5() sync* { yield* (/*info:INFERRED_TYPE_ALLOCATION*/ne
w Iterable()); } | 2474 Iterable<int> baz5() sync* { yield* (/*info:INFERRED_TYPE_ALLOCATION*/ne
w Iterable()); } |
| 2477 ''' | 2475 ''' |
| 2478 }); | 2476 }); |
| 2479 }); | 2477 }); |
| 2480 } | 2478 } |
| OLD | NEW |