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/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 18 matching lines...) Expand all Loading... |
29 Source source = addSource(r''' | 29 Source source = addSource(r''' |
30 enum E { ONE } | 30 enum E { ONE } |
31 E e() { | 31 E e() { |
32 return E.TWO; | 32 return E.TWO; |
33 }'''); | 33 }'''); |
34 computeLibrarySourceErrors(source); | 34 computeLibrarySourceErrors(source); |
35 assertNoErrors(source); | 35 assertNoErrors(source); |
36 verify([source]); | 36 verify([source]); |
37 } | 37 } |
38 | 38 |
| 39 void test_abstractSuperMemberReference_superHasNoSuchMethod() { |
| 40 Source source = addSource(''' |
| 41 abstract class A { |
| 42 int m(); |
| 43 noSuchMethod(_) => 42; |
| 44 } |
| 45 |
| 46 class B extends A { |
| 47 int m() => super.m(); |
| 48 } |
| 49 '''); |
| 50 computeLibrarySourceErrors(source); |
| 51 assertNoErrors(source); |
| 52 verify([source]); |
| 53 } |
| 54 |
| 55 void test_abstractSuperMemberReference_superSuperHasConcrete_getter() { |
| 56 Source source = addSource(''' |
| 57 abstract class A { |
| 58 int get m => 0; |
| 59 } |
| 60 |
| 61 abstract class B extends A { |
| 62 int get m; |
| 63 } |
| 64 |
| 65 class C extends B { |
| 66 int get m => super.m; |
| 67 } |
| 68 '''); |
| 69 computeLibrarySourceErrors(source); |
| 70 assertNoErrors(source); |
| 71 verify([source]); |
| 72 } |
| 73 |
| 74 void test_abstractSuperMemberReference_superSuperHasConcrete_method() { |
| 75 Source source = addSource(''' |
| 76 void main() { |
| 77 print(new C().m()); |
| 78 } |
| 79 |
| 80 abstract class A { |
| 81 int m() => 0; |
| 82 } |
| 83 |
| 84 abstract class B extends A { |
| 85 int m(); |
| 86 } |
| 87 |
| 88 class C extends B { |
| 89 int m() => super.m(); |
| 90 } |
| 91 '''); |
| 92 computeLibrarySourceErrors(source); |
| 93 assertNoErrors(source); |
| 94 verify([source]); |
| 95 } |
| 96 |
| 97 void test_abstractSuperMemberReference_superSuperHasConcrete_setter() { |
| 98 Source source = addSource(''' |
| 99 abstract class A { |
| 100 void set m(int v) {} |
| 101 } |
| 102 |
| 103 abstract class B extends A { |
| 104 void set m(int v); |
| 105 } |
| 106 |
| 107 class C extends B { |
| 108 void set m(int v) { |
| 109 super.m = 0; |
| 110 } |
| 111 } |
| 112 '''); |
| 113 computeLibrarySourceErrors(source); |
| 114 assertNoErrors(source); |
| 115 verify([source]); |
| 116 } |
| 117 |
39 void test_ambiguousExport() { | 118 void test_ambiguousExport() { |
40 Source source = addSource(r''' | 119 Source source = addSource(r''' |
41 library L; | 120 library L; |
42 export 'lib1.dart'; | 121 export 'lib1.dart'; |
43 export 'lib2.dart';'''); | 122 export 'lib2.dart';'''); |
44 addNamedSource( | 123 addNamedSource( |
45 "/lib1.dart", | 124 "/lib1.dart", |
46 r''' | 125 r''' |
47 library lib1; | 126 library lib1; |
48 class M {}'''); | 127 class M {}'''); |
(...skipping 6086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6135 reset(); | 6214 reset(); |
6136 } | 6215 } |
6137 | 6216 |
6138 void _check_wrongNumberOfParametersForOperator1(String name) { | 6217 void _check_wrongNumberOfParametersForOperator1(String name) { |
6139 _check_wrongNumberOfParametersForOperator(name, "a"); | 6218 _check_wrongNumberOfParametersForOperator(name, "a"); |
6140 } | 6219 } |
6141 | 6220 |
6142 CompilationUnit _getResolvedLibraryUnit(Source source) => | 6221 CompilationUnit _getResolvedLibraryUnit(Source source) => |
6143 analysisContext.getResolvedCompilationUnit2(source, source); | 6222 analysisContext.getResolvedCompilationUnit2(source, source); |
6144 } | 6223 } |
OLD | NEW |