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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'package:async_helper/async_helper.dart'; | 6 import 'package:async_helper/async_helper.dart'; |
7 import 'compiler_helper.dart'; | 7 import 'compiler_helper.dart'; |
8 import 'package:compiler/src/resolution/class_members.dart' | 8 import 'package:compiler/src/resolution/class_members.dart' show MembersCreator; |
9 show MembersCreator; | |
10 | 9 |
11 main() { | 10 main() { |
12 asyncTest(() => Future.wait([ | 11 asyncTest(() => Future.wait([ |
13 testRequiredParameters(), | 12 testRequiredParameters(), |
14 testPositionalParameters(), | 13 testPositionalParameters(), |
15 testNamedParameters(), | 14 testNamedParameters(), |
16 testNotSubtype(), | 15 testNotSubtype(), |
17 testGetterNotSubtype(), | 16 testGetterNotSubtype(), |
18 testSetterNotSubtype(), | 17 testSetterNotSubtype(), |
19 testGenericNotSubtype(), | 18 testGenericNotSubtype(), |
20 testFieldNotSubtype(), | 19 testFieldNotSubtype(), |
21 testMixedOverride(), | 20 testMixedOverride(), |
22 testAbstractMethods(), | 21 testAbstractMethods(), |
23 testNoSuchMethod(), | 22 testNoSuchMethod(), |
24 ])); | 23 ])); |
25 } | 24 } |
26 | 25 |
27 Future check(String source, {errors, warnings, hints, infos}) { | 26 Future check(String source, {errors, warnings, hints, infos}) { |
28 return MockCompiler.create((MockCompiler compiler) { | 27 return MockCompiler.create((MockCompiler compiler) { |
29 compiler.diagnosticHandler = createHandler(compiler, source); | 28 compiler.diagnosticHandler = createHandler(compiler, source); |
30 compiler.parseScript(source); | 29 compiler.parseScript(source); |
31 var cls = compiler.mainApp.find('Class'); | 30 var cls = compiler.mainApp.find('Class'); |
32 cls.ensureResolved(compiler.resolution); | 31 cls.ensureResolved(compiler.resolution); |
33 MembersCreator.computeAllClassMembers(compiler.resolution, cls); | 32 MembersCreator.computeAllClassMembers(compiler.resolution, cls); |
34 | 33 |
35 toList(o) => o == null ? [] : o is List ? o : [o]; | 34 toList(o) => o == null ? [] : o is List ? o : [o]; |
36 | 35 |
37 compareMessageKinds( | 36 compareMessageKinds( |
38 source, toList(errors), | 37 source, toList(errors), compiler.diagnosticCollector.errors, 'error'); |
39 compiler.diagnosticCollector.errors, 'error'); | |
40 | 38 |
41 compareMessageKinds( | 39 compareMessageKinds(source, toList(warnings), |
42 source, toList(warnings), | |
43 compiler.diagnosticCollector.warnings, 'warning'); | 40 compiler.diagnosticCollector.warnings, 'warning'); |
44 | 41 |
45 if (infos != null) { | 42 if (infos != null) { |
46 compareMessageKinds( | 43 compareMessageKinds( |
47 source, toList(infos), | 44 source, toList(infos), compiler.diagnosticCollector.infos, 'info'); |
48 compiler.diagnosticCollector.infos, 'info'); | |
49 } | 45 } |
50 | 46 |
51 if (hints != null) { | 47 if (hints != null) { |
52 compareMessageKinds( | 48 compareMessageKinds( |
53 source, toList(hints), | 49 source, toList(hints), compiler.diagnosticCollector.hints, 'hint'); |
54 compiler.diagnosticCollector.hints, 'hint'); | |
55 } | 50 } |
56 }); | 51 }); |
57 } | 52 } |
58 | 53 |
59 Future testRequiredParameters() { | 54 Future testRequiredParameters() { |
60 return Future.wait([ | 55 return Future.wait([ |
61 check(""" | 56 check(""" |
62 class A { | 57 class A { |
63 method() => null; // testRequiredParameters:0 | 58 method() => null; // testRequiredParameters:0 |
64 } | 59 } |
65 class Class extends A { | 60 class Class extends A { |
66 method() => null; // testRequiredParameters:1 | 61 method() => null; // testRequiredParameters:1 |
67 } | 62 } |
68 """), | 63 """), |
69 | |
70 check(""" | 64 check(""" |
71 class A { | 65 class A { |
72 method(a) => null; // testRequiredParameters:2 | 66 method(a) => null; // testRequiredParameters:2 |
73 } | 67 } |
74 class Class extends A { | 68 class Class extends A { |
75 method(b) => null; // testRequiredParameters:3 | 69 method(b) => null; // testRequiredParameters:3 |
76 } | 70 } |
77 """), | 71 """), |
78 | |
79 check(""" | 72 check(""" |
80 class A { | 73 class A { |
81 method(a, b, c, d) => null; // testRequiredParameters:3 | 74 method(a, b, c, d) => null; // testRequiredParameters:3 |
82 } | 75 } |
83 class Class extends A { | 76 class Class extends A { |
84 method(b, a, d, c) => null; // testRequiredParameters:4 | 77 method(b, a, d, c) => null; // testRequiredParameters:4 |
85 } | 78 } |
86 """), | 79 """), |
87 | 80 check( |
88 check(""" | 81 """ |
89 class A { | 82 class A { |
90 method() => null; // testRequiredParameters:5 | 83 method() => null; // testRequiredParameters:5 |
91 } | 84 } |
92 class Class extends A { | 85 class Class extends A { |
93 method(a) => null; // testRequiredParameters:6 | 86 method(a) => null; // testRequiredParameters:6 |
94 } | 87 } |
95 """, warnings: MessageKind.INVALID_OVERRIDE_METHOD, | 88 """, |
96 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), | 89 warnings: MessageKind.INVALID_OVERRIDE_METHOD, |
97 | 90 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), |
98 check(""" | 91 check( |
| 92 """ |
99 class A { | 93 class A { |
100 method() => null; // testRequiredParameters:7 | 94 method() => null; // testRequiredParameters:7 |
101 } | 95 } |
102 class Class implements A { | 96 class Class implements A { |
103 method(a) => null; // testRequiredParameters:8 | 97 method(a) => null; // testRequiredParameters:8 |
104 } | 98 } |
105 """, warnings: MessageKind.INVALID_OVERRIDE_METHOD, | 99 """, |
106 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), | 100 warnings: MessageKind.INVALID_OVERRIDE_METHOD, |
107 | 101 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), |
108 check(""" | 102 check( |
| 103 """ |
109 class A { | 104 class A { |
110 method(a, b, c) => null; // testRequiredParameters:9 | 105 method(a, b, c) => null; // testRequiredParameters:9 |
111 } | 106 } |
112 class Class extends A { | 107 class Class extends A { |
113 method(a, b, c, d) => null; // testRequiredParameters:10 | 108 method(a, b, c, d) => null; // testRequiredParameters:10 |
114 } | 109 } |
115 """, warnings: MessageKind.INVALID_OVERRIDE_METHOD, | 110 """, |
116 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), | 111 warnings: MessageKind.INVALID_OVERRIDE_METHOD, |
| 112 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), |
117 ]); | 113 ]); |
118 } | 114 } |
119 | 115 |
120 Future testPositionalParameters() { | 116 Future testPositionalParameters() { |
121 return Future.wait([ | 117 return Future.wait([ |
122 check(""" | 118 check(""" |
123 class A { | 119 class A { |
124 method([a]) => null; // testPositionalParameters:1 | 120 method([a]) => null; // testPositionalParameters:1 |
125 } | 121 } |
126 class Class extends A { | 122 class Class extends A { |
127 method([a]) => null; // testPositionalParameters:2 | 123 method([a]) => null; // testPositionalParameters:2 |
128 } | 124 } |
129 """), | 125 """), |
130 | |
131 check(""" | 126 check(""" |
132 class A { | 127 class A { |
133 method([a, b]) => null; // testPositionalParameters:3 | 128 method([a, b]) => null; // testPositionalParameters:3 |
134 } | 129 } |
135 class Class extends A { | 130 class Class extends A { |
136 method([b, a]) => null; // testPositionalParameters:4 | 131 method([b, a]) => null; // testPositionalParameters:4 |
137 } | 132 } |
138 """), | 133 """), |
139 | |
140 check(""" | 134 check(""" |
141 class A { | 135 class A { |
142 method([a, b, c]) => null; // testPositionalParameters:5 | 136 method([a, b, c]) => null; // testPositionalParameters:5 |
143 } | 137 } |
144 class Class extends A { | 138 class Class extends A { |
145 method([b, d, a, c]) => null; // testPositionalParameters:6 | 139 method([b, d, a, c]) => null; // testPositionalParameters:6 |
146 } | 140 } |
147 """), | 141 """), |
148 | |
149 check(""" | 142 check(""" |
150 class A { | 143 class A { |
151 method([a]) => null; // testPositionalParameters:7 | 144 method([a]) => null; // testPositionalParameters:7 |
152 } | 145 } |
153 class Class extends A { | 146 class Class extends A { |
154 method([a]) => null; // testPositionalParameters:8 | 147 method([a]) => null; // testPositionalParameters:8 |
155 } | 148 } |
156 """), | 149 """), |
157 | 150 check( |
158 check(""" | 151 """ |
159 class A { | 152 class A { |
160 method(a) => null; // testPositionalParameters:9 | 153 method(a) => null; // testPositionalParameters:9 |
161 } | 154 } |
162 class Class extends A { | 155 class Class extends A { |
163 method() => null; // testPositionalParameters:10 | 156 method() => null; // testPositionalParameters:10 |
164 } | 157 } |
165 """, warnings: MessageKind.INVALID_OVERRIDE_METHOD, | 158 """, |
166 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), | 159 warnings: MessageKind.INVALID_OVERRIDE_METHOD, |
167 | 160 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), |
168 check(""" | 161 check( |
| 162 """ |
169 class A { | 163 class A { |
170 method(a, [b]) => null; // testPositionalParameters:11 | 164 method(a, [b]) => null; // testPositionalParameters:11 |
171 } | 165 } |
172 class Class extends A { | 166 class Class extends A { |
173 method(a) => null; // testPositionalParameters:12 | 167 method(a) => null; // testPositionalParameters:12 |
174 } | 168 } |
175 """, warnings: MessageKind.INVALID_OVERRIDE_METHOD, | 169 """, |
176 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), | 170 warnings: MessageKind.INVALID_OVERRIDE_METHOD, |
177 | 171 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), |
178 check(""" | 172 check( |
| 173 """ |
179 class A { | 174 class A { |
180 method(a, [b]) => null; // testPositionalParameters:13 | 175 method(a, [b]) => null; // testPositionalParameters:13 |
181 } | 176 } |
182 class Class extends A { | 177 class Class extends A { |
183 method([a]) => null; // testPositionalParameters:14 | 178 method([a]) => null; // testPositionalParameters:14 |
184 } | 179 } |
185 """, warnings: MessageKind.INVALID_OVERRIDE_METHOD, | 180 """, |
186 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), | 181 warnings: MessageKind.INVALID_OVERRIDE_METHOD, |
187 | 182 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), |
188 check(""" | 183 check( |
| 184 """ |
189 class A { | 185 class A { |
190 method(a, b, [c, d, e]) => null; // testPositionalParameters:15 | 186 method(a, b, [c, d, e]) => null; // testPositionalParameters:15 |
191 } | 187 } |
192 class Class extends A { | 188 class Class extends A { |
193 method([a, b, c, d]) => null; // testPositionalParameters:16 | 189 method([a, b, c, d]) => null; // testPositionalParameters:16 |
194 } | 190 } |
195 """, warnings: MessageKind.INVALID_OVERRIDE_METHOD, | 191 """, |
196 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), | 192 warnings: MessageKind.INVALID_OVERRIDE_METHOD, |
| 193 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), |
197 ]); | 194 ]); |
198 } | 195 } |
199 | 196 |
200 Future testNamedParameters() { | 197 Future testNamedParameters() { |
201 return Future.wait([ | 198 return Future.wait([ |
202 check(""" | 199 check(""" |
203 class A { | 200 class A { |
204 method({a}) => null; // testNamedParameters:1 | 201 method({a}) => null; // testNamedParameters:1 |
205 } | 202 } |
206 class Class extends A { | 203 class Class extends A { |
207 method({a}) => null; // testNamedParameters:2 | 204 method({a}) => null; // testNamedParameters:2 |
208 } | 205 } |
209 """), | 206 """), |
210 | |
211 check(""" | 207 check(""" |
212 class A { | 208 class A { |
213 method({a, b}) => null; // testNamedParameters:3 | 209 method({a, b}) => null; // testNamedParameters:3 |
214 } | 210 } |
215 class Class extends A { | 211 class Class extends A { |
216 method({b, a}) => null; // testNamedParameters:4 | 212 method({b, a}) => null; // testNamedParameters:4 |
217 } | 213 } |
218 """), | 214 """), |
219 | |
220 check(""" | 215 check(""" |
221 class A { | 216 class A { |
222 method({a, b, c}) => null; // testNamedParameters:5 | 217 method({a, b, c}) => null; // testNamedParameters:5 |
223 } | 218 } |
224 class Class extends A { | 219 class Class extends A { |
225 method({b, c, a, d}) => null; // testNamedParameters:6 | 220 method({b, c, a, d}) => null; // testNamedParameters:6 |
226 } | 221 } |
227 """), | 222 """), |
228 | |
229 check(""" | 223 check(""" |
230 class A { | 224 class A { |
231 method(d, {a, b, c}) => null; // testNamedParameters:7 | 225 method(d, {a, b, c}) => null; // testNamedParameters:7 |
232 } | 226 } |
233 class Class extends A { | 227 class Class extends A { |
234 method(e, {b, c, a, d}) => null; // testNamedParameters:8 | 228 method(e, {b, c, a, d}) => null; // testNamedParameters:8 |
235 } | 229 } |
236 """), | 230 """), |
237 | 231 check( |
238 check(""" | 232 """ |
239 class A { | 233 class A { |
240 method({a}) => null; // testNamedParameters:9 | 234 method({a}) => null; // testNamedParameters:9 |
241 } | 235 } |
242 class Class extends A { | 236 class Class extends A { |
243 method() => null; // testNamedParameters:10 | 237 method() => null; // testNamedParameters:10 |
244 } | 238 } |
245 """, warnings: MessageKind.INVALID_OVERRIDE_METHOD, | 239 """, |
246 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), | 240 warnings: MessageKind.INVALID_OVERRIDE_METHOD, |
247 | 241 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), |
248 check(""" | 242 check( |
| 243 """ |
249 class A { | 244 class A { |
250 method({a, b}) => null; // testNamedParameters:11 | 245 method({a, b}) => null; // testNamedParameters:11 |
251 } | 246 } |
252 class Class extends A { | 247 class Class extends A { |
253 method({b}) => null; // testNamedParameters:12 | 248 method({b}) => null; // testNamedParameters:12 |
254 } | 249 } |
255 """, warnings: MessageKind.INVALID_OVERRIDE_METHOD, | 250 """, |
256 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), | 251 warnings: MessageKind.INVALID_OVERRIDE_METHOD, |
257 | 252 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), |
258 check(""" | 253 check( |
| 254 """ |
259 class A { | 255 class A { |
260 method({a, b, c, d}) => null; // testNamedParameters:13 | 256 method({a, b, c, d}) => null; // testNamedParameters:13 |
261 } | 257 } |
262 class Class extends A { | 258 class Class extends A { |
263 method({a, e, d, c}) => null; // testNamedParameters:14 | 259 method({a, e, d, c}) => null; // testNamedParameters:14 |
264 } | 260 } |
265 """, warnings: MessageKind.INVALID_OVERRIDE_METHOD, | 261 """, |
266 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), | 262 warnings: MessageKind.INVALID_OVERRIDE_METHOD, |
| 263 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), |
267 ]); | 264 ]); |
268 } | 265 } |
269 | 266 |
270 Future testNotSubtype() { | 267 Future testNotSubtype() { |
271 return Future.wait([ | 268 return Future.wait([ |
272 check(""" | 269 check(""" |
273 class A { | 270 class A { |
274 method(int a) => null; // testNotSubtype:1 | 271 method(int a) => null; // testNotSubtype:1 |
275 } | 272 } |
276 class Class extends A { | 273 class Class extends A { |
(...skipping 30 matching lines...) Expand all Loading... |
307 | 304 |
308 check(""" | 305 check(""" |
309 class A { | 306 class A { |
310 void method() {} // testNotSubtype:9 | 307 void method() {} // testNotSubtype:9 |
311 } | 308 } |
312 class Class extends A { | 309 class Class extends A { |
313 int method() => null; // testNotSubtype:10 | 310 int method() => null; // testNotSubtype:10 |
314 } | 311 } |
315 """), | 312 """), |
316 | 313 |
317 check(""" | 314 check( |
| 315 """ |
318 class A { | 316 class A { |
319 int method() => null; // testNotSubtype:11 | 317 int method() => null; // testNotSubtype:11 |
320 } | 318 } |
321 class Class extends A { | 319 class Class extends A { |
322 void method() {} // testNotSubtype:12 | 320 void method() {} // testNotSubtype:12 |
323 } | 321 } |
324 """, warnings: MessageKind.INVALID_OVERRIDE_METHOD, | 322 """, |
325 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), | 323 warnings: MessageKind.INVALID_OVERRIDE_METHOD, |
| 324 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), |
326 | 325 |
327 check(""" | 326 check(""" |
328 class A { | 327 class A { |
329 method(int a) => null; // testNotSubtype:13 | 328 method(int a) => null; // testNotSubtype:13 |
330 } | 329 } |
331 class B extends A { | 330 class B extends A { |
332 method(num a) => null; // testNotSubtype:14 | 331 method(num a) => null; // testNotSubtype:14 |
333 } | 332 } |
334 class Class extends B { | 333 class Class extends B { |
335 method(double a) => null; // testNotSubtype:15 | 334 method(double a) => null; // testNotSubtype:15 |
336 } | 335 } |
337 """), | 336 """), |
338 | 337 |
339 check(""" | 338 check(""" |
340 class A { | 339 class A { |
341 method(int a) => null; // testNotSubtype:16 | 340 method(int a) => null; // testNotSubtype:16 |
342 } | 341 } |
343 class B extends A { | 342 class B extends A { |
344 method(a) => null; // testNotSubtype:17 | 343 method(a) => null; // testNotSubtype:17 |
345 } | 344 } |
346 class Class extends B { | 345 class Class extends B { |
347 method(String a) => null; // testNotSubtype:18 | 346 method(String a) => null; // testNotSubtype:18 |
348 } | 347 } |
349 """), | 348 """), |
350 | 349 |
351 check(""" | 350 check( |
| 351 """ |
352 class A { | 352 class A { |
353 method(int a) => null; // testNotSubtype:19 | 353 method(int a) => null; // testNotSubtype:19 |
354 } | 354 } |
355 class Class extends A { | 355 class Class extends A { |
356 method(String a) => null; // testNotSubtype:20 | 356 method(String a) => null; // testNotSubtype:20 |
357 } | 357 } |
358 """, warnings: MessageKind.INVALID_OVERRIDE_METHOD, | 358 """, |
359 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), | 359 warnings: MessageKind.INVALID_OVERRIDE_METHOD, |
| 360 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), |
360 | 361 |
361 // TODO(johnniwinther): These are unclear. Issue 16443 has been filed. | 362 // TODO(johnniwinther): These are unclear. Issue 16443 has been filed. |
362 check(""" | 363 check( |
| 364 """ |
363 class A { | 365 class A { |
364 method(int a) => null; // testNotSubtype:23 | 366 method(int a) => null; // testNotSubtype:23 |
365 } | 367 } |
366 class B { | 368 class B { |
367 method(num a) => null; // testNotSubtype:24 | 369 method(num a) => null; // testNotSubtype:24 |
368 } | 370 } |
369 abstract class C implements A, B { | 371 abstract class C implements A, B { |
370 } | 372 } |
371 class Class implements C { | 373 class Class implements C { |
372 method(double a) => null; // testNotSubtype:25 | 374 method(double a) => null; // testNotSubtype:25 |
373 } | 375 } |
374 """, warnings: MessageKind.INVALID_OVERRIDE_METHOD, | 376 """, |
375 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), | 377 warnings: MessageKind.INVALID_OVERRIDE_METHOD, |
| 378 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), |
376 | 379 |
377 check(""" | 380 check( |
| 381 """ |
378 class A { | 382 class A { |
379 method(num a) => null; // testNotSubtype:29 | 383 method(num a) => null; // testNotSubtype:29 |
380 } | 384 } |
381 class B { | 385 class B { |
382 method(int a) => null; // testNotSubtype:30 | 386 method(int a) => null; // testNotSubtype:30 |
383 } | 387 } |
384 abstract class C implements A, B { | 388 abstract class C implements A, B { |
385 } | 389 } |
386 class Class implements C { | 390 class Class implements C { |
387 method(double a) => null; // testNotSubtype:31 | 391 method(double a) => null; // testNotSubtype:31 |
388 } | 392 } |
389 """, warnings: MessageKind.INVALID_OVERRIDE_METHOD, | 393 """, |
390 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), | 394 warnings: MessageKind.INVALID_OVERRIDE_METHOD, |
| 395 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), |
391 | 396 |
392 check(""" | 397 check( |
| 398 """ |
393 class A { | 399 class A { |
394 method(int a) => null; // testNotSubtype:26 | 400 method(int a) => null; // testNotSubtype:26 |
395 } | 401 } |
396 class B { | 402 class B { |
397 method(num a) => null; // testNotSubtype:27 | 403 method(num a) => null; // testNotSubtype:27 |
398 } | 404 } |
399 abstract class C implements A, B { | 405 abstract class C implements A, B { |
400 } | 406 } |
401 class Class implements C { | 407 class Class implements C { |
402 method(String a) => null; // testNotSubtype:28 | 408 method(String a) => null; // testNotSubtype:28 |
403 } | 409 } |
404 """, warnings: [MessageKind.INVALID_OVERRIDE_METHOD, | 410 """, |
405 MessageKind.INVALID_OVERRIDE_METHOD], | 411 warnings: [ |
406 infos: [MessageKind.INVALID_OVERRIDDEN_METHOD, | 412 MessageKind.INVALID_OVERRIDE_METHOD, |
407 MessageKind.INVALID_OVERRIDDEN_METHOD]), | 413 MessageKind.INVALID_OVERRIDE_METHOD |
| 414 ], |
| 415 infos: [ |
| 416 MessageKind.INVALID_OVERRIDDEN_METHOD, |
| 417 MessageKind.INVALID_OVERRIDDEN_METHOD |
| 418 ]), |
408 ]); | 419 ]); |
409 } | 420 } |
410 | 421 |
411 Future testGetterNotSubtype() { | 422 Future testGetterNotSubtype() { |
412 return Future.wait([ | 423 return Future.wait([ |
413 check(""" | 424 check(""" |
414 class A { | 425 class A { |
415 get getter => null; // testGetterNotSubtype:1 | 426 get getter => null; // testGetterNotSubtype:1 |
416 } | 427 } |
417 class Class extends A { | 428 class Class extends A { |
(...skipping 21 matching lines...) Expand all Loading... |
439 | 450 |
440 check(""" | 451 check(""" |
441 class A { | 452 class A { |
442 int get getter => null; // testGetterNotSubtype:7 | 453 int get getter => null; // testGetterNotSubtype:7 |
443 } | 454 } |
444 class Class extends A { | 455 class Class extends A { |
445 num get getter => null; // testGetterNotSubtype:8 | 456 num get getter => null; // testGetterNotSubtype:8 |
446 } | 457 } |
447 """), | 458 """), |
448 | 459 |
449 check(""" | 460 check( |
| 461 """ |
450 class A { | 462 class A { |
451 int get getter => null; // testGetterNotSubtype:9 | 463 int get getter => null; // testGetterNotSubtype:9 |
452 } | 464 } |
453 class Class extends A { | 465 class Class extends A { |
454 double get getter => null; // testGetterNotSubtype:10 | 466 double get getter => null; // testGetterNotSubtype:10 |
455 } | 467 } |
456 """, warnings: MessageKind.INVALID_OVERRIDE_GETTER, | 468 """, |
457 infos: MessageKind.INVALID_OVERRIDDEN_GETTER), | 469 warnings: MessageKind.INVALID_OVERRIDE_GETTER, |
| 470 infos: MessageKind.INVALID_OVERRIDDEN_GETTER), |
458 | 471 |
459 check(""" | 472 check(""" |
460 class A { | 473 class A { |
461 int get getter => null; // testGetterNotSubtype:11 | 474 int get getter => null; // testGetterNotSubtype:11 |
462 } | 475 } |
463 class B extends A { | 476 class B extends A { |
464 num get getter => null; // testGetterNotSubtype:12 | 477 num get getter => null; // testGetterNotSubtype:12 |
465 } | 478 } |
466 class Class extends B { | 479 class Class extends B { |
467 double get getter => null; // testGetterNotSubtype:13 | 480 double get getter => null; // testGetterNotSubtype:13 |
468 } | 481 } |
469 """), | 482 """), |
470 | 483 |
471 check(""" | 484 check( |
| 485 """ |
472 class A { | 486 class A { |
473 int get getter => null; // testGetterNotSubtype:14 | 487 int get getter => null; // testGetterNotSubtype:14 |
474 } | 488 } |
475 class B { | 489 class B { |
476 num get getter => null; // testGetterNotSubtype:15 | 490 num get getter => null; // testGetterNotSubtype:15 |
477 } | 491 } |
478 class Class extends A implements B { | 492 class Class extends A implements B { |
479 double get getter => null; // testGetterNotSubtype:16 | 493 double get getter => null; // testGetterNotSubtype:16 |
480 } | 494 } |
481 """, warnings: MessageKind.INVALID_OVERRIDE_GETTER, | 495 """, |
482 infos: MessageKind.INVALID_OVERRIDDEN_GETTER), | 496 warnings: MessageKind.INVALID_OVERRIDE_GETTER, |
| 497 infos: MessageKind.INVALID_OVERRIDDEN_GETTER), |
483 | 498 |
484 check(""" | 499 check( |
| 500 """ |
485 class A { | 501 class A { |
486 int get getter => null; // testGetterNotSubtype:17 | 502 int get getter => null; // testGetterNotSubtype:17 |
487 } | 503 } |
488 class B { | 504 class B { |
489 String get getter => null; // testGetterNotSubtype:18 | 505 String get getter => null; // testGetterNotSubtype:18 |
490 } | 506 } |
491 class Class extends A implements B { | 507 class Class extends A implements B { |
492 double get getter => null; // testGetterNotSubtype:19 | 508 double get getter => null; // testGetterNotSubtype:19 |
493 } | 509 } |
494 """, warnings: [MessageKind.INVALID_OVERRIDE_GETTER, | 510 """, |
495 MessageKind.INVALID_OVERRIDE_GETTER], | 511 warnings: [ |
496 infos: [MessageKind.INVALID_OVERRIDDEN_GETTER, | 512 MessageKind.INVALID_OVERRIDE_GETTER, |
497 MessageKind.INVALID_OVERRIDDEN_GETTER]), | 513 MessageKind.INVALID_OVERRIDE_GETTER |
| 514 ], |
| 515 infos: [ |
| 516 MessageKind.INVALID_OVERRIDDEN_GETTER, |
| 517 MessageKind.INVALID_OVERRIDDEN_GETTER |
| 518 ]), |
498 | 519 |
499 check(""" | 520 check( |
| 521 """ |
500 class A { | 522 class A { |
501 int get getter => null; // testGetterNotSubtype:20 | 523 int get getter => null; // testGetterNotSubtype:20 |
502 } | 524 } |
503 class B { | 525 class B { |
504 String get getter => null; // testGetterNotSubtype:21 | 526 String get getter => null; // testGetterNotSubtype:21 |
505 } | 527 } |
506 class Class implements A, B { | 528 class Class implements A, B { |
507 double get getter => null; // testGetterNotSubtype:22 | 529 double get getter => null; // testGetterNotSubtype:22 |
508 } | 530 } |
509 """, warnings: [MessageKind.INVALID_OVERRIDE_GETTER, | 531 """, |
510 MessageKind.INVALID_OVERRIDE_GETTER], | 532 warnings: [ |
511 infos: [MessageKind.INVALID_OVERRIDDEN_GETTER, | 533 MessageKind.INVALID_OVERRIDE_GETTER, |
512 MessageKind.INVALID_OVERRIDDEN_GETTER]), | 534 MessageKind.INVALID_OVERRIDE_GETTER |
| 535 ], |
| 536 infos: [ |
| 537 MessageKind.INVALID_OVERRIDDEN_GETTER, |
| 538 MessageKind.INVALID_OVERRIDDEN_GETTER |
| 539 ]), |
513 | 540 |
514 // TODO(johnniwinther): These are unclear. Issue 16443 has been filed. | 541 // TODO(johnniwinther): These are unclear. Issue 16443 has been filed. |
515 check(""" | 542 check( |
| 543 """ |
516 class A { | 544 class A { |
517 int get getter => null; // testGetterNotSubtype:23 | 545 int get getter => null; // testGetterNotSubtype:23 |
518 } | 546 } |
519 class B { | 547 class B { |
520 num get getter => null; // testGetterNotSubtype:24 | 548 num get getter => null; // testGetterNotSubtype:24 |
521 } | 549 } |
522 abstract class C implements A, B { | 550 abstract class C implements A, B { |
523 } | 551 } |
524 class Class implements C { | 552 class Class implements C { |
525 double get getter => null; // testGetterNotSubtype:25 | 553 double get getter => null; // testGetterNotSubtype:25 |
526 } | 554 } |
527 """, warnings: MessageKind.INVALID_OVERRIDE_GETTER, | 555 """, |
528 infos: MessageKind.INVALID_OVERRIDDEN_GETTER), | 556 warnings: MessageKind.INVALID_OVERRIDE_GETTER, |
| 557 infos: MessageKind.INVALID_OVERRIDDEN_GETTER), |
529 | 558 |
530 check(""" | 559 check( |
| 560 """ |
531 class A { | 561 class A { |
532 int get getter => null; // testGetterNotSubtype:26 | 562 int get getter => null; // testGetterNotSubtype:26 |
533 } | 563 } |
534 class B { | 564 class B { |
535 num get getter => null; // testGetterNotSubtype:27 | 565 num get getter => null; // testGetterNotSubtype:27 |
536 } | 566 } |
537 abstract class C implements A, B { | 567 abstract class C implements A, B { |
538 } | 568 } |
539 class Class implements C { | 569 class Class implements C { |
540 String get getter => null; // testGetterNotSubtype:28 | 570 String get getter => null; // testGetterNotSubtype:28 |
541 } | 571 } |
542 """, warnings: [MessageKind.INVALID_OVERRIDE_GETTER, | 572 """, |
543 MessageKind.INVALID_OVERRIDE_GETTER], | 573 warnings: [ |
544 infos: [MessageKind.INVALID_OVERRIDDEN_GETTER, | 574 MessageKind.INVALID_OVERRIDE_GETTER, |
545 MessageKind.INVALID_OVERRIDDEN_GETTER]), | 575 MessageKind.INVALID_OVERRIDE_GETTER |
| 576 ], |
| 577 infos: [ |
| 578 MessageKind.INVALID_OVERRIDDEN_GETTER, |
| 579 MessageKind.INVALID_OVERRIDDEN_GETTER |
| 580 ]), |
546 ]); | 581 ]); |
547 } | 582 } |
548 | 583 |
549 Future testGenericNotSubtype() { | 584 Future testGenericNotSubtype() { |
550 return Future.wait([ | 585 return Future.wait([ |
551 check(""" | 586 check(""" |
552 class A<T> { | 587 class A<T> { |
553 method(T t) => null; // testGenericNotSubtype:1 | 588 method(T t) => null; // testGenericNotSubtype:1 |
554 } | 589 } |
555 class Class<S> extends A<S> { | 590 class Class<S> extends A<S> { |
(...skipping 15 matching lines...) Expand all Loading... |
571 method(T t) => null; // testGenericNotSubtype:5 | 606 method(T t) => null; // testGenericNotSubtype:5 |
572 } | 607 } |
573 class B<S> { | 608 class B<S> { |
574 method(S s) => null; // testGenericNotSubtype:6 | 609 method(S s) => null; // testGenericNotSubtype:6 |
575 } | 610 } |
576 class Class extends A<double> implements B<int> { | 611 class Class extends A<double> implements B<int> { |
577 method(num i) => null; // testGenericNotSubtype:7 | 612 method(num i) => null; // testGenericNotSubtype:7 |
578 } | 613 } |
579 """), | 614 """), |
580 | 615 |
581 check(""" | 616 check( |
| 617 """ |
582 class A<T> { | 618 class A<T> { |
583 method(T t) => null; // testGenericNotSubtype:8 | 619 method(T t) => null; // testGenericNotSubtype:8 |
584 } | 620 } |
585 class Class<S> extends A<S> { | 621 class Class<S> extends A<S> { |
586 method(int i) => null; // testGenericNotSubtype:9 | 622 method(int i) => null; // testGenericNotSubtype:9 |
587 } | 623 } |
588 """, warnings: MessageKind.INVALID_OVERRIDE_METHOD, | 624 """, |
589 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), | 625 warnings: MessageKind.INVALID_OVERRIDE_METHOD, |
| 626 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), |
590 | 627 |
591 check(""" | 628 check(""" |
592 class A<T> { | 629 class A<T> { |
593 method(T t) => null; // testGenericNotSubtype:10 | 630 method(T t) => null; // testGenericNotSubtype:10 |
594 } | 631 } |
595 class B<S> extends A<S> { | 632 class B<S> extends A<S> { |
596 | 633 |
597 } | 634 } |
598 class Class<U> extends B<U> { | 635 class Class<U> extends B<U> { |
599 method(U u) => null; // testGenericNotSubtype:11 | 636 method(U u) => null; // testGenericNotSubtype:11 |
600 } | 637 } |
601 """), | 638 """), |
602 | 639 |
603 check(""" | 640 check( |
| 641 """ |
604 class A<T> { | 642 class A<T> { |
605 method(T t) => null; // testGenericNotSubtype:12 | 643 method(T t) => null; // testGenericNotSubtype:12 |
606 } | 644 } |
607 class B<S> { | 645 class B<S> { |
608 method(S s) => null; // testGenericNotSubtype:13 | 646 method(S s) => null; // testGenericNotSubtype:13 |
609 } | 647 } |
610 class Class<U> extends A<U> implements B<num> { | 648 class Class<U> extends A<U> implements B<num> { |
611 method(int i) => null; // testGenericNotSubtype:14 | 649 method(int i) => null; // testGenericNotSubtype:14 |
612 } | 650 } |
613 """, warnings: MessageKind.INVALID_OVERRIDE_METHOD, | 651 """, |
614 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), | 652 warnings: MessageKind.INVALID_OVERRIDE_METHOD, |
| 653 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), |
615 | 654 |
616 check(""" | 655 check( |
| 656 """ |
617 class A<T> { | 657 class A<T> { |
618 method(T t) => null; // testGenericNotSubtype:15 | 658 method(T t) => null; // testGenericNotSubtype:15 |
619 } | 659 } |
620 class B<S> { | 660 class B<S> { |
621 method(S s) => null; // testGenericNotSubtype:16 | 661 method(S s) => null; // testGenericNotSubtype:16 |
622 } | 662 } |
623 class Class extends A<int> implements B<String> { | 663 class Class extends A<int> implements B<String> { |
624 method(double d) => null; // testGenericNotSubtype:17 | 664 method(double d) => null; // testGenericNotSubtype:17 |
625 } | 665 } |
626 """, warnings: [MessageKind.INVALID_OVERRIDE_METHOD, | 666 """, |
627 MessageKind.INVALID_OVERRIDE_METHOD], | 667 warnings: [ |
628 infos: [MessageKind.INVALID_OVERRIDDEN_METHOD, | 668 MessageKind.INVALID_OVERRIDE_METHOD, |
629 MessageKind.INVALID_OVERRIDDEN_METHOD]), | 669 MessageKind.INVALID_OVERRIDE_METHOD |
| 670 ], |
| 671 infos: [ |
| 672 MessageKind.INVALID_OVERRIDDEN_METHOD, |
| 673 MessageKind.INVALID_OVERRIDDEN_METHOD |
| 674 ]), |
630 | 675 |
631 check(""" | 676 check( |
| 677 """ |
632 class A<T> { | 678 class A<T> { |
633 method(T t) => null; // testGenericNotSubtype:18 | 679 method(T t) => null; // testGenericNotSubtype:18 |
634 } | 680 } |
635 class B<S> { | 681 class B<S> { |
636 method(S s) => null; // testGenericNotSubtype:19 | 682 method(S s) => null; // testGenericNotSubtype:19 |
637 } | 683 } |
638 class Class implements A<int>, B<String> { | 684 class Class implements A<int>, B<String> { |
639 method(double d) => null; // testGenericNotSubtype:20 | 685 method(double d) => null; // testGenericNotSubtype:20 |
640 } | 686 } |
641 """, warnings: [MessageKind.INVALID_OVERRIDE_METHOD, | 687 """, |
642 MessageKind.INVALID_OVERRIDE_METHOD], | 688 warnings: [ |
643 infos: [MessageKind.INVALID_OVERRIDDEN_METHOD, | 689 MessageKind.INVALID_OVERRIDE_METHOD, |
644 MessageKind.INVALID_OVERRIDDEN_METHOD]), | 690 MessageKind.INVALID_OVERRIDE_METHOD |
| 691 ], |
| 692 infos: [ |
| 693 MessageKind.INVALID_OVERRIDDEN_METHOD, |
| 694 MessageKind.INVALID_OVERRIDDEN_METHOD |
| 695 ]), |
645 | 696 |
646 // TODO(johnniwinther): These are unclear. Issue 16443 has been filed. | 697 // TODO(johnniwinther): These are unclear. Issue 16443 has been filed. |
647 check(""" | 698 check( |
| 699 """ |
648 class A<T> { | 700 class A<T> { |
649 method(T t) => null; // testGenericNotSubtype:21 | 701 method(T t) => null; // testGenericNotSubtype:21 |
650 } | 702 } |
651 class B<S> { | 703 class B<S> { |
652 method(S s) => null; // testGenericNotSubtype:22 | 704 method(S s) => null; // testGenericNotSubtype:22 |
653 } | 705 } |
654 abstract class C implements A<int>, B<num> { | 706 abstract class C implements A<int>, B<num> { |
655 } | 707 } |
656 class Class implements C { | 708 class Class implements C { |
657 method(double d) => null; // testGenericNotSubtype:23 | 709 method(double d) => null; // testGenericNotSubtype:23 |
658 } | 710 } |
659 """, warnings: MessageKind.INVALID_OVERRIDE_METHOD, | 711 """, |
660 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), | 712 warnings: MessageKind.INVALID_OVERRIDE_METHOD, |
| 713 infos: MessageKind.INVALID_OVERRIDDEN_METHOD), |
661 | 714 |
662 check(""" | 715 check( |
| 716 """ |
663 class A<T> { | 717 class A<T> { |
664 method(T t) => null; // testGenericNotSubtype:24 | 718 method(T t) => null; // testGenericNotSubtype:24 |
665 } | 719 } |
666 class B<S> { | 720 class B<S> { |
667 method(S s) => null; // testGenericNotSubtype:25 | 721 method(S s) => null; // testGenericNotSubtype:25 |
668 } | 722 } |
669 abstract class C implements A<int>, B<num> { | 723 abstract class C implements A<int>, B<num> { |
670 } | 724 } |
671 class Class implements C { | 725 class Class implements C { |
672 method(String s) => null; // testGenericNotSubtype:26 | 726 method(String s) => null; // testGenericNotSubtype:26 |
673 } | 727 } |
674 """, warnings: [MessageKind.INVALID_OVERRIDE_METHOD, | 728 """, |
675 MessageKind.INVALID_OVERRIDE_METHOD], | 729 warnings: [ |
676 infos: [MessageKind.INVALID_OVERRIDDEN_METHOD, | 730 MessageKind.INVALID_OVERRIDE_METHOD, |
677 MessageKind.INVALID_OVERRIDDEN_METHOD]), | 731 MessageKind.INVALID_OVERRIDE_METHOD |
| 732 ], |
| 733 infos: [ |
| 734 MessageKind.INVALID_OVERRIDDEN_METHOD, |
| 735 MessageKind.INVALID_OVERRIDDEN_METHOD |
| 736 ]), |
678 ]); | 737 ]); |
679 } | 738 } |
680 | 739 |
681 Future testSetterNotSubtype() { | 740 Future testSetterNotSubtype() { |
682 return Future.wait([ | 741 return Future.wait([ |
683 check(""" | 742 check(""" |
684 class A { | 743 class A { |
685 set setter(_) => null; // testSetterNotSubtype:1 | 744 set setter(_) => null; // testSetterNotSubtype:1 |
686 } | 745 } |
687 class Class extends A { | 746 class Class extends A { |
688 set setter(_) => null; // testSetterNotSubtype:2 | 747 set setter(_) => null; // testSetterNotSubtype:2 |
689 } | 748 } |
690 """), | 749 """), |
691 | 750 |
692 check(""" | 751 check(""" |
693 class A { | 752 class A { |
694 void set setter(_) {} // testSetterNotSubtype:3 | 753 void set setter(_) {} // testSetterNotSubtype:3 |
695 } | 754 } |
696 class Class extends A { | 755 class Class extends A { |
697 set setter(_) => null; // testSetterNotSubtype:4 | 756 set setter(_) => null; // testSetterNotSubtype:4 |
698 } | 757 } |
699 """), | 758 """), |
700 | 759 |
701 check(""" | 760 check(""" |
702 class A { | 761 class A { |
703 set setter(_) => null; // testSetterNotSubtype:5 | 762 set setter(_) => null; // testSetterNotSubtype:5 |
704 } | 763 } |
705 class Class extends A { | 764 class Class extends A { |
706 void set setter(_) {} // testSetterNotSubtype:6 | 765 void set setter(_) {} // testSetterNotSubtype:6 |
707 } | 766 } |
708 """), | 767 """), |
709 | 768 |
710 check(""" | 769 check(""" |
711 class A { | 770 class A { |
712 set setter(_) => null; // testSetterNotSubtype:7 | 771 set setter(_) => null; // testSetterNotSubtype:7 |
713 } | 772 } |
714 class Class extends A { | 773 class Class extends A { |
715 void set setter(_) {} // testSetterNotSubtype:8 | 774 void set setter(_) {} // testSetterNotSubtype:8 |
716 } | 775 } |
717 """), | 776 """), |
718 | 777 |
719 check(""" | 778 check(""" |
720 class A { | 779 class A { |
721 set setter(num _) => null; // testSetterNotSubtype:9 | 780 set setter(num _) => null; // testSetterNotSubtype:9 |
722 } | 781 } |
723 class Class extends A { | 782 class Class extends A { |
724 set setter(num _) => null; // testSetterNotSubtype:10 | 783 set setter(num _) => null; // testSetterNotSubtype:10 |
725 } | 784 } |
726 """), | 785 """), |
727 | 786 |
728 check(""" | 787 check(""" |
729 class A { | 788 class A { |
730 set setter(num _) => null; // testSetterNotSubtype:11 | 789 set setter(num _) => null; // testSetterNotSubtype:11 |
731 } | 790 } |
732 class Class extends A { | 791 class Class extends A { |
733 set setter(int _) => null; // testSetterNotSubtype:12 | 792 set setter(int _) => null; // testSetterNotSubtype:12 |
734 } | 793 } |
735 """), | 794 """), |
736 | 795 |
737 check(""" | 796 check(""" |
738 class A { | 797 class A { |
739 set setter(int _) => null; // testSetterNotSubtype:13 | 798 set setter(int _) => null; // testSetterNotSubtype:13 |
740 } | 799 } |
741 class Class extends A { | 800 class Class extends A { |
742 set setter(num _) => null; // testSetterNotSubtype:14 | 801 set setter(num _) => null; // testSetterNotSubtype:14 |
743 } | 802 } |
744 """), | 803 """), |
745 | 804 |
746 check(""" | 805 check( |
| 806 """ |
747 class A { | 807 class A { |
748 set setter(int _) => null; // testSetterNotSubtype:15 | 808 set setter(int _) => null; // testSetterNotSubtype:15 |
749 } | 809 } |
750 class Class extends A { | 810 class Class extends A { |
751 set setter(double _) => null; // testSetterNotSubtype:16 | 811 set setter(double _) => null; // testSetterNotSubtype:16 |
752 } | 812 } |
753 """, warnings: MessageKind.INVALID_OVERRIDE_SETTER, | 813 """, |
754 infos: MessageKind.INVALID_OVERRIDDEN_SETTER), | 814 warnings: MessageKind.INVALID_OVERRIDE_SETTER, |
| 815 infos: MessageKind.INVALID_OVERRIDDEN_SETTER), |
755 | 816 |
756 check(""" | 817 check(""" |
757 class A { | 818 class A { |
758 set setter(int _) => null; // testSetterNotSubtype:17 | 819 set setter(int _) => null; // testSetterNotSubtype:17 |
759 } | 820 } |
760 class B extends A { | 821 class B extends A { |
761 set setter(num _) => null; // testSetterNotSubtype:18 | 822 set setter(num _) => null; // testSetterNotSubtype:18 |
762 } | 823 } |
763 class Class extends B { | 824 class Class extends B { |
764 set setter(double _) => null; // testSetterNotSubtype:19 | 825 set setter(double _) => null; // testSetterNotSubtype:19 |
765 } | 826 } |
766 """), | 827 """), |
767 | 828 |
768 check(""" | 829 check( |
| 830 """ |
769 class A { | 831 class A { |
770 set setter(int _) => null; // testSetterNotSubtype:20 | 832 set setter(int _) => null; // testSetterNotSubtype:20 |
771 } | 833 } |
772 class B { | 834 class B { |
773 set setter(num _) => null; // testSetterNotSubtype:21 | 835 set setter(num _) => null; // testSetterNotSubtype:21 |
774 } | 836 } |
775 class Class extends A implements B { | 837 class Class extends A implements B { |
776 set setter(double _) => null; // testSetterNotSubtype:22 | 838 set setter(double _) => null; // testSetterNotSubtype:22 |
777 } | 839 } |
778 """, warnings: MessageKind.INVALID_OVERRIDE_SETTER, | 840 """, |
779 infos: MessageKind.INVALID_OVERRIDDEN_SETTER), | 841 warnings: MessageKind.INVALID_OVERRIDE_SETTER, |
| 842 infos: MessageKind.INVALID_OVERRIDDEN_SETTER), |
780 | 843 |
781 check(""" | 844 check( |
| 845 """ |
782 class A { | 846 class A { |
783 set setter(int _) => null; // testSetterNotSubtype:23 | 847 set setter(int _) => null; // testSetterNotSubtype:23 |
784 } | 848 } |
785 class B { | 849 class B { |
786 set setter(String _) => null; // testSetterNotSubtype:24 | 850 set setter(String _) => null; // testSetterNotSubtype:24 |
787 } | 851 } |
788 class Class extends A implements B { | 852 class Class extends A implements B { |
789 set setter(double _) => null; // testSetterNotSubtype:25 | 853 set setter(double _) => null; // testSetterNotSubtype:25 |
790 } | 854 } |
791 """, warnings: [MessageKind.INVALID_OVERRIDE_SETTER, | 855 """, |
792 MessageKind.INVALID_OVERRIDE_SETTER], | 856 warnings: [ |
793 infos: [MessageKind.INVALID_OVERRIDDEN_SETTER, | 857 MessageKind.INVALID_OVERRIDE_SETTER, |
794 MessageKind.INVALID_OVERRIDDEN_SETTER]), | 858 MessageKind.INVALID_OVERRIDE_SETTER |
| 859 ], |
| 860 infos: [ |
| 861 MessageKind.INVALID_OVERRIDDEN_SETTER, |
| 862 MessageKind.INVALID_OVERRIDDEN_SETTER |
| 863 ]), |
795 | 864 |
796 check(""" | 865 check( |
| 866 """ |
797 class A { | 867 class A { |
798 set setter(int _) => null; // testSetterNotSubtype:26 | 868 set setter(int _) => null; // testSetterNotSubtype:26 |
799 } | 869 } |
800 class B { | 870 class B { |
801 set setter(String _) => null; // testSetterNotSubtype:27 | 871 set setter(String _) => null; // testSetterNotSubtype:27 |
802 } | 872 } |
803 class Class implements A, B { | 873 class Class implements A, B { |
804 set setter(double _) => null; // testSetterNotSubtype:28 | 874 set setter(double _) => null; // testSetterNotSubtype:28 |
805 } | 875 } |
806 """, warnings: [MessageKind.INVALID_OVERRIDE_SETTER, | 876 """, |
807 MessageKind.INVALID_OVERRIDE_SETTER], | 877 warnings: [ |
808 infos: [MessageKind.INVALID_OVERRIDDEN_SETTER, | 878 MessageKind.INVALID_OVERRIDE_SETTER, |
809 MessageKind.INVALID_OVERRIDDEN_SETTER]), | 879 MessageKind.INVALID_OVERRIDE_SETTER |
| 880 ], |
| 881 infos: [ |
| 882 MessageKind.INVALID_OVERRIDDEN_SETTER, |
| 883 MessageKind.INVALID_OVERRIDDEN_SETTER |
| 884 ]), |
810 | 885 |
811 // TODO(johnniwinther): These are unclear. Issue 16443 has been filed. | 886 // TODO(johnniwinther): These are unclear. Issue 16443 has been filed. |
812 check(""" | 887 check( |
| 888 """ |
813 class A { | 889 class A { |
814 set setter(int _) => null; // testSetterNotSubtype:29 | 890 set setter(int _) => null; // testSetterNotSubtype:29 |
815 } | 891 } |
816 class B { | 892 class B { |
817 set setter(num _) => null; // testSetterNotSubtype:30 | 893 set setter(num _) => null; // testSetterNotSubtype:30 |
818 } | 894 } |
819 abstract class C implements A, B { | 895 abstract class C implements A, B { |
820 } | 896 } |
821 class Class implements C { | 897 class Class implements C { |
822 set setter(double _) => null; // testSetterNotSubtype:31 | 898 set setter(double _) => null; // testSetterNotSubtype:31 |
823 } | 899 } |
824 """, warnings: MessageKind.INVALID_OVERRIDE_SETTER, | 900 """, |
825 infos: MessageKind.INVALID_OVERRIDDEN_SETTER), | 901 warnings: MessageKind.INVALID_OVERRIDE_SETTER, |
| 902 infos: MessageKind.INVALID_OVERRIDDEN_SETTER), |
826 | 903 |
827 check(""" | 904 check( |
| 905 """ |
828 class A { | 906 class A { |
829 set setter(int _) => null; // testSetterNotSubtype:32 | 907 set setter(int _) => null; // testSetterNotSubtype:32 |
830 } | 908 } |
831 class B { | 909 class B { |
832 set setter(num _) => null; // testSetterNotSubtype:33 | 910 set setter(num _) => null; // testSetterNotSubtype:33 |
833 } | 911 } |
834 abstract class C implements A, B { | 912 abstract class C implements A, B { |
835 } | 913 } |
836 class Class implements C { | 914 class Class implements C { |
837 set setter(String _) => null; // testSetterNotSubtype:34 | 915 set setter(String _) => null; // testSetterNotSubtype:34 |
838 } | 916 } |
839 """, warnings: [MessageKind.INVALID_OVERRIDE_SETTER, | 917 """, |
840 MessageKind.INVALID_OVERRIDE_SETTER], | 918 warnings: [ |
841 infos: [MessageKind.INVALID_OVERRIDDEN_SETTER, | 919 MessageKind.INVALID_OVERRIDE_SETTER, |
842 MessageKind.INVALID_OVERRIDDEN_SETTER]), | 920 MessageKind.INVALID_OVERRIDE_SETTER |
| 921 ], |
| 922 infos: [ |
| 923 MessageKind.INVALID_OVERRIDDEN_SETTER, |
| 924 MessageKind.INVALID_OVERRIDDEN_SETTER |
| 925 ]), |
843 ]); | 926 ]); |
844 } | 927 } |
845 | 928 |
846 Future testFieldNotSubtype() { | 929 Future testFieldNotSubtype() { |
847 return Future.wait([ | 930 return Future.wait([ |
848 check(""" | 931 check(""" |
849 class A { | 932 class A { |
850 int field; // testFieldNotSubtype:1 | 933 int field; // testFieldNotSubtype:1 |
851 } | 934 } |
852 class Class extends A { | 935 class Class extends A { |
853 int field; // testFieldNotSubtype:2 | 936 int field; // testFieldNotSubtype:2 |
854 } | 937 } |
855 """), | 938 """), |
856 | |
857 check(""" | 939 check(""" |
858 class A { | 940 class A { |
859 num field; // testFieldNotSubtype:3 | 941 num field; // testFieldNotSubtype:3 |
860 } | 942 } |
861 class Class extends A { | 943 class Class extends A { |
862 int field; // testFieldNotSubtype:4 | 944 int field; // testFieldNotSubtype:4 |
863 } | 945 } |
864 """), | 946 """), |
865 | |
866 check(""" | 947 check(""" |
867 class A { | 948 class A { |
868 int field; // testFieldNotSubtype:5 | 949 int field; // testFieldNotSubtype:5 |
869 } | 950 } |
870 class Class extends A { | 951 class Class extends A { |
871 num field; // testFieldNotSubtype:6 | 952 num field; // testFieldNotSubtype:6 |
872 } | 953 } |
873 """), | 954 """), |
874 | 955 check( |
875 check(""" | 956 """ |
876 class A { | 957 class A { |
877 int field; // testFieldNotSubtype:7 | 958 int field; // testFieldNotSubtype:7 |
878 } | 959 } |
879 class Class extends A { | 960 class Class extends A { |
880 double field; // testFieldNotSubtype:8 | 961 double field; // testFieldNotSubtype:8 |
881 } | 962 } |
882 """, warnings: MessageKind.INVALID_OVERRIDE_FIELD, | 963 """, |
883 infos: MessageKind.INVALID_OVERRIDDEN_FIELD), | 964 warnings: MessageKind.INVALID_OVERRIDE_FIELD, |
884 | 965 infos: MessageKind.INVALID_OVERRIDDEN_FIELD), |
885 check(""" | 966 check(""" |
886 class A { | 967 class A { |
887 int field; // testFieldNotSubtype:9 | 968 int field; // testFieldNotSubtype:9 |
888 } | 969 } |
889 class B extends A { | 970 class B extends A { |
890 num field; // testFieldNotSubtype:10 | 971 num field; // testFieldNotSubtype:10 |
891 } | 972 } |
892 class Class extends B { | 973 class Class extends B { |
893 double field; // testFieldNotSubtype:11 | 974 double field; // testFieldNotSubtype:11 |
894 } | 975 } |
895 """), | 976 """), |
896 | |
897 check(""" | 977 check(""" |
898 class A { | 978 class A { |
899 num field; // testFieldNotSubtype:12 | 979 num field; // testFieldNotSubtype:12 |
900 } | 980 } |
901 class Class extends A { | 981 class Class extends A { |
902 int get field => null; // testFieldNotSubtype:13 | 982 int get field => null; // testFieldNotSubtype:13 |
903 } | 983 } |
904 """), | 984 """), |
905 | 985 check( |
906 check(""" | 986 """ |
907 class A { | 987 class A { |
908 num field; // testFieldNotSubtype:14 | 988 num field; // testFieldNotSubtype:14 |
909 } | 989 } |
910 class Class extends A { | 990 class Class extends A { |
911 String get field => null; // testFieldNotSubtype:15 | 991 String get field => null; // testFieldNotSubtype:15 |
912 } | 992 } |
913 """, warnings: MessageKind.INVALID_OVERRIDE_FIELD_WITH_GETTER, | 993 """, |
914 infos: MessageKind.INVALID_OVERRIDDEN_FIELD), | 994 warnings: MessageKind.INVALID_OVERRIDE_FIELD_WITH_GETTER, |
915 | 995 infos: MessageKind.INVALID_OVERRIDDEN_FIELD), |
916 check(""" | 996 check( |
| 997 """ |
917 class A { | 998 class A { |
918 num get field => null; // testFieldNotSubtype:16 | 999 num get field => null; // testFieldNotSubtype:16 |
919 } | 1000 } |
920 class Class extends A { | 1001 class Class extends A { |
921 String field; // testFieldNotSubtype:17 | 1002 String field; // testFieldNotSubtype:17 |
922 } | 1003 } |
923 """, warnings: MessageKind.INVALID_OVERRIDE_GETTER_WITH_FIELD, | 1004 """, |
924 infos: MessageKind.INVALID_OVERRIDDEN_GETTER), | 1005 warnings: MessageKind.INVALID_OVERRIDE_GETTER_WITH_FIELD, |
925 | 1006 infos: MessageKind.INVALID_OVERRIDDEN_GETTER), |
926 check(""" | 1007 check(""" |
927 class A { | 1008 class A { |
928 num field; // testFieldNotSubtype:18 | 1009 num field; // testFieldNotSubtype:18 |
929 } | 1010 } |
930 class Class extends A { | 1011 class Class extends A { |
931 set field(int _) {} // testFieldNotSubtype:19 | 1012 set field(int _) {} // testFieldNotSubtype:19 |
932 } | 1013 } |
933 """), | 1014 """), |
934 | |
935 check(""" | 1015 check(""" |
936 class A { | 1016 class A { |
937 num field; // testFieldNotSubtype:19 | 1017 num field; // testFieldNotSubtype:19 |
938 } | 1018 } |
939 class Class extends A { | 1019 class Class extends A { |
940 void set field(int _) {} // testFieldNotSubtype:20 | 1020 void set field(int _) {} // testFieldNotSubtype:20 |
941 } | 1021 } |
942 """), | 1022 """), |
943 | |
944 check(""" | 1023 check(""" |
945 class A { | 1024 class A { |
946 set field(int _) {} // testFieldNotSubtype:21 | 1025 set field(int _) {} // testFieldNotSubtype:21 |
947 } | 1026 } |
948 class Class extends A { | 1027 class Class extends A { |
949 num field; // testFieldNotSubtype:22 | 1028 num field; // testFieldNotSubtype:22 |
950 } | 1029 } |
951 """), | 1030 """), |
952 | |
953 check(""" | 1031 check(""" |
954 class A { | 1032 class A { |
955 void set field(int _) {} // testFieldNotSubtype:23 | 1033 void set field(int _) {} // testFieldNotSubtype:23 |
956 } | 1034 } |
957 class Class extends A { | 1035 class Class extends A { |
958 num field; // testFieldNotSubtype:24 | 1036 num field; // testFieldNotSubtype:24 |
959 } | 1037 } |
960 """), | 1038 """), |
961 | 1039 check( |
962 check(""" | 1040 """ |
963 class A { | 1041 class A { |
964 num field; // testFieldNotSubtype:25 | 1042 num field; // testFieldNotSubtype:25 |
965 } | 1043 } |
966 class Class extends A { | 1044 class Class extends A { |
967 set field(String _) {} // testFieldNotSubtype:26 | 1045 set field(String _) {} // testFieldNotSubtype:26 |
968 } | 1046 } |
969 """, warnings: MessageKind.INVALID_OVERRIDE_FIELD_WITH_SETTER, | 1047 """, |
970 infos: MessageKind.INVALID_OVERRIDDEN_FIELD), | 1048 warnings: MessageKind.INVALID_OVERRIDE_FIELD_WITH_SETTER, |
971 | 1049 infos: MessageKind.INVALID_OVERRIDDEN_FIELD), |
972 check(""" | 1050 check( |
| 1051 """ |
973 class A { | 1052 class A { |
974 set field(num _) {} // testFieldNotSubtype:27 | 1053 set field(num _) {} // testFieldNotSubtype:27 |
975 } | 1054 } |
976 class Class extends A { | 1055 class Class extends A { |
977 String field; // testFieldNotSubtype:28 | 1056 String field; // testFieldNotSubtype:28 |
978 } | 1057 } |
979 """, warnings: MessageKind.INVALID_OVERRIDE_SETTER_WITH_FIELD, | 1058 """, |
980 infos: MessageKind.INVALID_OVERRIDDEN_SETTER), | 1059 warnings: MessageKind.INVALID_OVERRIDE_SETTER_WITH_FIELD, |
981 | 1060 infos: MessageKind.INVALID_OVERRIDDEN_SETTER), |
982 check(""" | 1061 check( |
| 1062 """ |
983 class A { | 1063 class A { |
984 int field; // testFieldNotSubtype:29 | 1064 int field; // testFieldNotSubtype:29 |
985 } | 1065 } |
986 class Class implements A { | 1066 class Class implements A { |
987 String get field => null; // testFieldNotSubtype:30 | 1067 String get field => null; // testFieldNotSubtype:30 |
988 void set field(String s) {} // testFieldNotSubtype:31 | 1068 void set field(String s) {} // testFieldNotSubtype:31 |
989 } | 1069 } |
990 """, warnings: [MessageKind.INVALID_OVERRIDE_FIELD_WITH_GETTER, | 1070 """, |
991 MessageKind.INVALID_OVERRIDE_FIELD_WITH_SETTER], | 1071 warnings: [ |
992 infos: [MessageKind.INVALID_OVERRIDDEN_FIELD, | 1072 MessageKind.INVALID_OVERRIDE_FIELD_WITH_GETTER, |
993 MessageKind.INVALID_OVERRIDDEN_FIELD]), | 1073 MessageKind.INVALID_OVERRIDE_FIELD_WITH_SETTER |
994 | 1074 ], |
995 | 1075 infos: [ |
996 check(""" | 1076 MessageKind.INVALID_OVERRIDDEN_FIELD, |
| 1077 MessageKind.INVALID_OVERRIDDEN_FIELD |
| 1078 ]), |
| 1079 check( |
| 1080 """ |
997 class A { | 1081 class A { |
998 String get field => null; // testFieldNotSubtype:32 | 1082 String get field => null; // testFieldNotSubtype:32 |
999 void set field(String s) {} // testFieldNotSubtype:33 | 1083 void set field(String s) {} // testFieldNotSubtype:33 |
1000 } | 1084 } |
1001 class Class implements A { | 1085 class Class implements A { |
1002 int field; // testFieldNotSubtype:34 | 1086 int field; // testFieldNotSubtype:34 |
1003 } | 1087 } |
1004 """, warnings: [MessageKind.INVALID_OVERRIDE_GETTER_WITH_FIELD, | 1088 """, |
1005 MessageKind.INVALID_OVERRIDE_SETTER_WITH_FIELD], | 1089 warnings: [ |
1006 infos: [MessageKind.INVALID_OVERRIDDEN_GETTER, | 1090 MessageKind.INVALID_OVERRIDE_GETTER_WITH_FIELD, |
1007 MessageKind.INVALID_OVERRIDDEN_SETTER]), | 1091 MessageKind.INVALID_OVERRIDE_SETTER_WITH_FIELD |
| 1092 ], |
| 1093 infos: [ |
| 1094 MessageKind.INVALID_OVERRIDDEN_GETTER, |
| 1095 MessageKind.INVALID_OVERRIDDEN_SETTER |
| 1096 ]), |
1008 ]); | 1097 ]); |
1009 } | 1098 } |
1010 | 1099 |
1011 Future testMixedOverride() { | 1100 Future testMixedOverride() { |
1012 return Future.wait([ | 1101 return Future.wait([ |
1013 check(""" | 1102 check( |
| 1103 """ |
1014 class A { | 1104 class A { |
1015 var member; // testMixedOverride:1 | 1105 var member; // testMixedOverride:1 |
1016 } | 1106 } |
1017 class Class extends A { | 1107 class Class extends A { |
1018 member() {} // testMixedOverride:2 | 1108 member() {} // testMixedOverride:2 |
1019 } | 1109 } |
1020 """, errors: MessageKind.CANNOT_OVERRIDE_FIELD_WITH_METHOD, | 1110 """, |
1021 infos: MessageKind.CANNOT_OVERRIDE_FIELD_WITH_METHOD_CONT), | 1111 errors: MessageKind.CANNOT_OVERRIDE_FIELD_WITH_METHOD, |
1022 | 1112 infos: MessageKind.CANNOT_OVERRIDE_FIELD_WITH_METHOD_CONT), |
1023 check(""" | 1113 check( |
| 1114 """ |
1024 class A { | 1115 class A { |
1025 member() {} // testMixedOverride:3 | 1116 member() {} // testMixedOverride:3 |
1026 } | 1117 } |
1027 class Class extends A { | 1118 class Class extends A { |
1028 var member; // testMixedOverride:4 | 1119 var member; // testMixedOverride:4 |
1029 } | 1120 } |
1030 """, errors: MessageKind.CANNOT_OVERRIDE_METHOD_WITH_FIELD, | 1121 """, |
1031 infos: MessageKind.CANNOT_OVERRIDE_METHOD_WITH_FIELD_CONT), | 1122 errors: MessageKind.CANNOT_OVERRIDE_METHOD_WITH_FIELD, |
1032 | 1123 infos: MessageKind.CANNOT_OVERRIDE_METHOD_WITH_FIELD_CONT), |
1033 check(""" | 1124 check( |
| 1125 """ |
1034 class A { | 1126 class A { |
1035 get member => null; // testMixedOverride:5 | 1127 get member => null; // testMixedOverride:5 |
1036 } | 1128 } |
1037 class Class extends A { | 1129 class Class extends A { |
1038 member() {} // testMixedOverride:6 | 1130 member() {} // testMixedOverride:6 |
1039 } | 1131 } |
1040 """, errors: MessageKind.CANNOT_OVERRIDE_GETTER_WITH_METHOD, | 1132 """, |
1041 infos: MessageKind.CANNOT_OVERRIDE_GETTER_WITH_METHOD_CONT), | 1133 errors: MessageKind.CANNOT_OVERRIDE_GETTER_WITH_METHOD, |
1042 | 1134 infos: MessageKind.CANNOT_OVERRIDE_GETTER_WITH_METHOD_CONT), |
1043 check(""" | 1135 check( |
| 1136 """ |
1044 class A { | 1137 class A { |
1045 member() {} // testMixedOverride:7 | 1138 member() {} // testMixedOverride:7 |
1046 } | 1139 } |
1047 class Class extends A { | 1140 class Class extends A { |
1048 get member => null; // testMixedOverride:8 | 1141 get member => null; // testMixedOverride:8 |
1049 } | 1142 } |
1050 """, errors: MessageKind.CANNOT_OVERRIDE_METHOD_WITH_GETTER, | 1143 """, |
1051 infos: MessageKind.CANNOT_OVERRIDE_METHOD_WITH_GETTER_CONT), | 1144 errors: MessageKind.CANNOT_OVERRIDE_METHOD_WITH_GETTER, |
1052 | 1145 infos: MessageKind.CANNOT_OVERRIDE_METHOD_WITH_GETTER_CONT), |
1053 check(""" | 1146 check(""" |
1054 abstract class A { | 1147 abstract class A { |
1055 var member; // testMixedOverride:9 | 1148 var member; // testMixedOverride:9 |
1056 } | 1149 } |
1057 abstract class B { | 1150 abstract class B { |
1058 get member; // testMixedOverride:10 | 1151 get member; // testMixedOverride:10 |
1059 } | 1152 } |
1060 abstract class Class implements A, B { | 1153 abstract class Class implements A, B { |
1061 } | 1154 } |
1062 """), | 1155 """), |
1063 | 1156 check( |
1064 check(""" | 1157 """ |
1065 abstract class A { | 1158 abstract class A { |
1066 var member; // testMixedOverride:11 | 1159 var member; // testMixedOverride:11 |
1067 } | 1160 } |
1068 abstract class B { | 1161 abstract class B { |
1069 member() {} // testMixedOverride:12 | 1162 member() {} // testMixedOverride:12 |
1070 } | 1163 } |
1071 abstract class Class implements A, B { | 1164 abstract class Class implements A, B { |
1072 } | 1165 } |
1073 """, warnings: MessageKind.INHERIT_GETTER_AND_METHOD, | 1166 """, |
1074 infos: [MessageKind.INHERITED_METHOD, | 1167 warnings: MessageKind.INHERIT_GETTER_AND_METHOD, |
1075 MessageKind.INHERITED_IMPLICIT_GETTER]), | 1168 infos: [ |
1076 | 1169 MessageKind.INHERITED_METHOD, |
1077 check(""" | 1170 MessageKind.INHERITED_IMPLICIT_GETTER |
| 1171 ]), |
| 1172 check( |
| 1173 """ |
1078 abstract class A { | 1174 abstract class A { |
1079 get member; // testMixedOverride:13 | 1175 get member; // testMixedOverride:13 |
1080 } | 1176 } |
1081 abstract class B { | 1177 abstract class B { |
1082 member() {} // testMixedOverride:14 | 1178 member() {} // testMixedOverride:14 |
1083 } | 1179 } |
1084 abstract class Class implements A, B { | 1180 abstract class Class implements A, B { |
1085 } | 1181 } |
1086 """, warnings: MessageKind.INHERIT_GETTER_AND_METHOD, | 1182 """, |
1087 infos: [MessageKind.INHERITED_METHOD, | 1183 warnings: MessageKind.INHERIT_GETTER_AND_METHOD, |
1088 MessageKind.INHERITED_EXPLICIT_GETTER]), | 1184 infos: [ |
1089 | 1185 MessageKind.INHERITED_METHOD, |
1090 check(""" | 1186 MessageKind.INHERITED_EXPLICIT_GETTER |
| 1187 ]), |
| 1188 check( |
| 1189 """ |
1091 abstract class A { | 1190 abstract class A { |
1092 get member; // testMixedOverride:15 | 1191 get member; // testMixedOverride:15 |
1093 } | 1192 } |
1094 abstract class B { | 1193 abstract class B { |
1095 member() {} // testMixedOverride:16 | 1194 member() {} // testMixedOverride:16 |
1096 } | 1195 } |
1097 abstract class C { | 1196 abstract class C { |
1098 var member; // testMixedOverride:17 | 1197 var member; // testMixedOverride:17 |
1099 } | 1198 } |
1100 abstract class D { | 1199 abstract class D { |
1101 member() {} // testMixedOverride:18 | 1200 member() {} // testMixedOverride:18 |
1102 } | 1201 } |
1103 abstract class E { | 1202 abstract class E { |
1104 get member; // testMixedOverride:19 | 1203 get member; // testMixedOverride:19 |
1105 } | 1204 } |
1106 abstract class Class implements A, B, C, D, E { | 1205 abstract class Class implements A, B, C, D, E { |
1107 } | 1206 } |
1108 """, warnings: MessageKind.INHERIT_GETTER_AND_METHOD, | 1207 """, |
1109 infos: [MessageKind.INHERITED_EXPLICIT_GETTER, | 1208 warnings: MessageKind.INHERIT_GETTER_AND_METHOD, |
1110 MessageKind.INHERITED_METHOD, | 1209 infos: [ |
1111 MessageKind.INHERITED_IMPLICIT_GETTER, | 1210 MessageKind.INHERITED_EXPLICIT_GETTER, |
1112 MessageKind.INHERITED_METHOD, | 1211 MessageKind.INHERITED_METHOD, |
1113 MessageKind.INHERITED_EXPLICIT_GETTER]), | 1212 MessageKind.INHERITED_IMPLICIT_GETTER, |
1114 | 1213 MessageKind.INHERITED_METHOD, |
1115 check(""" | 1214 MessageKind.INHERITED_EXPLICIT_GETTER |
| 1215 ]), |
| 1216 check( |
| 1217 """ |
1116 abstract class A { | 1218 abstract class A { |
1117 get member; // testMixedOverride:20 | 1219 get member; // testMixedOverride:20 |
1118 } | 1220 } |
1119 abstract class B { | 1221 abstract class B { |
1120 member() {} // testMixedOverride:21 | 1222 member() {} // testMixedOverride:21 |
1121 } | 1223 } |
1122 abstract class C implements A, B { | 1224 abstract class C implements A, B { |
1123 } | 1225 } |
1124 class Class extends C { | 1226 class Class extends C { |
1125 member() {} // testMixedOverride:22 | 1227 member() {} // testMixedOverride:22 |
1126 } | 1228 } |
1127 """, errors: MessageKind.CANNOT_OVERRIDE_GETTER_WITH_METHOD, | 1229 """, |
1128 warnings: MessageKind.INHERIT_GETTER_AND_METHOD, | 1230 errors: MessageKind.CANNOT_OVERRIDE_GETTER_WITH_METHOD, |
1129 infos: [MessageKind.INHERITED_METHOD, | 1231 warnings: MessageKind.INHERIT_GETTER_AND_METHOD, |
1130 MessageKind.INHERITED_EXPLICIT_GETTER, | 1232 infos: [ |
1131 MessageKind.CANNOT_OVERRIDE_GETTER_WITH_METHOD_CONT]), | 1233 MessageKind.INHERITED_METHOD, |
1132 | 1234 MessageKind.INHERITED_EXPLICIT_GETTER, |
1133 check(""" | 1235 MessageKind.CANNOT_OVERRIDE_GETTER_WITH_METHOD_CONT |
| 1236 ]), |
| 1237 check( |
| 1238 """ |
1134 abstract class A { | 1239 abstract class A { |
1135 get member; // testMixedOverride:23 | 1240 get member; // testMixedOverride:23 |
1136 } | 1241 } |
1137 abstract class B { | 1242 abstract class B { |
1138 member() {} // testMixedOverride:24 | 1243 member() {} // testMixedOverride:24 |
1139 } | 1244 } |
1140 abstract class C implements A, B { | 1245 abstract class C implements A, B { |
1141 } | 1246 } |
1142 class Class extends C { | 1247 class Class extends C { |
1143 get member => null; // testMixedOverride:25 | 1248 get member => null; // testMixedOverride:25 |
1144 } | 1249 } |
1145 """, errors: MessageKind.CANNOT_OVERRIDE_METHOD_WITH_GETTER, | 1250 """, |
1146 warnings: MessageKind.INHERIT_GETTER_AND_METHOD, | 1251 errors: MessageKind.CANNOT_OVERRIDE_METHOD_WITH_GETTER, |
1147 infos: [MessageKind.INHERITED_METHOD, | 1252 warnings: MessageKind.INHERIT_GETTER_AND_METHOD, |
1148 MessageKind.INHERITED_EXPLICIT_GETTER, | 1253 infos: [ |
1149 MessageKind.CANNOT_OVERRIDE_METHOD_WITH_GETTER_CONT]), | 1254 MessageKind.INHERITED_METHOD, |
| 1255 MessageKind.INHERITED_EXPLICIT_GETTER, |
| 1256 MessageKind.CANNOT_OVERRIDE_METHOD_WITH_GETTER_CONT |
| 1257 ]), |
1150 ]); | 1258 ]); |
1151 } | 1259 } |
1152 | 1260 |
1153 Future testAbstractMethods() { | 1261 Future testAbstractMethods() { |
1154 return Future.wait([ | 1262 return Future.wait([ |
1155 check(""" | 1263 check(""" |
1156 abstract class Class { | 1264 abstract class Class { |
1157 method(); // testAbstractMethod:1 | 1265 method(); // testAbstractMethod:1 |
1158 } | 1266 } |
1159 """), | 1267 """), |
1160 | 1268 check( |
1161 check(""" | 1269 """ |
1162 class Class { | 1270 class Class { |
1163 method(); // testAbstractMethod:2 | 1271 method(); // testAbstractMethod:2 |
1164 } | 1272 } |
1165 """, warnings: MessageKind.ABSTRACT_METHOD, | 1273 """, |
1166 infos: []), | 1274 warnings: MessageKind.ABSTRACT_METHOD, |
1167 | 1275 infos: []), |
1168 check(""" | 1276 check( |
| 1277 """ |
1169 class Class { | 1278 class Class { |
1170 get getter; // testAbstractMethod:3 | 1279 get getter; // testAbstractMethod:3 |
1171 } | 1280 } |
1172 """, warnings: MessageKind.ABSTRACT_GETTER, | 1281 """, |
1173 infos: []), | 1282 warnings: MessageKind.ABSTRACT_GETTER, |
1174 | 1283 infos: []), |
1175 check(""" | 1284 check( |
| 1285 """ |
1176 class Class { | 1286 class Class { |
1177 set setter(_); // testAbstractMethod:4 | 1287 set setter(_); // testAbstractMethod:4 |
1178 } | 1288 } |
1179 """, warnings: MessageKind.ABSTRACT_SETTER, | 1289 """, |
1180 infos: []), | 1290 warnings: MessageKind.ABSTRACT_SETTER, |
1181 | 1291 infos: []), |
1182 check(""" | 1292 check(""" |
1183 abstract class A { | 1293 abstract class A { |
1184 method(); // testAbstractMethod:5 | 1294 method(); // testAbstractMethod:5 |
1185 } | 1295 } |
1186 class Class extends A { | 1296 class Class extends A { |
1187 method() {} // testAbstractMethod:6 | 1297 method() {} // testAbstractMethod:6 |
1188 } | 1298 } |
1189 """), | 1299 """), |
1190 | |
1191 check(""" | 1300 check(""" |
1192 abstract class A { | 1301 abstract class A { |
1193 method(); // testAbstractMethod:7 | 1302 method(); // testAbstractMethod:7 |
1194 } | 1303 } |
1195 class Class extends A { | 1304 class Class extends A { |
1196 method([a]) {} // testAbstractMethod:8 | 1305 method([a]) {} // testAbstractMethod:8 |
1197 } | 1306 } |
1198 """), | 1307 """), |
1199 | 1308 check( |
1200 check(""" | 1309 """ |
1201 abstract class A { | 1310 abstract class A { |
1202 method(); // testAbstractMethod:9 | 1311 method(); // testAbstractMethod:9 |
1203 } | 1312 } |
1204 class Class extends A { | 1313 class Class extends A { |
1205 } | 1314 } |
1206 """, warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE, | 1315 """, |
1207 infos: MessageKind.UNIMPLEMENTED_METHOD_CONT), | 1316 warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE, |
1208 | 1317 infos: MessageKind.UNIMPLEMENTED_METHOD_CONT), |
1209 check(""" | 1318 check( |
| 1319 """ |
1210 abstract class A { | 1320 abstract class A { |
1211 get getter; // testAbstractMethod:10 | 1321 get getter; // testAbstractMethod:10 |
1212 } | 1322 } |
1213 class Class extends A { | 1323 class Class extends A { |
1214 } | 1324 } |
1215 """, warnings: MessageKind.UNIMPLEMENTED_GETTER_ONE, | 1325 """, |
1216 infos: MessageKind.UNIMPLEMENTED_EXPLICIT_GETTER), | 1326 warnings: MessageKind.UNIMPLEMENTED_GETTER_ONE, |
1217 | 1327 infos: MessageKind.UNIMPLEMENTED_EXPLICIT_GETTER), |
1218 check(""" | 1328 check( |
| 1329 """ |
1219 abstract class A { | 1330 abstract class A { |
1220 set setter(_); // testAbstractMethod:11 | 1331 set setter(_); // testAbstractMethod:11 |
1221 } | 1332 } |
1222 class Class extends A { | 1333 class Class extends A { |
1223 } | 1334 } |
1224 """, warnings: MessageKind.UNIMPLEMENTED_SETTER_ONE, | 1335 """, |
1225 infos: MessageKind.UNIMPLEMENTED_EXPLICIT_SETTER), | 1336 warnings: MessageKind.UNIMPLEMENTED_SETTER_ONE, |
1226 | 1337 infos: MessageKind.UNIMPLEMENTED_EXPLICIT_SETTER), |
1227 check(""" | 1338 check( |
| 1339 """ |
1228 abstract class A { | 1340 abstract class A { |
1229 method(); // testAbstractMethod:12 | 1341 method(); // testAbstractMethod:12 |
1230 } | 1342 } |
1231 class B { | 1343 class B { |
1232 method() {} // testAbstractMethod:13 | 1344 method() {} // testAbstractMethod:13 |
1233 } | 1345 } |
1234 class Class extends A implements B { | 1346 class Class extends A implements B { |
1235 } | 1347 } |
1236 """, warnings: MessageKind.UNIMPLEMENTED_METHOD, | 1348 """, |
1237 infos: [MessageKind.UNIMPLEMENTED_METHOD_CONT, | 1349 warnings: MessageKind.UNIMPLEMENTED_METHOD, |
1238 MessageKind.UNIMPLEMENTED_METHOD_CONT]), | 1350 infos: [ |
1239 | 1351 MessageKind.UNIMPLEMENTED_METHOD_CONT, |
1240 check(""" | 1352 MessageKind.UNIMPLEMENTED_METHOD_CONT |
| 1353 ]), |
| 1354 check( |
| 1355 """ |
1241 class Class implements Function { | 1356 class Class implements Function { |
1242 } | 1357 } |
1243 """, warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE, | 1358 """, |
1244 infos: []), | 1359 warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE, |
1245 | 1360 infos: []), |
1246 check(""" | 1361 check( |
| 1362 """ |
1247 abstract class A { | 1363 abstract class A { |
1248 get getter; // testAbstractMethod:14 | 1364 get getter; // testAbstractMethod:14 |
1249 } | 1365 } |
1250 class B { | 1366 class B { |
1251 get getter => 0; // testAbstractMethod:15 | 1367 get getter => 0; // testAbstractMethod:15 |
1252 } | 1368 } |
1253 class Class extends A implements B { | 1369 class Class extends A implements B { |
1254 } | 1370 } |
1255 """, warnings: MessageKind.UNIMPLEMENTED_GETTER, | 1371 """, |
1256 infos: [MessageKind.UNIMPLEMENTED_EXPLICIT_GETTER, | 1372 warnings: MessageKind.UNIMPLEMENTED_GETTER, |
1257 MessageKind.UNIMPLEMENTED_EXPLICIT_GETTER]), | 1373 infos: [ |
1258 | 1374 MessageKind.UNIMPLEMENTED_EXPLICIT_GETTER, |
1259 check(""" | 1375 MessageKind.UNIMPLEMENTED_EXPLICIT_GETTER |
| 1376 ]), |
| 1377 check( |
| 1378 """ |
1260 abstract class A { | 1379 abstract class A { |
1261 set setter(_); // testAbstractMethod:16 | 1380 set setter(_); // testAbstractMethod:16 |
1262 } | 1381 } |
1263 class B { | 1382 class B { |
1264 set setter(_) {} // testAbstractMethod:17 | 1383 set setter(_) {} // testAbstractMethod:17 |
1265 } | 1384 } |
1266 class Class extends A implements B { | 1385 class Class extends A implements B { |
1267 } | 1386 } |
1268 """, warnings: MessageKind.UNIMPLEMENTED_SETTER, | 1387 """, |
1269 infos: [MessageKind.UNIMPLEMENTED_EXPLICIT_SETTER, | 1388 warnings: MessageKind.UNIMPLEMENTED_SETTER, |
1270 MessageKind.UNIMPLEMENTED_EXPLICIT_SETTER]), | 1389 infos: [ |
1271 | 1390 MessageKind.UNIMPLEMENTED_EXPLICIT_SETTER, |
1272 check(""" | 1391 MessageKind.UNIMPLEMENTED_EXPLICIT_SETTER |
| 1392 ]), |
| 1393 check( |
| 1394 """ |
1273 abstract class A { | 1395 abstract class A { |
1274 get field; // testAbstractMethod:18 | 1396 get field; // testAbstractMethod:18 |
1275 } | 1397 } |
1276 class B { | 1398 class B { |
1277 var field; // testAbstractMethod:19 | 1399 var field; // testAbstractMethod:19 |
1278 } | 1400 } |
1279 class Class extends A implements B { | 1401 class Class extends A implements B { |
1280 set field(_) {} // testAbstractMethod:20 | 1402 set field(_) {} // testAbstractMethod:20 |
1281 } | 1403 } |
1282 """, warnings: MessageKind.UNIMPLEMENTED_GETTER, | 1404 """, |
1283 infos: [MessageKind.UNIMPLEMENTED_EXPLICIT_GETTER, | 1405 warnings: MessageKind.UNIMPLEMENTED_GETTER, |
1284 MessageKind.UNIMPLEMENTED_IMPLICIT_GETTER]), | 1406 infos: [ |
1285 | 1407 MessageKind.UNIMPLEMENTED_EXPLICIT_GETTER, |
1286 check(""" | 1408 MessageKind.UNIMPLEMENTED_IMPLICIT_GETTER |
| 1409 ]), |
| 1410 check( |
| 1411 """ |
1287 abstract class A { | 1412 abstract class A { |
1288 set field(_); // testAbstractMethod:21 | 1413 set field(_); // testAbstractMethod:21 |
1289 } | 1414 } |
1290 class B { | 1415 class B { |
1291 var field; // testAbstractMethod:22 | 1416 var field; // testAbstractMethod:22 |
1292 } | 1417 } |
1293 class Class extends A implements B { | 1418 class Class extends A implements B { |
1294 get field => 0; // testAbstractMethod:23 | 1419 get field => 0; // testAbstractMethod:23 |
1295 } | 1420 } |
1296 """, warnings: MessageKind.UNIMPLEMENTED_SETTER, | 1421 """, |
1297 infos: [MessageKind.UNIMPLEMENTED_EXPLICIT_SETTER, | 1422 warnings: MessageKind.UNIMPLEMENTED_SETTER, |
1298 MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER]), | 1423 infos: [ |
1299 | 1424 MessageKind.UNIMPLEMENTED_EXPLICIT_SETTER, |
| 1425 MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER |
| 1426 ]), |
1300 check(""" | 1427 check(""" |
1301 class A { | 1428 class A { |
1302 method() {} // testAbstractMethod:24 | 1429 method() {} // testAbstractMethod:24 |
1303 } | 1430 } |
1304 class Class implements A { | 1431 class Class implements A { |
1305 method() {} // testAbstractMethod:25 | 1432 method() {} // testAbstractMethod:25 |
1306 } | 1433 } |
1307 """), | 1434 """), |
1308 | |
1309 check(""" | 1435 check(""" |
1310 class A { | 1436 class A { |
1311 method() {} // testAbstractMethod:26 | 1437 method() {} // testAbstractMethod:26 |
1312 } | 1438 } |
1313 class Class implements A { | 1439 class Class implements A { |
1314 method([a]) {} // testAbstractMethod:27 | 1440 method([a]) {} // testAbstractMethod:27 |
1315 } | 1441 } |
1316 """), | 1442 """), |
1317 | 1443 check( |
1318 check(""" | 1444 """ |
1319 class A { | 1445 class A { |
1320 method() {} // testAbstractMethod:28 | 1446 method() {} // testAbstractMethod:28 |
1321 } | 1447 } |
1322 class Class implements A { | 1448 class Class implements A { |
1323 } | 1449 } |
1324 """, warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE, | 1450 """, |
1325 infos: MessageKind.UNIMPLEMENTED_METHOD_CONT), | 1451 warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE, |
1326 | 1452 infos: MessageKind.UNIMPLEMENTED_METHOD_CONT), |
1327 check(""" | 1453 check(""" |
1328 class A { | 1454 class A { |
1329 method() {} // testAbstractMethod:29 | 1455 method() {} // testAbstractMethod:29 |
1330 } | 1456 } |
1331 class B { | 1457 class B { |
1332 method() {} // testAbstractMethod:30 | 1458 method() {} // testAbstractMethod:30 |
1333 } | 1459 } |
1334 class Class extends A implements B { | 1460 class Class extends A implements B { |
1335 } | 1461 } |
1336 """), | 1462 """), |
1337 | 1463 check( |
1338 check(""" | 1464 """ |
1339 class A { | 1465 class A { |
1340 var member; // testAbstractMethod:31 | 1466 var member; // testAbstractMethod:31 |
1341 } | 1467 } |
1342 class Class implements A { | 1468 class Class implements A { |
1343 } | 1469 } |
1344 """, warnings: [MessageKind.UNIMPLEMENTED_GETTER_ONE, | 1470 """, |
1345 MessageKind.UNIMPLEMENTED_SETTER_ONE], | 1471 warnings: [ |
1346 infos: [MessageKind.UNIMPLEMENTED_IMPLICIT_GETTER, | 1472 MessageKind.UNIMPLEMENTED_GETTER_ONE, |
1347 MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER]), | 1473 MessageKind.UNIMPLEMENTED_SETTER_ONE |
1348 | 1474 ], |
1349 check(""" | 1475 infos: [ |
| 1476 MessageKind.UNIMPLEMENTED_IMPLICIT_GETTER, |
| 1477 MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER |
| 1478 ]), |
| 1479 check( |
| 1480 """ |
1350 class A { | 1481 class A { |
1351 var member; // testAbstractMethod:32 | 1482 var member; // testAbstractMethod:32 |
1352 } | 1483 } |
1353 class B { | 1484 class B { |
1354 get member => null; // testAbstractMethod:33 | 1485 get member => null; // testAbstractMethod:33 |
1355 set member(_) {} // testAbstractMethod:34 | 1486 set member(_) {} // testAbstractMethod:34 |
1356 } | 1487 } |
1357 class Class implements A, B { | 1488 class Class implements A, B { |
1358 } | 1489 } |
1359 """, warnings: [MessageKind.UNIMPLEMENTED_GETTER, | 1490 """, |
1360 MessageKind.UNIMPLEMENTED_SETTER], | 1491 warnings: [ |
1361 infos: [MessageKind.UNIMPLEMENTED_EXPLICIT_GETTER, | 1492 MessageKind.UNIMPLEMENTED_GETTER, |
1362 MessageKind.UNIMPLEMENTED_IMPLICIT_GETTER, | 1493 MessageKind.UNIMPLEMENTED_SETTER |
1363 MessageKind.UNIMPLEMENTED_EXPLICIT_SETTER, | 1494 ], |
1364 MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER]), | 1495 infos: [ |
1365 | 1496 MessageKind.UNIMPLEMENTED_EXPLICIT_GETTER, |
1366 check(""" | 1497 MessageKind.UNIMPLEMENTED_IMPLICIT_GETTER, |
| 1498 MessageKind.UNIMPLEMENTED_EXPLICIT_SETTER, |
| 1499 MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER |
| 1500 ]), |
| 1501 check( |
| 1502 """ |
1367 class A { | 1503 class A { |
1368 var member; // testAbstractMethod:35 | 1504 var member; // testAbstractMethod:35 |
1369 } | 1505 } |
1370 class B { | 1506 class B { |
1371 var member; // testAbstractMethod:36 | 1507 var member; // testAbstractMethod:36 |
1372 } | 1508 } |
1373 class Class implements A, B { | 1509 class Class implements A, B { |
1374 } | 1510 } |
1375 """, warnings: [MessageKind.UNIMPLEMENTED_GETTER, | 1511 """, |
1376 MessageKind.UNIMPLEMENTED_SETTER], | 1512 warnings: [ |
1377 infos: [MessageKind.UNIMPLEMENTED_IMPLICIT_GETTER, | 1513 MessageKind.UNIMPLEMENTED_GETTER, |
1378 MessageKind.UNIMPLEMENTED_IMPLICIT_GETTER, | 1514 MessageKind.UNIMPLEMENTED_SETTER |
1379 MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER, | 1515 ], |
1380 MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER]), | 1516 infos: [ |
1381 | 1517 MessageKind.UNIMPLEMENTED_IMPLICIT_GETTER, |
1382 check(""" | 1518 MessageKind.UNIMPLEMENTED_IMPLICIT_GETTER, |
| 1519 MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER, |
| 1520 MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER |
| 1521 ]), |
| 1522 check( |
| 1523 """ |
1383 class A { | 1524 class A { |
1384 get member => 0; // testAbstractMethod:37 | 1525 get member => 0; // testAbstractMethod:37 |
1385 } | 1526 } |
1386 class Class implements A { | 1527 class Class implements A { |
1387 } | 1528 } |
1388 """, warnings: MessageKind.UNIMPLEMENTED_GETTER_ONE, | 1529 """, |
1389 infos: MessageKind.UNIMPLEMENTED_EXPLICIT_GETTER), | 1530 warnings: MessageKind.UNIMPLEMENTED_GETTER_ONE, |
1390 | 1531 infos: MessageKind.UNIMPLEMENTED_EXPLICIT_GETTER), |
1391 check(""" | 1532 check( |
| 1533 """ |
1392 class A { | 1534 class A { |
1393 set member(_) {} // testAbstractMethod:38 | 1535 set member(_) {} // testAbstractMethod:38 |
1394 } | 1536 } |
1395 class Class implements A { | 1537 class Class implements A { |
1396 } | 1538 } |
1397 """, warnings: MessageKind.UNIMPLEMENTED_SETTER_ONE, | 1539 """, |
1398 infos: MessageKind.UNIMPLEMENTED_EXPLICIT_SETTER), | 1540 warnings: MessageKind.UNIMPLEMENTED_SETTER_ONE, |
1399 | 1541 infos: MessageKind.UNIMPLEMENTED_EXPLICIT_SETTER), |
1400 check(""" | 1542 check( |
| 1543 """ |
1401 class A { | 1544 class A { |
1402 var member; // testAbstractMethod:39 | 1545 var member; // testAbstractMethod:39 |
1403 } | 1546 } |
1404 class Class implements A { | 1547 class Class implements A { |
1405 get member => 0; | 1548 get member => 0; |
1406 } | 1549 } |
1407 """, warnings: MessageKind.UNIMPLEMENTED_SETTER_ONE, | 1550 """, |
1408 infos: MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER), | 1551 warnings: MessageKind.UNIMPLEMENTED_SETTER_ONE, |
1409 | 1552 infos: MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER), |
1410 check(""" | 1553 check( |
| 1554 """ |
1411 class A { | 1555 class A { |
1412 var field; // testAbstractMethod:40 | 1556 var field; // testAbstractMethod:40 |
1413 } | 1557 } |
1414 class Class implements A { | 1558 class Class implements A { |
1415 final field = 0; // testAbstractMethod:41 | 1559 final field = 0; // testAbstractMethod:41 |
1416 } | 1560 } |
1417 """, warnings: MessageKind.UNIMPLEMENTED_SETTER_ONE, | 1561 """, |
1418 infos: MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER), | 1562 warnings: MessageKind.UNIMPLEMENTED_SETTER_ONE, |
1419 | 1563 infos: MessageKind.UNIMPLEMENTED_IMPLICIT_SETTER), |
1420 check(""" | 1564 check( |
| 1565 """ |
1421 class A { | 1566 class A { |
1422 var member; // testAbstractMethod:42 | 1567 var member; // testAbstractMethod:42 |
1423 } | 1568 } |
1424 class Class implements A { | 1569 class Class implements A { |
1425 set member(_) {} | 1570 set member(_) {} |
1426 } | 1571 } |
1427 """, warnings: MessageKind.UNIMPLEMENTED_GETTER_ONE, | 1572 """, |
1428 infos: MessageKind.UNIMPLEMENTED_IMPLICIT_GETTER), | 1573 warnings: MessageKind.UNIMPLEMENTED_GETTER_ONE, |
1429 | 1574 infos: MessageKind.UNIMPLEMENTED_IMPLICIT_GETTER), |
1430 check(""" | 1575 check(""" |
1431 abstract class A { | 1576 abstract class A { |
1432 method() {} // testAbstractMethod:43 | 1577 method() {} // testAbstractMethod:43 |
1433 } | 1578 } |
1434 class Class extends A { | 1579 class Class extends A { |
1435 method(); | 1580 method(); |
1436 } | 1581 } |
1437 """), | 1582 """), |
1438 ]); | 1583 ]); |
1439 } | 1584 } |
1440 | 1585 |
1441 Future testNoSuchMethod() { | 1586 Future testNoSuchMethod() { |
1442 return Future.wait([ | 1587 return Future.wait([ |
1443 check(""" | 1588 check( |
| 1589 """ |
1444 class Class { | 1590 class Class { |
1445 method(); // testNoSuchMethod:1 | 1591 method(); // testNoSuchMethod:1 |
1446 } | 1592 } |
1447 """, warnings: MessageKind.ABSTRACT_METHOD, | 1593 """, |
1448 infos: []), | 1594 warnings: MessageKind.ABSTRACT_METHOD, |
1449 | 1595 infos: []), |
1450 check(""" | 1596 check( |
| 1597 """ |
1451 @proxy | 1598 @proxy |
1452 class Class { | 1599 class Class { |
1453 method(); // testNoSuchMethod:2 | 1600 method(); // testNoSuchMethod:2 |
1454 } | 1601 } |
1455 """, warnings: MessageKind.ABSTRACT_METHOD, | 1602 """, |
1456 infos: []), | 1603 warnings: MessageKind.ABSTRACT_METHOD, |
1457 | 1604 infos: []), |
1458 check(""" | 1605 check(""" |
1459 class Class { | 1606 class Class { |
1460 noSuchMethod(_) => null; | 1607 noSuchMethod(_) => null; |
1461 method(); // testNoSuchMethod:3 | 1608 method(); // testNoSuchMethod:3 |
1462 } | 1609 } |
1463 """), | 1610 """), |
1464 | |
1465 check(""" | 1611 check(""" |
1466 class Class { | 1612 class Class { |
1467 noSuchMethod(_, [__]) => null; | 1613 noSuchMethod(_, [__]) => null; |
1468 method(); // testNoSuchMethod:4 | 1614 method(); // testNoSuchMethod:4 |
1469 } | 1615 } |
1470 """), | 1616 """), |
1471 | |
1472 check(""" | 1617 check(""" |
1473 class Class { | 1618 class Class { |
1474 noSuchMethod(_); | 1619 noSuchMethod(_); |
1475 method(); // testNoSuchMethod:5 | 1620 method(); // testNoSuchMethod:5 |
1476 } | 1621 } |
1477 """), | 1622 """), |
1478 | 1623 check( |
1479 check(""" | 1624 """ |
1480 abstract class A { | 1625 abstract class A { |
1481 method(); // testNoSuchMethod:6 | 1626 method(); // testNoSuchMethod:6 |
1482 } | 1627 } |
1483 class Class extends A { | 1628 class Class extends A { |
1484 } | 1629 } |
1485 """, warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE, | 1630 """, |
1486 infos: MessageKind.UNIMPLEMENTED_METHOD_CONT), | 1631 warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE, |
1487 | 1632 infos: MessageKind.UNIMPLEMENTED_METHOD_CONT), |
1488 check(""" | 1633 check( |
| 1634 """ |
1489 abstract class A { | 1635 abstract class A { |
1490 method(); // testNoSuchMethod:7 | 1636 method(); // testNoSuchMethod:7 |
1491 } | 1637 } |
1492 @proxy | 1638 @proxy |
1493 class Class extends A { | 1639 class Class extends A { |
1494 } | 1640 } |
1495 """, warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE, | 1641 """, |
1496 infos: MessageKind.UNIMPLEMENTED_METHOD_CONT), | 1642 warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE, |
1497 | 1643 infos: MessageKind.UNIMPLEMENTED_METHOD_CONT), |
1498 check(""" | 1644 check(""" |
1499 abstract class A { | 1645 abstract class A { |
1500 method(); // testNoSuchMethod:8 | 1646 method(); // testNoSuchMethod:8 |
1501 } | 1647 } |
1502 class Class extends A { | 1648 class Class extends A { |
1503 noSuchMethod(_) => null; | 1649 noSuchMethod(_) => null; |
1504 } | 1650 } |
1505 """), | 1651 """), |
1506 | 1652 check( |
1507 check(""" | 1653 """ |
1508 class A { | 1654 class A { |
1509 method() {} // testNoSuchMethod:9 | 1655 method() {} // testNoSuchMethod:9 |
1510 } | 1656 } |
1511 class Class implements A { | 1657 class Class implements A { |
1512 } | 1658 } |
1513 """, warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE, | 1659 """, |
1514 infos: MessageKind.UNIMPLEMENTED_METHOD_CONT), | 1660 warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE, |
1515 | 1661 infos: MessageKind.UNIMPLEMENTED_METHOD_CONT), |
1516 check(""" | 1662 check( |
| 1663 """ |
1517 class A { | 1664 class A { |
1518 method() {} // testNoSuchMethod:10 | 1665 method() {} // testNoSuchMethod:10 |
1519 } | 1666 } |
1520 class Class implements A { | 1667 class Class implements A { |
1521 } | 1668 } |
1522 """, warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE, | 1669 """, |
1523 infos: MessageKind.UNIMPLEMENTED_METHOD_CONT), | 1670 warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE, |
1524 | 1671 infos: MessageKind.UNIMPLEMENTED_METHOD_CONT), |
1525 check(""" | 1672 check( |
| 1673 """ |
1526 class A { | 1674 class A { |
1527 method() {} // testNoSuchMethod:11 | 1675 method() {} // testNoSuchMethod:11 |
1528 } | 1676 } |
1529 @proxy | 1677 @proxy |
1530 class Class implements A { | 1678 class Class implements A { |
1531 } | 1679 } |
1532 """, warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE, | 1680 """, |
1533 infos: MessageKind.UNIMPLEMENTED_METHOD_CONT), | 1681 warnings: MessageKind.UNIMPLEMENTED_METHOD_ONE, |
1534 | 1682 infos: MessageKind.UNIMPLEMENTED_METHOD_CONT), |
1535 check(""" | 1683 check(""" |
1536 class A { | 1684 class A { |
1537 method() {} // testNoSuchMethod:12 | 1685 method() {} // testNoSuchMethod:12 |
1538 } | 1686 } |
1539 class Class implements A { | 1687 class Class implements A { |
1540 noSuchMethod(_) => null; | 1688 noSuchMethod(_) => null; |
1541 } | 1689 } |
1542 """), | 1690 """), |
1543 | |
1544 check(""" | 1691 check(""" |
1545 class A { | 1692 class A { |
1546 noSuchMethod(_) => null; | 1693 noSuchMethod(_) => null; |
1547 method(); // testNoSuchMethod:13 | 1694 method(); // testNoSuchMethod:13 |
1548 } | 1695 } |
1549 class Class extends A { | 1696 class Class extends A { |
1550 } | 1697 } |
1551 """), | 1698 """), |
1552 ]); | 1699 ]); |
1553 } | 1700 } |
OLD | NEW |