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 analyzer.test.generated.non_error_resolver_test; | 5 library analyzer.test.generated.non_error_resolver_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 await computeAnalysisResult(source); | 137 await computeAnalysisResult(source); |
138 assertNoErrors(source); | 138 assertNoErrors(source); |
139 verify([source]); | 139 verify([source]); |
140 } | 140 } |
141 | 141 |
142 test_ambiguousExport() async { | 142 test_ambiguousExport() async { |
143 Source source = addSource(r''' | 143 Source source = addSource(r''' |
144 library L; | 144 library L; |
145 export 'lib1.dart'; | 145 export 'lib1.dart'; |
146 export 'lib2.dart';'''); | 146 export 'lib2.dart';'''); |
147 addNamedSource( | 147 addNamedSource("/lib1.dart", r''' |
148 "/lib1.dart", | |
149 r''' | |
150 library lib1; | 148 library lib1; |
151 class M {}'''); | 149 class M {}'''); |
152 addNamedSource( | 150 addNamedSource("/lib2.dart", r''' |
153 "/lib2.dart", | |
154 r''' | |
155 library lib2; | 151 library lib2; |
156 class N {}'''); | 152 class N {}'''); |
157 await computeAnalysisResult(source); | 153 await computeAnalysisResult(source); |
158 assertNoErrors(source); | 154 assertNoErrors(source); |
159 verify([source]); | 155 verify([source]); |
160 } | 156 } |
161 | 157 |
162 test_ambiguousExport_combinators_hide() async { | 158 test_ambiguousExport_combinators_hide() async { |
163 Source source = addSource(r''' | 159 Source source = addSource(r''' |
164 library L; | 160 library L; |
165 export 'lib1.dart'; | 161 export 'lib1.dart'; |
166 export 'lib2.dart' hide B;'''); | 162 export 'lib2.dart' hide B;'''); |
167 addNamedSource( | 163 addNamedSource("/lib1.dart", r''' |
168 "/lib1.dart", | |
169 r''' | |
170 library L1; | 164 library L1; |
171 class A {} | 165 class A {} |
172 class B {}'''); | 166 class B {}'''); |
173 addNamedSource( | 167 addNamedSource("/lib2.dart", r''' |
174 "/lib2.dart", | |
175 r''' | |
176 library L2; | 168 library L2; |
177 class B {} | 169 class B {} |
178 class C {}'''); | 170 class C {}'''); |
179 await computeAnalysisResult(source); | 171 await computeAnalysisResult(source); |
180 assertNoErrors(source); | 172 assertNoErrors(source); |
181 verify([source]); | 173 verify([source]); |
182 } | 174 } |
183 | 175 |
184 test_ambiguousExport_combinators_show() async { | 176 test_ambiguousExport_combinators_show() async { |
185 Source source = addSource(r''' | 177 Source source = addSource(r''' |
186 library L; | 178 library L; |
187 export 'lib1.dart'; | 179 export 'lib1.dart'; |
188 export 'lib2.dart' show C;'''); | 180 export 'lib2.dart' show C;'''); |
189 addNamedSource( | 181 addNamedSource("/lib1.dart", r''' |
190 "/lib1.dart", | |
191 r''' | |
192 library L1; | 182 library L1; |
193 class A {} | 183 class A {} |
194 class B {}'''); | 184 class B {}'''); |
195 addNamedSource( | 185 addNamedSource("/lib2.dart", r''' |
196 "/lib2.dart", | |
197 r''' | |
198 library L2; | 186 library L2; |
199 class B {} | 187 class B {} |
200 class C {}'''); | 188 class C {}'''); |
201 await computeAnalysisResult(source); | 189 await computeAnalysisResult(source); |
202 assertNoErrors(source); | 190 assertNoErrors(source); |
203 verify([source]); | 191 verify([source]); |
204 } | 192 } |
205 | 193 |
206 test_ambiguousExport_sameDeclaration() async { | 194 test_ambiguousExport_sameDeclaration() async { |
207 Source source = addSource(r''' | 195 Source source = addSource(r''' |
208 library L; | 196 library L; |
209 export 'lib.dart'; | 197 export 'lib.dart'; |
210 export 'lib.dart';'''); | 198 export 'lib.dart';'''); |
211 addNamedSource( | 199 addNamedSource("/lib.dart", r''' |
212 "/lib.dart", | |
213 r''' | |
214 library lib; | 200 library lib; |
215 class N {}'''); | 201 class N {}'''); |
216 await computeAnalysisResult(source); | 202 await computeAnalysisResult(source); |
217 assertNoErrors(source); | 203 assertNoErrors(source); |
218 verify([source]); | 204 verify([source]); |
219 } | 205 } |
220 | 206 |
221 test_ambiguousImport_hideCombinator() async { | 207 test_ambiguousImport_hideCombinator() async { |
222 Source source = addSource(r''' | 208 Source source = addSource(r''' |
223 import 'lib1.dart'; | 209 import 'lib1.dart'; |
224 import 'lib2.dart'; | 210 import 'lib2.dart'; |
225 import 'lib3.dart' hide N; | 211 import 'lib3.dart' hide N; |
226 main() { | 212 main() { |
227 new N1(); | 213 new N1(); |
228 new N2(); | 214 new N2(); |
229 new N3(); | 215 new N3(); |
230 }'''); | 216 }'''); |
231 addNamedSource( | 217 addNamedSource("/lib1.dart", r''' |
232 "/lib1.dart", | |
233 r''' | |
234 library lib1; | 218 library lib1; |
235 class N {} | 219 class N {} |
236 class N1 {}'''); | 220 class N1 {}'''); |
237 addNamedSource( | 221 addNamedSource("/lib2.dart", r''' |
238 "/lib2.dart", | |
239 r''' | |
240 library lib2; | 222 library lib2; |
241 class N {} | 223 class N {} |
242 class N2 {}'''); | 224 class N2 {}'''); |
243 addNamedSource( | 225 addNamedSource("/lib3.dart", r''' |
244 "/lib3.dart", | |
245 r''' | |
246 library lib3; | 226 library lib3; |
247 class N {} | 227 class N {} |
248 class N3 {}'''); | 228 class N3 {}'''); |
249 await computeAnalysisResult(source); | 229 await computeAnalysisResult(source); |
250 assertNoErrors(source); | 230 assertNoErrors(source); |
251 } | 231 } |
252 | 232 |
253 test_ambiguousImport_showCombinator() async { | 233 test_ambiguousImport_showCombinator() async { |
254 Source source = addSource(r''' | 234 Source source = addSource(r''' |
255 import 'lib1.dart'; | 235 import 'lib1.dart'; |
256 import 'lib2.dart' show N, N2; | 236 import 'lib2.dart' show N, N2; |
257 main() { | 237 main() { |
258 new N1(); | 238 new N1(); |
259 new N2(); | 239 new N2(); |
260 }'''); | 240 }'''); |
261 addNamedSource( | 241 addNamedSource("/lib1.dart", r''' |
262 "/lib1.dart", | |
263 r''' | |
264 library lib1; | 242 library lib1; |
265 class N {} | 243 class N {} |
266 class N1 {}'''); | 244 class N1 {}'''); |
267 addNamedSource( | 245 addNamedSource("/lib2.dart", r''' |
268 "/lib2.dart", | |
269 r''' | |
270 library lib2; | 246 library lib2; |
271 class N {} | 247 class N {} |
272 class N2 {}'''); | 248 class N2 {}'''); |
273 await computeAnalysisResult(source); | 249 await computeAnalysisResult(source); |
274 assertErrors(source, [HintCode.UNUSED_SHOWN_NAME]); | 250 assertErrors(source, [HintCode.UNUSED_SHOWN_NAME]); |
275 } | 251 } |
276 | 252 |
277 test_annotated_partOfDeclaration() async { | 253 test_annotated_partOfDeclaration() async { |
278 Source source = addSource('library L; part "part.dart";'); | 254 Source source = addSource('library L; part "part.dart";'); |
279 addNamedSource('/part.dart', '@deprecated part of L;'); | 255 addNamedSource('/part.dart', '@deprecated part of L;'); |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 verify([source]); | 497 verify([source]); |
522 } | 498 } |
523 | 499 |
524 test_assignmentToFinals_importWithPrefix() async { | 500 test_assignmentToFinals_importWithPrefix() async { |
525 Source source = addSource(r''' | 501 Source source = addSource(r''' |
526 library lib; | 502 library lib; |
527 import 'lib1.dart' as foo; | 503 import 'lib1.dart' as foo; |
528 main() { | 504 main() { |
529 foo.x = true; | 505 foo.x = true; |
530 }'''); | 506 }'''); |
531 addNamedSource( | 507 addNamedSource("/lib1.dart", r''' |
532 "/lib1.dart", | |
533 r''' | |
534 library lib1; | 508 library lib1; |
535 bool x = false;'''); | 509 bool x = false;'''); |
536 await computeAnalysisResult(source); | 510 await computeAnalysisResult(source); |
537 assertNoErrors(source); | 511 assertNoErrors(source); |
538 verify([source]); | 512 verify([source]); |
539 } | 513 } |
540 | 514 |
541 test_async_dynamic_with_return() async { | 515 test_async_dynamic_with_return() async { |
542 Source source = addSource(''' | 516 Source source = addSource(''' |
543 dynamic f() async { | 517 dynamic f() async { |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 Source source = addSource(''' | 1280 Source source = addSource(''' |
1307 const Type d = dynamic; | 1281 const Type d = dynamic; |
1308 '''); | 1282 '''); |
1309 await computeAnalysisResult(source); | 1283 await computeAnalysisResult(source); |
1310 assertNoErrors(source); | 1284 assertNoErrors(source); |
1311 verify([source]); | 1285 verify([source]); |
1312 } | 1286 } |
1313 | 1287 |
1314 test_const_imported_defaultParameterValue_withImportPrefix() async { | 1288 test_const_imported_defaultParameterValue_withImportPrefix() async { |
1315 resetWith(options: new AnalysisOptionsImpl()..strongMode = true); | 1289 resetWith(options: new AnalysisOptionsImpl()..strongMode = true); |
1316 Source source = addNamedSource( | 1290 Source source = addNamedSource("/a.dart", r''' |
1317 "/a.dart", | |
1318 r''' | |
1319 import 'b.dart'; | 1291 import 'b.dart'; |
1320 const b = const B(); | 1292 const b = const B(); |
1321 '''); | 1293 '''); |
1322 addNamedSource( | 1294 addNamedSource("/b.dart", r''' |
1323 "/b.dart", | |
1324 r''' | |
1325 import 'c.dart' as ccc; | 1295 import 'c.dart' as ccc; |
1326 class B { | 1296 class B { |
1327 const B([p = ccc.value]); | 1297 const B([p = ccc.value]); |
1328 } | 1298 } |
1329 '''); | 1299 '''); |
1330 addNamedSource( | 1300 addNamedSource("/c.dart", r''' |
1331 "/c.dart", | |
1332 r''' | |
1333 const int value = 12345; | 1301 const int value = 12345; |
1334 '''); | 1302 '''); |
1335 await computeAnalysisResult(source); | 1303 await computeAnalysisResult(source); |
1336 assertNoErrors(source); | 1304 assertNoErrors(source); |
1337 verify([source]); | 1305 verify([source]); |
1338 } | 1306 } |
1339 | 1307 |
1340 test_constConstructorWithNonConstSuper_explicit() async { | 1308 test_constConstructorWithNonConstSuper_explicit() async { |
1341 Source source = addSource(r''' | 1309 Source source = addSource(r''' |
1342 class A { | 1310 class A { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 test_constEval_functionTypeLiteral() async { | 1414 test_constEval_functionTypeLiteral() async { |
1447 Source source = addSource(r''' | 1415 Source source = addSource(r''' |
1448 typedef F(); | 1416 typedef F(); |
1449 const C = F;'''); | 1417 const C = F;'''); |
1450 await computeAnalysisResult(source); | 1418 await computeAnalysisResult(source); |
1451 assertNoErrors(source); | 1419 assertNoErrors(source); |
1452 verify([source]); | 1420 verify([source]); |
1453 } | 1421 } |
1454 | 1422 |
1455 test_constEval_propertyExtraction_fieldStatic_targetType() async { | 1423 test_constEval_propertyExtraction_fieldStatic_targetType() async { |
1456 addNamedSource( | 1424 addNamedSource("/math.dart", r''' |
1457 "/math.dart", | |
1458 r''' | |
1459 library math; | 1425 library math; |
1460 const PI = 3.14;'''); | 1426 const PI = 3.14;'''); |
1461 Source source = addSource(r''' | 1427 Source source = addSource(r''' |
1462 import 'math.dart' as math; | 1428 import 'math.dart' as math; |
1463 const C = math.PI;'''); | 1429 const C = math.PI;'''); |
1464 await computeAnalysisResult(source); | 1430 await computeAnalysisResult(source); |
1465 assertNoErrors(source); | 1431 assertNoErrors(source); |
1466 verify([source]); | 1432 verify([source]); |
1467 } | 1433 } |
1468 | 1434 |
1469 test_constEval_propertyExtraction_methodStatic_targetType() async { | 1435 test_constEval_propertyExtraction_methodStatic_targetType() async { |
1470 Source source = addSource(r''' | 1436 Source source = addSource(r''' |
1471 class A { | 1437 class A { |
1472 const A(); | 1438 const A(); |
1473 static m() {} | 1439 static m() {} |
1474 } | 1440 } |
1475 const C = A.m;'''); | 1441 const C = A.m;'''); |
1476 await computeAnalysisResult(source); | 1442 await computeAnalysisResult(source); |
1477 assertNoErrors(source); | 1443 assertNoErrors(source); |
1478 verify([source]); | 1444 verify([source]); |
1479 } | 1445 } |
1480 | 1446 |
1481 test_constEval_symbol() async { | 1447 test_constEval_symbol() async { |
1482 addNamedSource( | 1448 addNamedSource("/math.dart", r''' |
1483 "/math.dart", | |
1484 r''' | |
1485 library math; | 1449 library math; |
1486 const PI = 3.14;'''); | 1450 const PI = 3.14;'''); |
1487 Source source = addSource(r''' | 1451 Source source = addSource(r''' |
1488 const C = #foo; | 1452 const C = #foo; |
1489 foo() {}'''); | 1453 foo() {}'''); |
1490 await computeAnalysisResult(source); | 1454 await computeAnalysisResult(source); |
1491 assertNoErrors(source); | 1455 assertNoErrors(source); |
1492 verify([source]); | 1456 verify([source]); |
1493 } | 1457 } |
1494 | 1458 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1714 await computeAnalysisResult(source); | 1678 await computeAnalysisResult(source); |
1715 assertNoErrors(source); | 1679 assertNoErrors(source); |
1716 verify([source]); | 1680 verify([source]); |
1717 } | 1681 } |
1718 | 1682 |
1719 test_deprecatedMemberUse_hide() async { | 1683 test_deprecatedMemberUse_hide() async { |
1720 Source source = addSource(r''' | 1684 Source source = addSource(r''' |
1721 library lib; | 1685 library lib; |
1722 import 'lib1.dart' hide B; | 1686 import 'lib1.dart' hide B; |
1723 A a = new A();'''); | 1687 A a = new A();'''); |
1724 addNamedSource( | 1688 addNamedSource("/lib1.dart", r''' |
1725 "/lib1.dart", | |
1726 r''' | |
1727 library lib1; | 1689 library lib1; |
1728 class A {} | 1690 class A {} |
1729 @deprecated | 1691 @deprecated |
1730 class B {}'''); | 1692 class B {}'''); |
1731 await computeAnalysisResult(source); | 1693 await computeAnalysisResult(source); |
1732 assertNoErrors(source); | 1694 assertNoErrors(source); |
1733 verify([source]); | 1695 verify([source]); |
1734 } | 1696 } |
1735 | 1697 |
1736 test_duplicateDefinition_emptyName() async { | 1698 test_duplicateDefinition_emptyName() async { |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2519 HintCode.UNUSED_IMPORT | 2481 HintCode.UNUSED_IMPORT |
2520 ]); | 2482 ]); |
2521 verify([source]); | 2483 verify([source]); |
2522 } | 2484 } |
2523 | 2485 |
2524 test_importOfNonLibrary_libraryDeclared() async { | 2486 test_importOfNonLibrary_libraryDeclared() async { |
2525 Source source = addSource(r''' | 2487 Source source = addSource(r''' |
2526 library lib; | 2488 library lib; |
2527 import 'part.dart'; | 2489 import 'part.dart'; |
2528 A a;'''); | 2490 A a;'''); |
2529 addNamedSource( | 2491 addNamedSource("/part.dart", r''' |
2530 "/part.dart", | |
2531 r''' | |
2532 library lib1; | 2492 library lib1; |
2533 class A {}'''); | 2493 class A {}'''); |
2534 await computeAnalysisResult(source); | 2494 await computeAnalysisResult(source); |
2535 assertNoErrors(source); | 2495 assertNoErrors(source); |
2536 verify([source]); | 2496 verify([source]); |
2537 } | 2497 } |
2538 | 2498 |
2539 test_importOfNonLibrary_libraryNotDeclared() async { | 2499 test_importOfNonLibrary_libraryNotDeclared() async { |
2540 Source source = addSource(r''' | 2500 Source source = addSource(r''' |
2541 library lib; | 2501 library lib; |
2542 import 'part.dart'; | 2502 import 'part.dart'; |
2543 A a;'''); | 2503 A a;'''); |
2544 addNamedSource("/part.dart", "class A {}"); | 2504 addNamedSource("/part.dart", "class A {}"); |
2545 await computeAnalysisResult(source); | 2505 await computeAnalysisResult(source); |
2546 assertNoErrors(source); | 2506 assertNoErrors(source); |
2547 verify([source]); | 2507 verify([source]); |
2548 } | 2508 } |
2549 | 2509 |
2550 test_importPrefixes_withFirstLetterDifference() async { | 2510 test_importPrefixes_withFirstLetterDifference() async { |
2551 Source source = addSource(r''' | 2511 Source source = addSource(r''' |
2552 library L; | 2512 library L; |
2553 import 'lib1.dart' as math; | 2513 import 'lib1.dart' as math; |
2554 import 'lib2.dart' as path; | 2514 import 'lib2.dart' as path; |
2555 main() { | 2515 main() { |
2556 math.test1(); | 2516 math.test1(); |
2557 path.test2(); | 2517 path.test2(); |
2558 }'''); | 2518 }'''); |
2559 addNamedSource( | 2519 addNamedSource("/lib1.dart", r''' |
2560 "/lib1.dart", | |
2561 r''' | |
2562 library lib1; | 2520 library lib1; |
2563 test1() {}'''); | 2521 test1() {}'''); |
2564 addNamedSource( | 2522 addNamedSource("/lib2.dart", r''' |
2565 "/lib2.dart", | |
2566 r''' | |
2567 library lib2; | 2523 library lib2; |
2568 test2() {}'''); | 2524 test2() {}'''); |
2569 await computeAnalysisResult(source); | 2525 await computeAnalysisResult(source); |
2570 assertNoErrors(source); | 2526 assertNoErrors(source); |
2571 verify([source]); | 2527 verify([source]); |
2572 } | 2528 } |
2573 | 2529 |
2574 test_inconsistentCaseExpressionTypes() async { | 2530 test_inconsistentCaseExpressionTypes() async { |
2575 Source source = addSource(r''' | 2531 Source source = addSource(r''' |
2576 f(var p) { | 2532 f(var p) { |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2798 assertNoErrors(source); | 2754 assertNoErrors(source); |
2799 verify([source]); | 2755 verify([source]); |
2800 } | 2756 } |
2801 | 2757 |
2802 test_instanceMethodNameCollidesWithSuperclassStatic_field() async { | 2758 test_instanceMethodNameCollidesWithSuperclassStatic_field() async { |
2803 Source source = addSource(r''' | 2759 Source source = addSource(r''' |
2804 import 'lib.dart'; | 2760 import 'lib.dart'; |
2805 class B extends A { | 2761 class B extends A { |
2806 _m() {} | 2762 _m() {} |
2807 }'''); | 2763 }'''); |
2808 addNamedSource( | 2764 addNamedSource("/lib.dart", r''' |
2809 "/lib.dart", | |
2810 r''' | |
2811 library L; | 2765 library L; |
2812 class A { | 2766 class A { |
2813 static var _m; | 2767 static var _m; |
2814 }'''); | 2768 }'''); |
2815 await computeAnalysisResult(source); | 2769 await computeAnalysisResult(source); |
2816 assertNoErrors(source); | 2770 assertNoErrors(source); |
2817 verify([source]); | 2771 verify([source]); |
2818 } | 2772 } |
2819 | 2773 |
2820 test_instanceMethodNameCollidesWithSuperclassStatic_method() async { | 2774 test_instanceMethodNameCollidesWithSuperclassStatic_method() async { |
2821 Source source = addSource(r''' | 2775 Source source = addSource(r''' |
2822 import 'lib.dart'; | 2776 import 'lib.dart'; |
2823 class B extends A { | 2777 class B extends A { |
2824 _m() {} | 2778 _m() {} |
2825 }'''); | 2779 }'''); |
2826 addNamedSource( | 2780 addNamedSource("/lib.dart", r''' |
2827 "/lib.dart", | |
2828 r''' | |
2829 library L; | 2781 library L; |
2830 class A { | 2782 class A { |
2831 static _m() {} | 2783 static _m() {} |
2832 }'''); | 2784 }'''); |
2833 await computeAnalysisResult(source); | 2785 await computeAnalysisResult(source); |
2834 assertNoErrors(source); | 2786 assertNoErrors(source); |
2835 verify([source]); | 2787 verify([source]); |
2836 } | 2788 } |
2837 | 2789 |
2838 test_invalidAnnotation_constantVariable_field() async { | 2790 test_invalidAnnotation_constantVariable_field() async { |
2839 Source source = addSource(r''' | 2791 Source source = addSource(r''' |
2840 @A.C | 2792 @A.C |
2841 class A { | 2793 class A { |
2842 static const C = 0; | 2794 static const C = 0; |
2843 }'''); | 2795 }'''); |
2844 await computeAnalysisResult(source); | 2796 await computeAnalysisResult(source); |
2845 assertNoErrors(source); | 2797 assertNoErrors(source); |
2846 verify([source]); | 2798 verify([source]); |
2847 } | 2799 } |
2848 | 2800 |
2849 test_invalidAnnotation_constantVariable_field_importWithPrefix() async { | 2801 test_invalidAnnotation_constantVariable_field_importWithPrefix() async { |
2850 addNamedSource( | 2802 addNamedSource("/lib.dart", r''' |
2851 "/lib.dart", | |
2852 r''' | |
2853 library lib; | 2803 library lib; |
2854 class A { | 2804 class A { |
2855 static const C = 0; | 2805 static const C = 0; |
2856 }'''); | 2806 }'''); |
2857 Source source = addSource(r''' | 2807 Source source = addSource(r''' |
2858 import 'lib.dart' as p; | 2808 import 'lib.dart' as p; |
2859 @p.A.C | 2809 @p.A.C |
2860 main() { | 2810 main() { |
2861 }'''); | 2811 }'''); |
2862 await computeAnalysisResult(source); | 2812 await computeAnalysisResult(source); |
2863 assertNoErrors(source); | 2813 assertNoErrors(source); |
2864 verify([source]); | 2814 verify([source]); |
2865 } | 2815 } |
2866 | 2816 |
2867 test_invalidAnnotation_constantVariable_topLevel() async { | 2817 test_invalidAnnotation_constantVariable_topLevel() async { |
2868 Source source = addSource(r''' | 2818 Source source = addSource(r''' |
2869 const C = 0; | 2819 const C = 0; |
2870 @C | 2820 @C |
2871 main() { | 2821 main() { |
2872 }'''); | 2822 }'''); |
2873 await computeAnalysisResult(source); | 2823 await computeAnalysisResult(source); |
2874 assertNoErrors(source); | 2824 assertNoErrors(source); |
2875 verify([source]); | 2825 verify([source]); |
2876 } | 2826 } |
2877 | 2827 |
2878 test_invalidAnnotation_constantVariable_topLevel_importWithPrefix() async { | 2828 test_invalidAnnotation_constantVariable_topLevel_importWithPrefix() async { |
2879 addNamedSource( | 2829 addNamedSource("/lib.dart", r''' |
2880 "/lib.dart", | |
2881 r''' | |
2882 library lib; | 2830 library lib; |
2883 const C = 0;'''); | 2831 const C = 0;'''); |
2884 Source source = addSource(r''' | 2832 Source source = addSource(r''' |
2885 import 'lib.dart' as p; | 2833 import 'lib.dart' as p; |
2886 @p.C | 2834 @p.C |
2887 main() { | 2835 main() { |
2888 }'''); | 2836 }'''); |
2889 await computeAnalysisResult(source); | 2837 await computeAnalysisResult(source); |
2890 assertNoErrors(source); | 2838 assertNoErrors(source); |
2891 verify([source]); | 2839 verify([source]); |
2892 } | 2840 } |
2893 | 2841 |
2894 test_invalidAnnotation_constConstructor_importWithPrefix() async { | 2842 test_invalidAnnotation_constConstructor_importWithPrefix() async { |
2895 addNamedSource( | 2843 addNamedSource("/lib.dart", r''' |
2896 "/lib.dart", | |
2897 r''' | |
2898 library lib; | 2844 library lib; |
2899 class A { | 2845 class A { |
2900 const A(int p); | 2846 const A(int p); |
2901 }'''); | 2847 }'''); |
2902 Source source = addSource(r''' | 2848 Source source = addSource(r''' |
2903 import 'lib.dart' as p; | 2849 import 'lib.dart' as p; |
2904 @p.A(42) | 2850 @p.A(42) |
2905 main() { | 2851 main() { |
2906 }'''); | 2852 }'''); |
2907 await computeAnalysisResult(source); | 2853 await computeAnalysisResult(source); |
2908 assertNoErrors(source); | 2854 assertNoErrors(source); |
2909 verify([source]); | 2855 verify([source]); |
2910 } | 2856 } |
2911 | 2857 |
2912 test_invalidAnnotation_constConstructor_named_importWithPrefix() async { | 2858 test_invalidAnnotation_constConstructor_named_importWithPrefix() async { |
2913 addNamedSource( | 2859 addNamedSource("/lib.dart", r''' |
2914 "/lib.dart", | |
2915 r''' | |
2916 library lib; | 2860 library lib; |
2917 class A { | 2861 class A { |
2918 const A.named(int p); | 2862 const A.named(int p); |
2919 }'''); | 2863 }'''); |
2920 Source source = addSource(r''' | 2864 Source source = addSource(r''' |
2921 import 'lib.dart' as p; | 2865 import 'lib.dart' as p; |
2922 @p.A.named(42) | 2866 @p.A.named(42) |
2923 main() { | 2867 main() { |
2924 }'''); | 2868 }'''); |
2925 await computeAnalysisResult(source); | 2869 await computeAnalysisResult(source); |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3233 } | 3177 } |
3234 class B extends A { | 3178 class B extends A { |
3235 m(a) {} | 3179 m(a) {} |
3236 }'''); | 3180 }'''); |
3237 await computeAnalysisResult(source); | 3181 await computeAnalysisResult(source); |
3238 assertNoErrors(source); | 3182 assertNoErrors(source); |
3239 verify([source]); | 3183 verify([source]); |
3240 } | 3184 } |
3241 | 3185 |
3242 test_invalidOverrideReturnType_returnType_interface() async { | 3186 test_invalidOverrideReturnType_returnType_interface() async { |
3243 Source source = addNamedSource( | 3187 Source source = addNamedSource("/test.dart", r''' |
3244 "/test.dart", | |
3245 r''' | |
3246 abstract class A { | 3188 abstract class A { |
3247 num m(); | 3189 num m(); |
3248 } | 3190 } |
3249 class B implements A { | 3191 class B implements A { |
3250 int m() { return 1; } | 3192 int m() { return 1; } |
3251 }'''); | 3193 }'''); |
3252 await computeAnalysisResult(source); | 3194 await computeAnalysisResult(source); |
3253 assertNoErrors(source); | 3195 assertNoErrors(source); |
3254 verify([source]); | 3196 verify([source]); |
3255 } | 3197 } |
3256 | 3198 |
3257 test_invalidOverrideReturnType_returnType_interface2() async { | 3199 test_invalidOverrideReturnType_returnType_interface2() async { |
3258 Source source = addNamedSource( | 3200 Source source = addNamedSource("/test.dart", r''' |
3259 "/test.dart", | |
3260 r''' | |
3261 abstract class A { | 3201 abstract class A { |
3262 num m(); | 3202 num m(); |
3263 } | 3203 } |
3264 abstract class B implements A { | 3204 abstract class B implements A { |
3265 } | 3205 } |
3266 class C implements B { | 3206 class C implements B { |
3267 int m() { return 1; } | 3207 int m() { return 1; } |
3268 }'''); | 3208 }'''); |
3269 await computeAnalysisResult(source); | 3209 await computeAnalysisResult(source); |
3270 assertNoErrors(source); | 3210 assertNoErrors(source); |
3271 verify([source]); | 3211 verify([source]); |
3272 } | 3212 } |
3273 | 3213 |
3274 test_invalidOverrideReturnType_returnType_mixin() async { | 3214 test_invalidOverrideReturnType_returnType_mixin() async { |
3275 Source source = addNamedSource( | 3215 Source source = addNamedSource("/test.dart", r''' |
3276 "/test.dart", | |
3277 r''' | |
3278 class A { | 3216 class A { |
3279 num m() { return 0; } | 3217 num m() { return 0; } |
3280 } | 3218 } |
3281 class B extends Object with A { | 3219 class B extends Object with A { |
3282 int m() { return 1; } | 3220 int m() { return 1; } |
3283 }'''); | 3221 }'''); |
3284 await computeAnalysisResult(source); | 3222 await computeAnalysisResult(source); |
3285 assertNoErrors(source); | 3223 assertNoErrors(source); |
3286 verify([source]); | 3224 verify([source]); |
3287 } | 3225 } |
3288 | 3226 |
3289 test_invalidOverrideReturnType_returnType_parameterizedTypes() async { | 3227 test_invalidOverrideReturnType_returnType_parameterizedTypes() async { |
3290 Source source = addSource(r''' | 3228 Source source = addSource(r''' |
3291 abstract class A<E> { | 3229 abstract class A<E> { |
3292 List<E> m(); | 3230 List<E> m(); |
3293 } | 3231 } |
3294 class B extends A<dynamic> { | 3232 class B extends A<dynamic> { |
3295 List<dynamic> m() { return new List<dynamic>(); } | 3233 List<dynamic> m() { return new List<dynamic>(); } |
3296 }'''); | 3234 }'''); |
3297 await computeAnalysisResult(source); | 3235 await computeAnalysisResult(source); |
3298 assertNoErrors(source); | 3236 assertNoErrors(source); |
3299 verify([source]); | 3237 verify([source]); |
3300 } | 3238 } |
3301 | 3239 |
3302 test_invalidOverrideReturnType_returnType_sameType() async { | 3240 test_invalidOverrideReturnType_returnType_sameType() async { |
3303 Source source = addNamedSource( | 3241 Source source = addNamedSource("/test.dart", r''' |
3304 "/test.dart", | |
3305 r''' | |
3306 class A { | 3242 class A { |
3307 int m() { return 0; } | 3243 int m() { return 0; } |
3308 } | 3244 } |
3309 class B extends A { | 3245 class B extends A { |
3310 int m() { return 1; } | 3246 int m() { return 1; } |
3311 }'''); | 3247 }'''); |
3312 await computeAnalysisResult(source); | 3248 await computeAnalysisResult(source); |
3313 assertNoErrors(source); | 3249 assertNoErrors(source); |
3314 verify([source]); | 3250 verify([source]); |
3315 } | 3251 } |
3316 | 3252 |
3317 test_invalidOverrideReturnType_returnType_superclass() async { | 3253 test_invalidOverrideReturnType_returnType_superclass() async { |
3318 Source source = addNamedSource( | 3254 Source source = addNamedSource("/test.dart", r''' |
3319 "/test.dart", | |
3320 r''' | |
3321 class A { | 3255 class A { |
3322 num m() { return 0; } | 3256 num m() { return 0; } |
3323 } | 3257 } |
3324 class B extends A { | 3258 class B extends A { |
3325 int m() { return 1; } | 3259 int m() { return 1; } |
3326 }'''); | 3260 }'''); |
3327 await computeAnalysisResult(source); | 3261 await computeAnalysisResult(source); |
3328 assertNoErrors(source); | 3262 assertNoErrors(source); |
3329 verify([source]); | 3263 verify([source]); |
3330 } | 3264 } |
3331 | 3265 |
3332 test_invalidOverrideReturnType_returnType_superclass2() async { | 3266 test_invalidOverrideReturnType_returnType_superclass2() async { |
3333 Source source = addNamedSource( | 3267 Source source = addNamedSource("/test.dart", r''' |
3334 "/test.dart", | |
3335 r''' | |
3336 class A { | 3268 class A { |
3337 num m() { return 0; } | 3269 num m() { return 0; } |
3338 } | 3270 } |
3339 class B extends A { | 3271 class B extends A { |
3340 } | 3272 } |
3341 class C extends B { | 3273 class C extends B { |
3342 int m() { return 1; } | 3274 int m() { return 1; } |
3343 }'''); | 3275 }'''); |
3344 await computeAnalysisResult(source); | 3276 await computeAnalysisResult(source); |
3345 assertNoErrors(source); | 3277 assertNoErrors(source); |
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4763 h(g); | 4695 h(g); |
4764 } | 4696 } |
4765 h(x) {} | 4697 h(x) {} |
4766 '''); | 4698 '''); |
4767 await computeAnalysisResult(source); | 4699 await computeAnalysisResult(source); |
4768 assertNoErrors(source); | 4700 assertNoErrors(source); |
4769 verify([source]); | 4701 verify([source]); |
4770 } | 4702 } |
4771 | 4703 |
4772 test_prefixCollidesWithTopLevelMembers() async { | 4704 test_prefixCollidesWithTopLevelMembers() async { |
4773 addNamedSource( | 4705 addNamedSource("/lib.dart", r''' |
4774 "/lib.dart", | |
4775 r''' | |
4776 library lib; | 4706 library lib; |
4777 class A {}'''); | 4707 class A {}'''); |
4778 Source source = addSource(r''' | 4708 Source source = addSource(r''' |
4779 import 'lib.dart' as p; | 4709 import 'lib.dart' as p; |
4780 typedef P(); | 4710 typedef P(); |
4781 p2() {} | 4711 p2() {} |
4782 var p3; | 4712 var p3; |
4783 class p4 {} | 4713 class p4 {} |
4784 p.A a;'''); | 4714 p.A a;'''); |
4785 await computeAnalysisResult(source); | 4715 await computeAnalysisResult(source); |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5763 f(Type t) {} | 5693 f(Type t) {} |
5764 main() { | 5694 main() { |
5765 f(C); | 5695 f(C); |
5766 }'''); | 5696 }'''); |
5767 await computeAnalysisResult(source); | 5697 await computeAnalysisResult(source); |
5768 assertNoErrors(source); | 5698 assertNoErrors(source); |
5769 verify([source]); | 5699 verify([source]); |
5770 } | 5700 } |
5771 | 5701 |
5772 test_typeType_class_prefixed() async { | 5702 test_typeType_class_prefixed() async { |
5773 addNamedSource( | 5703 addNamedSource("/lib.dart", r''' |
5774 "/lib.dart", | |
5775 r''' | |
5776 library lib; | 5704 library lib; |
5777 class C {}'''); | 5705 class C {}'''); |
5778 Source source = addSource(r''' | 5706 Source source = addSource(r''' |
5779 import 'lib.dart' as p; | 5707 import 'lib.dart' as p; |
5780 f(Type t) {} | 5708 f(Type t) {} |
5781 main() { | 5709 main() { |
5782 f(p.C); | 5710 f(p.C); |
5783 }'''); | 5711 }'''); |
5784 await computeAnalysisResult(source); | 5712 await computeAnalysisResult(source); |
5785 assertNoErrors(source); | 5713 assertNoErrors(source); |
5786 verify([source]); | 5714 verify([source]); |
5787 } | 5715 } |
5788 | 5716 |
5789 test_typeType_functionTypeAlias() async { | 5717 test_typeType_functionTypeAlias() async { |
5790 Source source = addSource(r''' | 5718 Source source = addSource(r''' |
5791 typedef F(); | 5719 typedef F(); |
5792 f(Type t) {} | 5720 f(Type t) {} |
5793 main() { | 5721 main() { |
5794 f(F); | 5722 f(F); |
5795 }'''); | 5723 }'''); |
5796 await computeAnalysisResult(source); | 5724 await computeAnalysisResult(source); |
5797 assertNoErrors(source); | 5725 assertNoErrors(source); |
5798 verify([source]); | 5726 verify([source]); |
5799 } | 5727 } |
5800 | 5728 |
5801 test_typeType_functionTypeAlias_prefixed() async { | 5729 test_typeType_functionTypeAlias_prefixed() async { |
5802 addNamedSource( | 5730 addNamedSource("/lib.dart", r''' |
5803 "/lib.dart", | |
5804 r''' | |
5805 library lib; | 5731 library lib; |
5806 typedef F();'''); | 5732 typedef F();'''); |
5807 Source source = addSource(r''' | 5733 Source source = addSource(r''' |
5808 import 'lib.dart' as p; | 5734 import 'lib.dart' as p; |
5809 f(Type t) {} | 5735 f(Type t) {} |
5810 main() { | 5736 main() { |
5811 f(p.F); | 5737 f(p.F); |
5812 }'''); | 5738 }'''); |
5813 await computeAnalysisResult(source); | 5739 await computeAnalysisResult(source); |
5814 assertNoErrors(source); | 5740 assertNoErrors(source); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5994 test_undefinedOperator_tilde() async { | 5920 test_undefinedOperator_tilde() async { |
5995 Source source = addSource(r''' | 5921 Source source = addSource(r''' |
5996 const A = 3; | 5922 const A = 3; |
5997 const B = ~((1 << A) - 1);'''); | 5923 const B = ~((1 << A) - 1);'''); |
5998 await computeAnalysisResult(source); | 5924 await computeAnalysisResult(source); |
5999 assertNoErrors(source); | 5925 assertNoErrors(source); |
6000 verify([source]); | 5926 verify([source]); |
6001 } | 5927 } |
6002 | 5928 |
6003 test_undefinedSetter_importWithPrefix() async { | 5929 test_undefinedSetter_importWithPrefix() async { |
6004 addNamedSource( | 5930 addNamedSource("/lib.dart", r''' |
6005 "/lib.dart", | |
6006 r''' | |
6007 library lib; | 5931 library lib; |
6008 set y(int value) {}'''); | 5932 set y(int value) {}'''); |
6009 Source source = addSource(r''' | 5933 Source source = addSource(r''' |
6010 import 'lib.dart' as x; | 5934 import 'lib.dart' as x; |
6011 main() { | 5935 main() { |
6012 x.y = 0; | 5936 x.y = 0; |
6013 }'''); | 5937 }'''); |
6014 await computeAnalysisResult(source); | 5938 await computeAnalysisResult(source); |
6015 assertNoErrors(source); | 5939 assertNoErrors(source); |
6016 verify([source]); | 5940 verify([source]); |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6417 await computeAnalysisResult(source); | 6341 await computeAnalysisResult(source); |
6418 assertNoErrors(source); | 6342 assertNoErrors(source); |
6419 verify([source]); | 6343 verify([source]); |
6420 reset(); | 6344 reset(); |
6421 } | 6345 } |
6422 | 6346 |
6423 Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async { | 6347 Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async { |
6424 await _check_wrongNumberOfParametersForOperator(name, "a"); | 6348 await _check_wrongNumberOfParametersForOperator(name, "a"); |
6425 } | 6349 } |
6426 } | 6350 } |
OLD | NEW |