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 '../../../reflective_tests.dart'; | 7 import '../../../reflective_tests.dart'; |
8 import 'strong_test_helper.dart'; | 8 import 'strong_test_helper.dart'; |
9 | 9 |
10 void main() { | 10 void main() { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 p = c == y; | 106 p = c == y; |
107 | 107 |
108 a = a[b]; | 108 a = a[b]; |
109 a = a[/*info:DYNAMIC_CAST*/c]; | 109 a = a[/*info:DYNAMIC_CAST*/c]; |
110 c = (/*info:DYNAMIC_INVOKE*/c[b]); | 110 c = (/*info:DYNAMIC_INVOKE*/c[b]); |
111 a[/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/y]; | 111 a[/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/y]; |
112 } | 112 } |
113 '''); | 113 '''); |
114 } | 114 } |
115 | 115 |
| 116 void test_callMethodOnFunctions() { |
| 117 checkFile(r''' |
| 118 void f(int x) => print(x); |
| 119 main() { |
| 120 f.call(/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/'hi'); |
| 121 } |
| 122 '''); |
| 123 } |
| 124 |
116 void test_castsInConditions() { | 125 void test_castsInConditions() { |
117 checkFile(''' | 126 checkFile(''' |
118 main() { | 127 main() { |
119 bool b = true; | 128 bool b = true; |
120 num x = b ? 1 : 2.3; | 129 num x = b ? 1 : 2.3; |
121 int y = /*info:ASSIGNMENT_CAST*/b ? 1 : 2.3; | 130 int y = /*info:ASSIGNMENT_CAST*/b ? 1 : 2.3; |
122 String z = !b ? "hello" : null; | 131 String z = !b ? "hello" : null; |
123 z = b ? null : "hello"; | 132 z = b ? null : "hello"; |
124 } | 133 } |
125 '''); | 134 '''); |
(...skipping 3544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3670 // Regression test for https://github.com/dart-lang/sdk/issues/25069 | 3679 // Regression test for https://github.com/dart-lang/sdk/issues/25069 |
3671 checkFile(''' | 3680 checkFile(''' |
3672 typedef int Foo(); | 3681 typedef int Foo(); |
3673 void foo() {} | 3682 void foo() {} |
3674 void main () { | 3683 void main () { |
3675 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); | 3684 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); |
3676 } | 3685 } |
3677 '''); | 3686 '''); |
3678 } | 3687 } |
3679 } | 3688 } |
OLD | NEW |