OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 engine.static_type_warning_code_test; | 5 library engine.static_type_warning_code_test; |
6 | 6 |
7 import 'package:analyzer/src/generated/source_io.dart'; | 7 import 'package:analyzer/src/generated/source_io.dart'; |
8 import 'package:analyzer/src/generated/error.dart'; | 8 import 'package:analyzer/src/generated/error.dart'; |
9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
10 import 'resolver_test.dart'; | 10 import 'resolver_test.dart'; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 void test_invalidAssignment_defaultValue_optional() { | 214 void test_invalidAssignment_defaultValue_optional() { |
215 Source source = addSource(r''' | 215 Source source = addSource(r''' |
216 f([String x = 0]) { | 216 f([String x = 0]) { |
217 }'''); | 217 }'''); |
218 resolve(source); | 218 resolve(source); |
219 assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]); | 219 assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]); |
220 verify([source]); | 220 verify([source]); |
221 } | 221 } |
222 | 222 |
| 223 void test_invalidAssignment_dynamic() { |
| 224 Source source = addSource(r''' |
| 225 main() { |
| 226 dynamic = 1; |
| 227 } |
| 228 '''); |
| 229 resolve(source); |
| 230 assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]); |
| 231 verify([source]); |
| 232 } |
| 233 |
223 void test_invalidAssignment_instanceVariable() { | 234 void test_invalidAssignment_instanceVariable() { |
224 Source source = addSource(r''' | 235 Source source = addSource(r''' |
225 class A { | 236 class A { |
226 int x; | 237 int x; |
227 } | 238 } |
228 f() { | 239 f() { |
229 A a; | 240 A a; |
230 a.x = '0'; | 241 a.x = '0'; |
231 }'''); | 242 }'''); |
232 resolve(source); | 243 resolve(source); |
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 resolve(source); | 1453 resolve(source); |
1443 assertErrors(source, [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS])
; | 1454 assertErrors(source, [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS])
; |
1444 verify([source]); | 1455 verify([source]); |
1445 } | 1456 } |
1446 } | 1457 } |
1447 | 1458 |
1448 main() { | 1459 main() { |
1449 groupSep = ' | '; | 1460 groupSep = ' | '; |
1450 runReflectiveTests(StaticTypeWarningCodeTest); | 1461 runReflectiveTests(StaticTypeWarningCodeTest); |
1451 } | 1462 } |
OLD | NEW |