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 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
10 import 'package:analyzer/src/generated/error.dart'; | 10 import 'package:analyzer/src/generated/error.dart'; |
(...skipping 2809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2820 g = () => 0; | 2820 g = () => 0; |
2821 }'''); | 2821 }'''); |
2822 computeLibrarySourceErrors(source); | 2822 computeLibrarySourceErrors(source); |
2823 assertNoErrors(source); | 2823 assertNoErrors(source); |
2824 verify([source]); | 2824 verify([source]); |
2825 } | 2825 } |
2826 | 2826 |
2827 void test_invalidFactoryNameNotAClass() { | 2827 void test_invalidFactoryNameNotAClass() { |
2828 Source source = addSource(r''' | 2828 Source source = addSource(r''' |
2829 class A { | 2829 class A { |
2830 factory A() {} | 2830 A.named() {} |
| 2831 factory A() => new A.named(); |
2831 }'''); | 2832 }'''); |
2832 computeLibrarySourceErrors(source); | 2833 computeLibrarySourceErrors(source); |
2833 assertNoErrors(source); | 2834 assertNoErrors(source); |
2834 verify([source]); | 2835 verify([source]); |
2835 } | 2836 } |
2836 | 2837 |
2837 void test_invalidIdentifierInAsync() { | 2838 void test_invalidIdentifierInAsync() { |
2838 Source source = addSource(r''' | 2839 Source source = addSource(r''' |
2839 class A { | 2840 class A { |
2840 m() { | 2841 m() { |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3484 } | 3485 } |
3485 class B extends Object with A {}'''); | 3486 class B extends Object with A {}'''); |
3486 computeLibrarySourceErrors(source); | 3487 computeLibrarySourceErrors(source); |
3487 assertNoErrors(source); | 3488 assertNoErrors(source); |
3488 verify([source]); | 3489 verify([source]); |
3489 } | 3490 } |
3490 | 3491 |
3491 void test_mixinDeclaresConstructor_factory() { | 3492 void test_mixinDeclaresConstructor_factory() { |
3492 Source source = addSource(r''' | 3493 Source source = addSource(r''' |
3493 class A { | 3494 class A { |
3494 factory A() {} | 3495 factory A() = B; |
3495 } | 3496 } |
3496 class B extends Object with A {}'''); | 3497 class B extends Object with A {}'''); |
3497 computeLibrarySourceErrors(source); | 3498 computeLibrarySourceErrors(source); |
3498 assertNoErrors(source); | 3499 assertNoErrors(source); |
3499 verify([source]); | 3500 verify([source]); |
3500 } | 3501 } |
3501 | 3502 |
3502 void test_mixinInheritsFromNotObject_classDeclaration_extends() { | 3503 void test_mixinInheritsFromNotObject_classDeclaration_extends() { |
3503 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | 3504 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
3504 options.enableSuperMixins = true; | 3505 options.enableSuperMixins = true; |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4268 }'''); | 4269 }'''); |
4269 computeLibrarySourceErrors(source); | 4270 computeLibrarySourceErrors(source); |
4270 assertNoErrors(source); | 4271 assertNoErrors(source); |
4271 verify([source]); | 4272 verify([source]); |
4272 } | 4273 } |
4273 | 4274 |
4274 void test_nonGenerativeConstructor() { | 4275 void test_nonGenerativeConstructor() { |
4275 Source source = addSource(r''' | 4276 Source source = addSource(r''' |
4276 class A { | 4277 class A { |
4277 A.named() {} | 4278 A.named() {} |
4278 factory A() {} | 4279 factory A() => new A.named(); |
4279 } | 4280 } |
4280 class B extends A { | 4281 class B extends A { |
4281 B() : super.named(); | 4282 B() : super.named(); |
4282 }'''); | 4283 }'''); |
4283 computeLibrarySourceErrors(source); | 4284 computeLibrarySourceErrors(source); |
4284 assertNoErrors(source); | 4285 assertNoErrors(source); |
4285 verify([source]); | 4286 verify([source]); |
4286 } | 4287 } |
4287 | 4288 |
4288 void test_nonTypeInCatchClause_isClass() { | 4289 void test_nonTypeInCatchClause_isClass() { |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4686 | 4687 |
4687 void test_recursiveFactoryRedirect() { | 4688 void test_recursiveFactoryRedirect() { |
4688 Source source = addSource(r''' | 4689 Source source = addSource(r''' |
4689 class A { | 4690 class A { |
4690 factory A() = B; | 4691 factory A() = B; |
4691 } | 4692 } |
4692 class B implements A { | 4693 class B implements A { |
4693 factory B() = C; | 4694 factory B() = C; |
4694 } | 4695 } |
4695 class C implements B { | 4696 class C implements B { |
4696 factory C() {} | 4697 C.named() {} |
| 4698 factory C() => new C.named(); |
4697 }'''); | 4699 }'''); |
4698 computeLibrarySourceErrors(source); | 4700 computeLibrarySourceErrors(source); |
4699 assertNoErrors(source); | 4701 assertNoErrors(source); |
4700 verify([source]); | 4702 verify([source]); |
4701 } | 4703 } |
4702 | 4704 |
4703 void test_redirectToInvalidFunctionType() { | 4705 void test_redirectToInvalidFunctionType() { |
4704 Source source = addSource(r''' | 4706 Source source = addSource(r''' |
4705 class A implements B { | 4707 class A implements B { |
4706 A(int p) {} | 4708 A(int p) {} |
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6068 reset(); | 6070 reset(); |
6069 } | 6071 } |
6070 | 6072 |
6071 void _check_wrongNumberOfParametersForOperator1(String name) { | 6073 void _check_wrongNumberOfParametersForOperator1(String name) { |
6072 _check_wrongNumberOfParametersForOperator(name, "a"); | 6074 _check_wrongNumberOfParametersForOperator(name, "a"); |
6073 } | 6075 } |
6074 | 6076 |
6075 CompilationUnit _getResolvedLibraryUnit(Source source) => | 6077 CompilationUnit _getResolvedLibraryUnit(Source source) => |
6076 analysisContext.getResolvedCompilationUnit2(source, source); | 6078 analysisContext.getResolvedCompilationUnit2(source, source); |
6077 } | 6079 } |
OLD | NEW |