| 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 library analyzer.test.src.task.strong.checker_test; | 5 library analyzer.test.src.task.strong.checker_test; |
| 6 | 6 |
| 7 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 7 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 8 | 8 |
| 9 import 'strong_test_helper.dart'; | 9 import 'strong_test_helper.dart'; |
| 10 | 10 |
| (...skipping 2371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2382 // function typed formal | 2382 // function typed formal |
| 2383 void ftf0(void x(/*error:IMPLICIT_DYNAMIC_PARAMETER*/y)) {} | 2383 void ftf0(void x(/*error:IMPLICIT_DYNAMIC_PARAMETER*/y)) {} |
| 2384 void ftf1(void x(int y)) {} | 2384 void ftf1(void x(int y)) {} |
| 2385 '''); | 2385 '''); |
| 2386 check(implicitDynamic: false); | 2386 check(implicitDynamic: false); |
| 2387 } | 2387 } |
| 2388 | 2388 |
| 2389 void test_implicitDynamic_return() { | 2389 void test_implicitDynamic_return() { |
| 2390 addFile(r''' | 2390 addFile(r''' |
| 2391 // function | 2391 // function |
| 2392 /*error:IMPLICIT_DYNAMIC_RETURN*/f0() {} | 2392 /*error:IMPLICIT_DYNAMIC_RETURN*/f0() {return f0();} |
| 2393 dynamic f1() { return 42; } | 2393 dynamic f1() { return 42; } |
| 2394 | 2394 |
| 2395 // nested function | 2395 // nested function |
| 2396 void main() { | 2396 void main() { |
| 2397 /*error:IMPLICIT_DYNAMIC_RETURN*/g0() {} | 2397 /*error:IMPLICIT_DYNAMIC_RETURN*/g0() {return g0();} |
| 2398 dynamic g1() { return 42; } | 2398 dynamic g1() { return 42; } |
| 2399 } | 2399 } |
| 2400 | 2400 |
| 2401 // methods | 2401 // methods |
| 2402 class B { | 2402 class B { |
| 2403 int m1() => 42; | 2403 int m1() => 42; |
| 2404 } | 2404 } |
| 2405 class C extends B { | 2405 class C extends B { |
| 2406 /*error:IMPLICIT_DYNAMIC_RETURN*/m0() => 123; | 2406 /*error:IMPLICIT_DYNAMIC_RETURN*/m0() => 123; |
| 2407 m1() => 123; | 2407 m1() => 123; |
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3239 : g = f ?? _alwaysTrue; | 3239 : g = f ?? _alwaysTrue; |
| 3240 C.a() : g = _alwaysTrue; | 3240 C.a() : g = _alwaysTrue; |
| 3241 } | 3241 } |
| 3242 '''); | 3242 '''); |
| 3243 } | 3243 } |
| 3244 | 3244 |
| 3245 void test_optionalParams() { | 3245 void test_optionalParams() { |
| 3246 // Regression test for https://github.com/dart-lang/sdk/issues/26155 | 3246 // Regression test for https://github.com/dart-lang/sdk/issues/26155 |
| 3247 checkFile(r''' | 3247 checkFile(r''' |
| 3248 void takesF(void f(int x)) { | 3248 void takesF(void f(int x)) { |
| 3249 takesF(/*info:INFERRED_TYPE_CLOSURE,info:INFERRED_TYPE_CLOSURE*/([x]) { bool z
= x.isEven; }); | 3249 takesF(/*info:INFERRED_TYPE_CLOSURE, |
| 3250 takesF(/*info:INFERRED_TYPE_CLOSURE*/(y) { bool z = y.isEven; }); | 3250 info:INFERRED_TYPE_CLOSURE*/([x]) { bool z = x.isEven; }); |
| 3251 takesF(/*info:INFERRED_TYPE_CLOSURE, |
| 3252 info:INFERRED_TYPE_CLOSURE*/(y) { bool z = y.isEven; }); |
| 3251 } | 3253 } |
| 3252 '''); | 3254 '''); |
| 3253 } | 3255 } |
| 3254 | 3256 |
| 3255 void test_overrideNarrowsType() { | 3257 void test_overrideNarrowsType() { |
| 3256 addFile(r''' | 3258 addFile(r''' |
| 3257 class A {} | 3259 class A {} |
| 3258 class B extends A {} | 3260 class B extends A {} |
| 3259 | 3261 |
| 3260 abstract class C { | 3262 abstract class C { |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4088 // Regression test for https://github.com/dart-lang/sdk/issues/25069 | 4090 // Regression test for https://github.com/dart-lang/sdk/issues/25069 |
| 4089 checkFile(''' | 4091 checkFile(''' |
| 4090 typedef int Foo(); | 4092 typedef int Foo(); |
| 4091 void foo() {} | 4093 void foo() {} |
| 4092 void main () { | 4094 void main () { |
| 4093 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); | 4095 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); |
| 4094 } | 4096 } |
| 4095 '''); | 4097 '''); |
| 4096 } | 4098 } |
| 4097 } | 4099 } |
| OLD | NEW |