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 | |
118 void test_ambiguousExport() { | 39 void test_ambiguousExport() { |
119 Source source = addSource(r''' | 40 Source source = addSource(r''' |
120 library L; | 41 library L; |
121 export 'lib1.dart'; | 42 export 'lib1.dart'; |
122 export 'lib2.dart';'''); | 43 export 'lib2.dart';'''); |
123 addNamedSource( | 44 addNamedSource( |
124 "/lib1.dart", | 45 "/lib1.dart", |
125 r''' | 46 r''' |
126 library lib1; | 47 library lib1; |
127 class M {}'''); | 48 class M {}'''); |
(...skipping 6086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6214 reset(); | 6135 reset(); |
6215 } | 6136 } |
6216 | 6137 |
6217 void _check_wrongNumberOfParametersForOperator1(String name) { | 6138 void _check_wrongNumberOfParametersForOperator1(String name) { |
6218 _check_wrongNumberOfParametersForOperator(name, "a"); | 6139 _check_wrongNumberOfParametersForOperator(name, "a"); |
6219 } | 6140 } |
6220 | 6141 |
6221 CompilationUnit _getResolvedLibraryUnit(Source source) => | 6142 CompilationUnit _getResolvedLibraryUnit(Source source) => |
6222 analysisContext.getResolvedCompilationUnit2(source, source); | 6143 analysisContext.getResolvedCompilationUnit2(source, source); |
6223 } | 6144 } |
OLD | NEW |