@@ -23,7 +23,7 @@ class ExtensionMethodTest extends DriverResolutionTest {
23
23
..contextFeatures = new FeatureSet .forTesting (
24
24
sdkVersion: '2.3.0' , additionalFeatures: [Feature .extension_methods]);
25
25
26
- test_more_specific_than_platform () async {
26
+ test_method_moreSpecificThanPlatform () async {
27
27
//
28
28
// An extension with on type clause T1 is more specific than another
29
29
// extension with on type clause T2 iff
60
60
expect (invocation.methodName.staticElement.library.isDartCore, isFalse);
61
61
}
62
62
63
- test_multipleExtensions () async {
64
- await assertNoErrorsInCode ('''
65
- class A {}
66
- extension E1 on A {}
67
- extension E2 on A {}
68
- ''' );
69
- }
70
-
71
- test_no_match () async {
63
+ test_method_noMatch () async {
72
64
await assertErrorCodesInCode (r'''
73
65
class B { }
74
66
83
75
''' , [StaticTypeWarningCode .UNDEFINED_METHOD ]);
84
76
}
85
77
86
- test_noMostSpecificExtension () async {
78
+ test_method_noMostSpecificExtension () async {
87
79
await assertErrorsInCode ('''
88
80
class A { }
89
81
104
96
]);
105
97
}
106
98
107
- test_one_match () async {
99
+ test_method_oneMatch () async {
108
100
await assertNoErrorsInCode ('''
109
101
class B { }
110
102
@@ -123,38 +115,7 @@ f() {
123
115
expect (invocation.methodName.staticElement, declaration.declaredElement);
124
116
}
125
117
126
- test_specific_subtype_match_platform () async {
127
- newFile ('/test/lib/core.dart' , content: '''
128
- library dart.core;
129
-
130
- class Core { }
131
-
132
- class Core2 extends Core { }
133
- ''' );
134
-
135
- await assertNoErrorsInCode ('''
136
- import 'core.dart';
137
-
138
- extension Core_Ext on Core {
139
- void a() { }
140
- }
141
-
142
- extension Core2_Ext on Core2 {
143
- void /*2*/ a() => 0;
144
- }
145
-
146
- f() {
147
- Core2 c = Core2();
148
- c.a();
149
- }
150
- ''' );
151
-
152
- var invocation = findNode.methodInvocation ('c.a()' );
153
- var declaration = findNode.methodDeclaration ('void /*2*/ a()' );
154
- expect (invocation.methodName.staticElement, declaration.declaredElement);
155
- }
156
-
157
- test_specificSubtype_match_local () async {
118
+ test_method_specificSubtypeMatchLocal () async {
158
119
await assertNoErrorsInCode ('''
159
120
class A { }
160
121
@@ -180,7 +141,7 @@ f() {
180
141
}
181
142
182
143
@failingTest
183
- test_specificSubtype_match_local_generics () async {
144
+ test_method_specificSubtypeMatchLocalGenerics () async {
184
145
await assertNoErrorsInCode ('''
185
146
class A<T> { }
186
147
@@ -207,4 +168,43 @@ main() {
207
168
var declaration = findNode.methodDeclaration ('void /*2*/ f(T x)' );
208
169
expect (invocation.methodName.staticElement, declaration.declaredElement);
209
170
}
171
+
172
+ test_method_specificSubtypeMatchPlatform () async {
173
+ newFile ('/test/lib/core.dart' , content: '''
174
+ library dart.core;
175
+
176
+ class Core { }
177
+
178
+ class Core2 extends Core { }
179
+ ''' );
180
+
181
+ await assertNoErrorsInCode ('''
182
+ import 'core.dart';
183
+
184
+ extension Core_Ext on Core {
185
+ void a() { }
186
+ }
187
+
188
+ extension Core2_Ext on Core2 {
189
+ void /*2*/ a() => 0;
190
+ }
191
+
192
+ f() {
193
+ Core2 c = Core2();
194
+ c.a();
195
+ }
196
+ ''' );
197
+
198
+ var invocation = findNode.methodInvocation ('c.a()' );
199
+ var declaration = findNode.methodDeclaration ('void /*2*/ a()' );
200
+ expect (invocation.methodName.staticElement, declaration.declaredElement);
201
+ }
202
+
203
+ test_multipleExtensions () async {
204
+ await assertNoErrorsInCode ('''
205
+ class A {}
206
+ extension E1 on A {}
207
+ extension E2 on A {}
208
+ ''' );
209
+ }
210
210
}
0 commit comments