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 3484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3495 void test_setterReturnTypes() { | 3495 void test_setterReturnTypes() { |
3496 checkFile(''' | 3496 checkFile(''' |
3497 void voidFn() => null; | 3497 void voidFn() => null; |
3498 class A { | 3498 class A { |
3499 set a(y) => 4; | 3499 set a(y) => 4; |
3500 set b(y) => voidFn(); | 3500 set b(y) => voidFn(); |
3501 void set c(y) => /*error:RETURN_OF_INVALID_TYPE*/4; | 3501 void set c(y) => /*error:RETURN_OF_INVALID_TYPE*/4; |
3502 void set d(y) => voidFn(); | 3502 void set d(y) => voidFn(); |
3503 /*warning:NON_VOID_RETURN_FOR_SETTER*/int set e(y) => 4; | 3503 /*warning:NON_VOID_RETURN_FOR_SETTER*/int set e(y) => 4; |
3504 /*warning:NON_VOID_RETURN_FOR_SETTER*/int set f(y) => | 3504 /*warning:NON_VOID_RETURN_FOR_SETTER*/int set f(y) => |
3505 /*error:RETURN_OF_INVALID_TYPE*/voidFn(); | 3505 /*info:DOWN_CAST_IMPLICIT*/voidFn(); |
3506 set g(y) {return /*error:RETURN_OF_INVALID_TYPE*/4;} | 3506 set g(y) {return /*error:RETURN_OF_INVALID_TYPE*/4;} |
3507 void set h(y) {return /*error:RETURN_OF_INVALID_TYPE*/4;} | 3507 void set h(y) {return /*error:RETURN_OF_INVALID_TYPE*/4;} |
3508 /*warning:NON_VOID_RETURN_FOR_SETTER*/int set i(y) {return 4;} | 3508 /*warning:NON_VOID_RETURN_FOR_SETTER*/int set i(y) {return 4;} |
3509 } | 3509 } |
3510 '''); | 3510 '''); |
3511 } | 3511 } |
3512 | 3512 |
3513 void test_setterSetterOverride() { | 3513 void test_setterSetterOverride() { |
3514 checkFile(''' | 3514 checkFile(''' |
3515 class A {} | 3515 class A {} |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4140 } | 4140 } |
4141 '''); | 4141 '''); |
4142 } | 4142 } |
4143 | 4143 |
4144 void test_voidSubtyping() { | 4144 void test_voidSubtyping() { |
4145 // Regression test for https://github.com/dart-lang/sdk/issues/25069 | 4145 // Regression test for https://github.com/dart-lang/sdk/issues/25069 |
4146 checkFile(''' | 4146 checkFile(''' |
4147 typedef int Foo(); | 4147 typedef int Foo(); |
4148 void foo() {} | 4148 void foo() {} |
4149 void main () { | 4149 void main () { |
4150 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); | 4150 Foo x = /*warning:DOWN_CAST_COMPOSITE,info:USE_OF_VOID_RESULT*/foo(); |
4151 } | 4151 } |
4152 '''); | 4152 '''); |
4153 } | 4153 } |
4154 } | 4154 } |
OLD | NEW |