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.compile_time_error_code_test; | 5 library analyzer.test.generated.compile_time_error_code_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analyzer/error/error.dart'; | 9 import 'package:analyzer/error/error.dart'; |
10 import 'package:analyzer/src/error/codes.dart'; | 10 import 'package:analyzer/src/error/codes.dart'; |
(...skipping 2764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2775 verify([source]); | 2775 verify([source]); |
2776 } | 2776 } |
2777 | 2777 |
2778 test_implementsSuperClass_Object() async { | 2778 test_implementsSuperClass_Object() async { |
2779 Source source = addSource("class A implements Object {}"); | 2779 Source source = addSource("class A implements Object {}"); |
2780 await computeAnalysisResult(source); | 2780 await computeAnalysisResult(source); |
2781 assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS]); | 2781 assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS]); |
2782 verify([source]); | 2782 verify([source]); |
2783 } | 2783 } |
2784 | 2784 |
| 2785 test_implementsSuperClass_Object_typeAlias() async { |
| 2786 Source source = addSource(r''' |
| 2787 class M {} |
| 2788 class A = Object with M implements Object; |
| 2789 '''); |
| 2790 await computeAnalysisResult(source); |
| 2791 assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS]); |
| 2792 verify([source]); |
| 2793 } |
| 2794 |
2785 test_implementsSuperClass_typeAlias() async { | 2795 test_implementsSuperClass_typeAlias() async { |
2786 Source source = addSource(r''' | 2796 Source source = addSource(r''' |
2787 class A {} | 2797 class A {} |
2788 class M {} | 2798 class M {} |
2789 class B = A with M implements A;'''); | 2799 class B = A with M implements A;'''); |
2790 await computeAnalysisResult(source); | 2800 await computeAnalysisResult(source); |
2791 assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS]); | 2801 assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS]); |
2792 verify([source]); | 2802 verify([source]); |
2793 } | |
2794 | |
2795 test_implementsSuperClass_Object_typeAlias() async { | |
2796 Source source = addSource(r''' | |
2797 class M {} | |
2798 class A = Object with M implements Object; | |
2799 '''); | |
2800 await computeAnalysisResult(source); | |
2801 assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS]); | |
2802 verify([source]); | |
2803 } | 2803 } |
2804 | 2804 |
2805 test_implicitThisReferenceInInitializer_field() async { | 2805 test_implicitThisReferenceInInitializer_field() async { |
2806 Source source = addSource(r''' | 2806 Source source = addSource(r''' |
2807 class A { | 2807 class A { |
2808 var v; | 2808 var v; |
2809 A() : v = f; | 2809 A() : v = f; |
2810 var f; | 2810 var f; |
2811 }'''); | 2811 }'''); |
2812 await computeAnalysisResult(source); | 2812 await computeAnalysisResult(source); |
(...skipping 2537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5350 f() { | 5350 f() { |
5351 p?.g(); | 5351 p?.g(); |
5352 } | 5352 } |
5353 '''); | 5353 '''); |
5354 await computeAnalysisResult(source); | 5354 await computeAnalysisResult(source); |
5355 assertErrors( | 5355 assertErrors( |
5356 source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]); | 5356 source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]); |
5357 verify([source]); | 5357 verify([source]); |
5358 } | 5358 } |
5359 | 5359 |
| 5360 test_privateCollisionInClassTypeAlias_mixinAndMixin() { |
| 5361 return _privateCollisionInMixinApplicationTest(''' |
| 5362 import 'lib1.dart'; |
| 5363 class C = Object with A, B; |
| 5364 '''); |
| 5365 } |
| 5366 |
| 5367 test_privateCollisionInClassTypeAlias_mixinAndMixin_indirect() { |
| 5368 return _privateCollisionInMixinApplicationTest(''' |
| 5369 import 'lib1.dart'; |
| 5370 class C = Object with A; |
| 5371 class D = C with B; |
| 5372 '''); |
| 5373 } |
| 5374 |
| 5375 test_privateCollisionInClassTypeAlias_superclassAndMixin() { |
| 5376 return _privateCollisionInMixinApplicationTest(''' |
| 5377 import 'lib1.dart'; |
| 5378 class C = A with B; |
| 5379 '''); |
| 5380 } |
| 5381 |
| 5382 test_privateCollisionInClassTypeAlias_superclassAndMixin_same() { |
| 5383 return _privateCollisionInMixinApplicationTest(''' |
| 5384 import 'lib1.dart'; |
| 5385 class C = A with A; |
| 5386 '''); |
| 5387 } |
| 5388 |
5360 test_privateCollisionInMixinApplication_mixinAndMixin() { | 5389 test_privateCollisionInMixinApplication_mixinAndMixin() { |
5361 return _privateCollisionInMixinApplicationTest(''' | 5390 return _privateCollisionInMixinApplicationTest(''' |
5362 import 'lib1.dart'; | 5391 import 'lib1.dart'; |
5363 class C extends Object with A, B {} | 5392 class C extends Object with A, B {} |
5364 '''); | 5393 '''); |
5365 } | 5394 } |
5366 | 5395 |
5367 test_privateCollisionInMixinApplication_mixinAndMixin_indirect() { | 5396 test_privateCollisionInMixinApplication_mixinAndMixin_indirect() { |
5368 return _privateCollisionInMixinApplicationTest(''' | 5397 return _privateCollisionInMixinApplicationTest(''' |
5369 import 'lib1.dart'; | 5398 import 'lib1.dart'; |
5370 class C extends Object with A {} | 5399 class C extends Object with A {} |
5371 class D extends C with B {} | 5400 class D extends C with B {} |
5372 '''); | 5401 '''); |
5373 } | 5402 } |
5374 | 5403 |
5375 test_privateCollisionInMixinApplication_superclassAndMixin() { | 5404 test_privateCollisionInMixinApplication_superclassAndMixin() { |
5376 return _privateCollisionInMixinApplicationTest(''' | 5405 return _privateCollisionInMixinApplicationTest(''' |
5377 import 'lib1.dart'; | 5406 import 'lib1.dart'; |
5378 class C extends A with B {} | 5407 class C extends A with B {} |
5379 '''); | 5408 '''); |
5380 } | 5409 } |
5381 | 5410 |
5382 test_privateCollisionInMixinApplication_superclassAndMixin_same() { | 5411 test_privateCollisionInMixinApplication_superclassAndMixin_same() { |
5383 return _privateCollisionInMixinApplicationTest(''' | 5412 return _privateCollisionInMixinApplicationTest(''' |
5384 import 'lib1.dart'; | 5413 import 'lib1.dart'; |
5385 class C extends A with A {} | 5414 class C extends A with A {} |
5386 '''); | 5415 '''); |
5387 } | 5416 } |
5388 | 5417 |
5389 test_privateCollisionInClassTypeAlias_mixinAndMixin() { | |
5390 return _privateCollisionInMixinApplicationTest(''' | |
5391 import 'lib1.dart'; | |
5392 class C = Object with A, B; | |
5393 '''); | |
5394 } | |
5395 | |
5396 test_privateCollisionInClassTypeAlias_mixinAndMixin_indirect() { | |
5397 return _privateCollisionInMixinApplicationTest(''' | |
5398 import 'lib1.dart'; | |
5399 class C = Object with A; | |
5400 class D = C with B; | |
5401 '''); | |
5402 } | |
5403 | |
5404 test_privateCollisionInClassTypeAlias_superclassAndMixin() { | |
5405 return _privateCollisionInMixinApplicationTest(''' | |
5406 import 'lib1.dart'; | |
5407 class C = A with B; | |
5408 '''); | |
5409 } | |
5410 | |
5411 test_privateCollisionInClassTypeAlias_superclassAndMixin_same() { | |
5412 return _privateCollisionInMixinApplicationTest(''' | |
5413 import 'lib1.dart'; | |
5414 class C = A with A; | |
5415 '''); | |
5416 } | |
5417 | |
5418 test_privateOptionalParameter() async { | 5418 test_privateOptionalParameter() async { |
5419 Source source = addSource("f({var _p}) {}"); | 5419 Source source = addSource("f({var _p}) {}"); |
5420 await computeAnalysisResult(source); | 5420 await computeAnalysisResult(source); |
5421 assertErrors(source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]); | 5421 assertErrors(source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]); |
5422 verify([source]); | 5422 verify([source]); |
5423 } | 5423 } |
5424 | 5424 |
5425 test_privateOptionalParameter_fieldFormal() async { | 5425 test_privateOptionalParameter_fieldFormal() async { |
5426 Source source = addSource(r''' | 5426 Source source = addSource(r''' |
5427 class A { | 5427 class A { |
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6661 int _x; | 6661 int _x; |
6662 } | 6662 } |
6663 '''); | 6663 '''); |
6664 Source source = addSource(testCode); | 6664 Source source = addSource(testCode); |
6665 await computeAnalysisResult(source); | 6665 await computeAnalysisResult(source); |
6666 assertErrors( | 6666 assertErrors( |
6667 source, [CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION]); | 6667 source, [CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION]); |
6668 verify([source]); | 6668 verify([source]); |
6669 } | 6669 } |
6670 } | 6670 } |
OLD | NEW |