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 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 | 981 |
982 dynamic x; | 982 dynamic x; |
983 | 983 |
984 bar1() async* { yield x; } | 984 bar1() async* { yield x; } |
985 Stream bar2() async* { yield x; } | 985 Stream bar2() async* { yield x; } |
986 Stream<int> bar3() async* { yield /*info:DYNAMIC_CAST*/x; } | 986 Stream<int> bar3() async* { yield /*info:DYNAMIC_CAST*/x; } |
987 Stream<int> bar4() async* { yield /*error:YIELD_OF_INVALID_TYPE*/new Stream<int>
(); } | 987 Stream<int> bar4() async* { yield /*error:YIELD_OF_INVALID_TYPE*/new Stream<int>
(); } |
988 | 988 |
989 baz1() async* { yield* /*info:DYNAMIC_CAST*/x; } | 989 baz1() async* { yield* /*info:DYNAMIC_CAST*/x; } |
990 Stream baz2() async* { yield* /*info:DYNAMIC_CAST*/x; } | 990 Stream baz2() async* { yield* /*info:DYNAMIC_CAST*/x; } |
991 Stream<int> baz3() async* { yield* /*warning:DOWN_CAST_COMPOSITE*/x; } | 991 Stream<int> baz3() async* { yield* /*info:DYNAMIC_CAST*/x; } |
992 Stream<int> baz4() async* { yield* new Stream<int>(); } | 992 Stream<int> baz4() async* { yield* new Stream<int>(); } |
993 Stream<int> baz5() async* { yield* /*info:INFERRED_TYPE_ALLOCATION*/new Stream()
; } | 993 Stream<int> baz5() async* { yield* /*info:INFERRED_TYPE_ALLOCATION*/new Stream()
; } |
994 '''); | 994 '''); |
995 } | 995 } |
996 | 996 |
997 void test_functionModifiers_syncStar() { | 997 void test_functionModifiers_syncStar() { |
998 checkFile(''' | 998 checkFile(''' |
999 dynamic x; | 999 dynamic x; |
1000 | 1000 |
1001 bar1() sync* { yield x; } | 1001 bar1() sync* { yield x; } |
1002 Iterable bar2() sync* { yield x; } | 1002 Iterable bar2() sync* { yield x; } |
1003 Iterable<int> bar3() sync* { yield /*info:DYNAMIC_CAST*/x; } | 1003 Iterable<int> bar3() sync* { yield /*info:DYNAMIC_CAST*/x; } |
1004 Iterable<int> bar4() sync* { yield /*error:YIELD_OF_INVALID_TYPE*/bar3(); } | 1004 Iterable<int> bar4() sync* { yield /*error:YIELD_OF_INVALID_TYPE*/bar3(); } |
1005 | 1005 |
1006 baz1() sync* { yield* /*info:DYNAMIC_CAST*/x; } | 1006 baz1() sync* { yield* /*info:DYNAMIC_CAST*/x; } |
1007 Iterable baz2() sync* { yield* /*info:DYNAMIC_CAST*/x; } | 1007 Iterable baz2() sync* { yield* /*info:DYNAMIC_CAST*/x; } |
1008 Iterable<int> baz3() sync* { yield* /*warning:DOWN_CAST_COMPOSITE*/x; } | 1008 Iterable<int> baz3() sync* { yield* /*info:DYNAMIC_CAST*/x; } |
1009 Iterable<int> baz4() sync* { yield* bar3(); } | 1009 Iterable<int> baz4() sync* { yield* bar3(); } |
1010 Iterable<int> baz5() sync* { yield* /*info:INFERRED_TYPE_ALLOCATION*/new List();
} | 1010 Iterable<int> baz5() sync* { yield* /*info:INFERRED_TYPE_ALLOCATION*/new List();
} |
1011 '''); | 1011 '''); |
1012 } | 1012 } |
1013 | 1013 |
1014 void test_functionTypingAndSubtyping_classes() { | 1014 void test_functionTypingAndSubtyping_classes() { |
1015 checkFile(''' | 1015 checkFile(''' |
1016 class A {} | 1016 class A {} |
1017 class B extends A {} | 1017 class B extends A {} |
1018 | 1018 |
(...skipping 2976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3995 // Regression test for https://github.com/dart-lang/sdk/issues/25069 | 3995 // Regression test for https://github.com/dart-lang/sdk/issues/25069 |
3996 checkFile(''' | 3996 checkFile(''' |
3997 typedef int Foo(); | 3997 typedef int Foo(); |
3998 void foo() {} | 3998 void foo() {} |
3999 void main () { | 3999 void main () { |
4000 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); | 4000 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); |
4001 } | 4001 } |
4002 '''); | 4002 '''); |
4003 } | 4003 } |
4004 } | 4004 } |
OLD | NEW |