OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.src.summary.resynthesize_ast_test; | 5 library analyzer.test.src.summary.resynthesize_ast_test; |
6 | 6 |
7 import 'dart:async'; | |
8 | |
9 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
11 import 'package:analyzer/error/error.dart'; | 9 import 'package:analyzer/error/error.dart'; |
12 import 'package:analyzer/src/dart/element/element.dart'; | 10 import 'package:analyzer/src/dart/element/element.dart'; |
13 import 'package:analyzer/src/generated/engine.dart' | 11 import 'package:analyzer/src/generated/engine.dart' |
14 show AnalysisContext, AnalysisOptionsImpl; | 12 show AnalysisContext, AnalysisOptionsImpl; |
15 import 'package:analyzer/src/generated/sdk.dart'; | 13 import 'package:analyzer/src/generated/sdk.dart'; |
16 import 'package:analyzer/src/generated/source.dart'; | 14 import 'package:analyzer/src/generated/source.dart'; |
17 import 'package:analyzer/src/summary/format.dart'; | 15 import 'package:analyzer/src/summary/format.dart'; |
18 import 'package:analyzer/src/summary/idl.dart'; | 16 import 'package:analyzer/src/summary/idl.dart'; |
19 import 'package:analyzer/src/summary/link.dart'; | 17 import 'package:analyzer/src/summary/link.dart'; |
20 import 'package:analyzer/src/summary/prelink.dart'; | 18 import 'package:analyzer/src/summary/prelink.dart'; |
21 import 'package:analyzer/src/summary/resynthesize.dart'; | 19 import 'package:analyzer/src/summary/resynthesize.dart'; |
22 import 'package:analyzer/src/summary/summarize_ast.dart'; | 20 import 'package:analyzer/src/summary/summarize_ast.dart'; |
23 import 'package:analyzer/src/summary/summarize_elements.dart' | 21 import 'package:analyzer/src/summary/summarize_elements.dart' |
24 show PackageBundleAssembler; | 22 show PackageBundleAssembler; |
25 import 'package:analyzer/task/dart.dart' show PARSED_UNIT; | 23 import 'package:analyzer/task/dart.dart' show PARSED_UNIT; |
26 import 'package:analyzer/task/general.dart'; | 24 import 'package:analyzer/task/general.dart'; |
27 import 'package:test/test.dart'; | 25 import 'package:test/test.dart'; |
28 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 26 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
29 | 27 |
30 import '../context/abstract_context.dart'; | 28 import '../context/abstract_context.dart'; |
31 import '../task/strong/inferred_type_test.dart'; | |
32 import 'element_text.dart'; | 29 import 'element_text.dart'; |
33 import 'resynthesize_common.dart'; | 30 import 'resynthesize_common.dart'; |
34 import 'summary_common.dart'; | 31 import 'summary_common.dart'; |
35 | 32 |
36 main() { | 33 main() { |
37 defineReflectiveSuite(() { | 34 defineReflectiveSuite(() { |
38 defineReflectiveTests(ResynthesizeAstSpecTest); | 35 defineReflectiveTests(ResynthesizeAstSpecTest); |
39 defineReflectiveTests(ResynthesizeAstStrongTest); | 36 defineReflectiveTests(ResynthesizeAstStrongTest); |
40 defineReflectiveTests(AstInferredTypeTest); | |
41 defineReflectiveTests(ApplyCheckElementTextReplacements); | 37 defineReflectiveTests(ApplyCheckElementTextReplacements); |
42 }); | 38 }); |
43 } | 39 } |
44 | 40 |
45 @reflectiveTest | 41 @reflectiveTest |
46 class ApplyCheckElementTextReplacements { | 42 class ApplyCheckElementTextReplacements { |
47 test_applyReplacements() { | 43 test_applyReplacements() { |
48 applyCheckElementTextReplacements(); | 44 applyCheckElementTextReplacements(); |
49 } | 45 } |
50 } | 46 } |
51 | 47 |
52 @reflectiveTest | 48 @reflectiveTest |
53 class AstInferredTypeTest extends AbstractResynthesizeTest | |
54 with _AstResynthesizeTestMixin, InferredTypeMixin { | |
55 @override | |
56 bool get isStrongMode => true; | |
57 | |
58 @override | |
59 bool get mayCheckTypesOfLocals => false; | |
60 | |
61 @override | |
62 void addFile(String content, {String name: '/main.dart'}) { | |
63 addLibrarySource(name, content); | |
64 } | |
65 | |
66 @override | |
67 Future<CompilationUnitElement> checkFileElement(String content) async { | |
68 Source source = addSource('/main.dart', content); | |
69 SummaryResynthesizer resynthesizer = _encodeLibrary(source); | |
70 LibraryElementImpl resynthesized = _checkSource(resynthesizer, source); | |
71 for (Source otherSource in otherLibrarySources) { | |
72 _checkSource(resynthesizer, otherSource); | |
73 } | |
74 _reset(); | |
75 return resynthesized.definingCompilationUnit; | |
76 } | |
77 | |
78 @override | |
79 void compareLocalElementsOfExecutable(ExecutableElement resynthesized, | |
80 ExecutableElement original, String desc) { | |
81 // We don't resynthesize local elements during link. | |
82 // So, we should not compare them. | |
83 } | |
84 | |
85 @override | |
86 DartSdk createDartSdk() => AbstractContextTest.SHARED_STRONG_MOCK_SDK; | |
87 | |
88 @override | |
89 AnalysisOptionsImpl createOptions() => | |
90 new AnalysisOptionsImpl()..strongMode = true; | |
91 | |
92 @override | |
93 @failingTest | |
94 test_blockBodiedLambdas_async_allReturnsAreFutures_topLevel() async { | |
95 await super.test_blockBodiedLambdas_async_allReturnsAreFutures_topLevel(); | |
96 } | |
97 | |
98 @override | |
99 @failingTest | |
100 test_blockBodiedLambdas_async_allReturnsAreValues_topLevel() async { | |
101 await super.test_blockBodiedLambdas_async_allReturnsAreValues_topLevel(); | |
102 } | |
103 | |
104 @override | |
105 @failingTest | |
106 test_blockBodiedLambdas_async_mixOfValuesAndFutures_topLevel() async { | |
107 await super.test_blockBodiedLambdas_async_mixOfValuesAndFutures_topLevel(); | |
108 } | |
109 | |
110 @override | |
111 @failingTest | |
112 test_blockBodiedLambdas_asyncStar_topLevel() async { | |
113 await super.test_blockBodiedLambdas_asyncStar_topLevel(); | |
114 } | |
115 | |
116 @override | |
117 @failingTest | |
118 test_blockBodiedLambdas_basic_topLevel() async { | |
119 await super.test_blockBodiedLambdas_basic_topLevel(); | |
120 } | |
121 | |
122 @override | |
123 @failingTest | |
124 test_blockBodiedLambdas_inferBottom_async_topLevel() async { | |
125 await super.test_blockBodiedLambdas_inferBottom_async_topLevel(); | |
126 } | |
127 | |
128 @override | |
129 @failingTest | |
130 test_blockBodiedLambdas_inferBottom_asyncStar_topLevel() async { | |
131 await super.test_blockBodiedLambdas_inferBottom_asyncStar_topLevel(); | |
132 } | |
133 | |
134 @override | |
135 @failingTest | |
136 test_blockBodiedLambdas_inferBottom_sync_topLevel() async { | |
137 await super.test_blockBodiedLambdas_inferBottom_sync_topLevel(); | |
138 } | |
139 | |
140 @override | |
141 @failingTest | |
142 test_blockBodiedLambdas_inferBottom_syncStar_topLevel() async { | |
143 await super.test_blockBodiedLambdas_inferBottom_syncStar_topLevel(); | |
144 } | |
145 | |
146 @override | |
147 @failingTest | |
148 test_blockBodiedLambdas_LUB_topLevel() async { | |
149 await super.test_blockBodiedLambdas_LUB_topLevel(); | |
150 } | |
151 | |
152 @override | |
153 @failingTest | |
154 test_blockBodiedLambdas_nestedLambdas_topLevel() async { | |
155 await super.test_blockBodiedLambdas_nestedLambdas_topLevel(); | |
156 } | |
157 | |
158 @override | |
159 @failingTest | |
160 test_blockBodiedLambdas_syncStar_topLevel() async { | |
161 await super.test_blockBodiedLambdas_syncStar_topLevel(); | |
162 } | |
163 | |
164 @override | |
165 @failingTest | |
166 test_circularReference_viaClosures_initializerTypes() async { | |
167 await super.test_circularReference_viaClosures_initializerTypes(); | |
168 } | |
169 | |
170 @override | |
171 @failingTest | |
172 test_blockBodiedLambdas_noReturn_topLevel() => | |
173 super.test_blockBodiedLambdas_noReturn_topLevel(); | |
174 | |
175 @failingTest | |
176 @override | |
177 test_listLiteralsCanInferNull_topLevel() => | |
178 super.test_listLiteralsCanInferNull_topLevel(); | |
179 | |
180 @failingTest | |
181 @override | |
182 test_mapLiteralsCanInferNull_topLevel() => | |
183 super.test_mapLiteralsCanInferNull_topLevel(); | |
184 | |
185 test_infer_extractIndex_custom() async { | |
186 var unit = await checkFileElement(''' | |
187 class A { | |
188 String operator [](_) => null; | |
189 } | |
190 var a = new A(); | |
191 var b = a[0]; | |
192 '''); | |
193 expect(unit.topLevelVariables[1].type.toString(), 'String'); | |
194 } | |
195 | |
196 test_infer_extractIndex_fromList() async { | |
197 var unit = await checkFileElement(''' | |
198 var a = <int>[1, 2, 3]; | |
199 var b = a[0]; | |
200 '''); | |
201 expect(unit.topLevelVariables[1].type.toString(), 'int'); | |
202 } | |
203 | |
204 test_infer_extractIndex_fromMap() async { | |
205 var unit = await checkFileElement(''' | |
206 var a = <int, double>{}; | |
207 var b = a[0]; | |
208 '''); | |
209 expect(unit.topLevelVariables[1].type.toString(), 'double'); | |
210 } | |
211 | |
212 test_infer_extractProperty_getter() async { | |
213 await checkFileElement(r''' | |
214 var a = 1.isEven; | |
215 var b = 2.isNaN; | |
216 var c = 3.foo; | |
217 var d = foo.bar; | |
218 '''); | |
219 } | |
220 | |
221 test_infer_extractProperty_getter_sequence() async { | |
222 var unit = await checkFileElement(r''' | |
223 class A { | |
224 B b = new B(); | |
225 } | |
226 class B { | |
227 C c = new C(); | |
228 } | |
229 class C { | |
230 int d; | |
231 } | |
232 var a = new A(); | |
233 var v = a.b.c.d; | |
234 '''); | |
235 expect(unit.topLevelVariables[1].type.toString(), 'dynamic'); | |
236 } | |
237 | |
238 test_infer_extractProperty_getter_sequence_generic() async { | |
239 var unit = await checkFileElement(r''' | |
240 class A<T> { | |
241 B<T> b = new B<T>(); | |
242 } | |
243 class B<K> { | |
244 C<List<K>, int> c = new C<List<K>, int>(); | |
245 } | |
246 class C<K, V> { | |
247 Map<K, V> d; | |
248 } | |
249 var a = new A<double>(); | |
250 var v = a.b.c.d; | |
251 '''); | |
252 expect(unit.topLevelVariables[1].type.toString(), 'dynamic'); | |
253 } | |
254 | |
255 test_infer_extractProperty_getter_sequence_withUnresolved() async { | |
256 var unit = await checkFileElement(r''' | |
257 class A { | |
258 B b = new B(); | |
259 } | |
260 class B { | |
261 int c; | |
262 } | |
263 var a = new A(); | |
264 var v = a.b.foo.c; | |
265 '''); | |
266 expect(unit.topLevelVariables[1].type.toString(), 'dynamic'); | |
267 } | |
268 | |
269 test_infer_extractProperty_method() async { | |
270 var unit = await checkFileElement(r''' | |
271 class A { | |
272 int m(double p1, String p2) => 42; | |
273 } | |
274 var a = new A(); | |
275 var v = a.m; | |
276 '''); | |
277 expect(unit.topLevelVariables[1].type.toString(), '(double, String) → int'); | |
278 } | |
279 | |
280 test_infer_extractProperty_method2() async { | |
281 var unit = await checkFileElement(r''' | |
282 var a = 1.round; | |
283 '''); | |
284 expect(unit.topLevelVariables[0].type.toString(), '() → int'); | |
285 } | |
286 | |
287 test_infer_extractProperty_method_sequence() async { | |
288 var unit = await checkFileElement(r''' | |
289 class A { | |
290 B b = new B(); | |
291 } | |
292 class B { | |
293 C c = new C(); | |
294 } | |
295 class C { | |
296 int m(double p1, String p2) => 42; | |
297 } | |
298 var a = new A(); | |
299 var v = a.b.c.m; | |
300 '''); | |
301 expect(unit.topLevelVariables[1].type.toString(), 'dynamic'); | |
302 } | |
303 | |
304 test_infer_invokeConstructor_factoryRedirected() async { | |
305 await checkFileElement(r''' | |
306 class A { | |
307 factory A() = B; | |
308 } | |
309 class B implements A {} | |
310 var a = new A(); | |
311 '''); | |
312 } | |
313 | |
314 test_infer_invokeConstructor_named() async { | |
315 await checkFileElement(r''' | |
316 class A { | |
317 A.aaa(); | |
318 } | |
319 class B<K, V> { | |
320 B.bbb(); | |
321 } | |
322 var a = new A.aaa(); | |
323 var b1 = new B.bbb(); | |
324 var b2 = new B<int, String>.bbb(); | |
325 var b3 = new B<List<int>, Map<List<int>, Set<String>>>.bbb(); | |
326 '''); | |
327 } | |
328 | |
329 test_infer_invokeConstructor_named_importedWithPrefix() async { | |
330 addFile( | |
331 r''' | |
332 class A { | |
333 A.aaa(); | |
334 } | |
335 class B<K, V> { | |
336 B.bbb(); | |
337 } | |
338 ''', | |
339 name: '/a.dart'); | |
340 await checkFileElement(r''' | |
341 import 'a.dart' as p; | |
342 var a = new p.A.aaa(); | |
343 var b1 = new p.B.bbb(); | |
344 var b2 = new p.B<int, String>.bbb(); | |
345 '''); | |
346 } | |
347 | |
348 test_infer_invokeConstructor_unnamed() async { | |
349 await checkFileElement(r''' | |
350 class A { | |
351 A(); | |
352 } | |
353 class B<T> { | |
354 B(); | |
355 } | |
356 var a = new A(); | |
357 var b1 = new B(); | |
358 var b2 = new B<int>(); | |
359 '''); | |
360 } | |
361 | |
362 test_infer_invokeConstructor_unnamed_synthetic() async { | |
363 await checkFileElement(r''' | |
364 class A {} | |
365 class B<T> {} | |
366 var a = new A(); | |
367 var b1 = new B(); | |
368 var b2 = new B<int>(); | |
369 '''); | |
370 } | |
371 | |
372 test_infer_invokeMethodRef_function() async { | |
373 var unit = await checkFileElement(r''' | |
374 int m() => 0; | |
375 var a = m(); | |
376 '''); | |
377 expect(unit.topLevelVariables[0].type.toString(), 'int'); | |
378 } | |
379 | |
380 test_infer_invokeMethodRef_function_generic() async { | |
381 var unit = await checkFileElement(r''' | |
382 /*=Map<int, V>*/ m/*<V>*/(/*=V*/ a) => null; | |
383 var a = m(2.3); | |
384 '''); | |
385 expect(unit.topLevelVariables[0].type.toString(), 'Map<int, double>'); | |
386 } | |
387 | |
388 test_infer_invokeMethodRef_function_importedWithPrefix() async { | |
389 addFile( | |
390 r''' | |
391 int m() => 0; | |
392 ''', | |
393 name: '/a.dart'); | |
394 var unit = await checkFileElement(r''' | |
395 import 'a.dart' as p; | |
396 var a = p.m(); | |
397 '''); | |
398 expect(unit.topLevelVariables[0].type.toString(), 'int'); | |
399 } | |
400 | |
401 test_infer_invokeMethodRef_method() async { | |
402 var unit = await checkFileElement(r''' | |
403 class A { | |
404 int m() => 0; | |
405 } | |
406 var a = new A(); | |
407 var b = a.m(); | |
408 '''); | |
409 expect(unit.topLevelVariables[1].type.toString(), 'int'); | |
410 } | |
411 | |
412 test_infer_invokeMethodRef_method_g() async { | |
413 var unit = await checkFileElement(r''' | |
414 class A { | |
415 /*=T*/ m/*<T>*/(/*=T*/ a) => null; | |
416 } | |
417 var a = new A(); | |
418 var b = a.m(1.0); | |
419 '''); | |
420 expect(unit.topLevelVariables[1].type.toString(), 'double'); | |
421 } | |
422 | |
423 test_infer_invokeMethodRef_method_genericSequence() async { | |
424 var unit = await checkFileElement(r''' | |
425 class A<T> { | |
426 B<T> b = new B<T>(); | |
427 } | |
428 class B<K> { | |
429 C<List<K>, int> c = new C<List<K>, int>(); | |
430 } | |
431 class C<K, V> { | |
432 Map<K, V> m() => null; | |
433 } | |
434 var a = new A<double>(); | |
435 var v = a.b.c.m(); | |
436 '''); | |
437 expect(unit.topLevelVariables[1].type.toString(), 'dynamic'); | |
438 } | |
439 | |
440 test_infer_invokeMethodRef_method_gg() async { | |
441 var unit = await checkFileElement(r''' | |
442 class A<K> { | |
443 /*=Map<K, V>*/ m/*<V>*/(/*=V*/ a) => null; | |
444 } | |
445 var a = new A<int>(); | |
446 var b = a.m(1.0); | |
447 '''); | |
448 expect(unit.topLevelVariables[1].type.toString(), 'Map<int, double>'); | |
449 } | |
450 | |
451 test_infer_invokeMethodRef_method_importedWithPrefix() async { | |
452 addFile( | |
453 r''' | |
454 class A { | |
455 int m() => 0; | |
456 } | |
457 var a = new A(); | |
458 ''', | |
459 name: '/a.dart'); | |
460 var unit = await checkFileElement(r''' | |
461 import 'a.dart' as p; | |
462 var b = p.a.m(); | |
463 '''); | |
464 expect(unit.topLevelVariables[0].type.toString(), 'int'); | |
465 } | |
466 | |
467 test_infer_invokeMethodRef_method_importedWithPrefix2() async { | |
468 addFile( | |
469 r''' | |
470 class A { | |
471 B b = new B(); | |
472 } | |
473 class B { | |
474 int m() => 0; | |
475 } | |
476 var a = new A(); | |
477 ''', | |
478 name: '/a.dart'); | |
479 var unit = await checkFileElement(r''' | |
480 import 'a.dart' as p; | |
481 var b = p.a.b.m(); | |
482 '''); | |
483 expect(unit.topLevelVariables[0].type.toString(), 'dynamic'); | |
484 } | |
485 | |
486 test_infer_invokeMethodRef_method_withInferredTypeInLibraryCycle() async { | |
487 var unit = await checkFileElement(''' | |
488 class Base { | |
489 int m() => 0; | |
490 } | |
491 class A extends Base { | |
492 m() => 0; // Inferred return type: int | |
493 } | |
494 var a = new A(); | |
495 var b = a.m(); | |
496 '''); | |
497 // Type inference operates on static and top level variables prior to | |
498 // instance members. So at the time `b` is inferred, `A.m` still has return | |
499 // type `dynamic`. | |
500 expect(unit.topLevelVariables[1].type.toString(), 'dynamic'); | |
501 } | |
502 | |
503 test_infer_invokeMethodRef_method_withInferredTypeOutsideLibraryCycle() async
{ | |
504 addFile( | |
505 ''' | |
506 class Base { | |
507 int m() => 0; | |
508 } | |
509 class A extends Base { | |
510 m() => 0; // Inferred return type: int | |
511 } | |
512 ''', | |
513 name: '/a.dart'); | |
514 var unit = await checkFileElement(''' | |
515 import 'a.dart'; | |
516 var a = new A(); | |
517 var b = a.m(); | |
518 '''); | |
519 // Since a.dart is in a separate library file from the compilation unit | |
520 // containing `a` and `b`, its types are inferred first; then `a` and `b`'s | |
521 // types are inferred. So the inferred return type of `int` should be | |
522 // propagated to `b`. | |
523 expect(unit.topLevelVariables[1].type.toString(), 'int'); | |
524 } | |
525 | |
526 @override | |
527 @failingTest | |
528 test_inferLocalFunctionReturnType() async { | |
529 await super.test_inferLocalFunctionReturnType(); | |
530 } | |
531 | |
532 @override | |
533 @failingTest | |
534 test_inferredType_blockBodiedClosure_noArguments() async { | |
535 await super.test_inferredType_blockBodiedClosure_noArguments(); | |
536 } | |
537 | |
538 @override | |
539 @failingTest | |
540 test_inferredType_blockClosure_noArgs_noReturn() async { | |
541 await super.test_inferredType_blockClosure_noArgs_noReturn(); | |
542 } | |
543 | |
544 test_invokeMethod_notGeneric_genericClass() async { | |
545 var unit = await checkFileElement(r''' | |
546 class C<T> { | |
547 T m(int a, {String b, T c}) => null; | |
548 } | |
549 var v = new C<double>().m(1, b: 'bbb', c: 2.0); | |
550 '''); | |
551 expect(unit.topLevelVariables[0].type.toString(), 'double'); | |
552 } | |
553 | |
554 test_invokeMethod_notGeneric_notGenericClass() async { | |
555 var unit = await checkFileElement(r''' | |
556 class C { | |
557 int m(int a, {String b, int c}) => null; | |
558 } | |
559 var v = new C().m(1, b: 'bbb', c: 2.0); | |
560 '''); | |
561 expect(unit.topLevelVariables[0].type.toString(), 'int'); | |
562 } | |
563 | |
564 @override | |
565 @failingTest | |
566 test_nullCoalescingOperator() async { | |
567 await super.test_nullCoalescingOperator(); | |
568 } | |
569 | |
570 @override | |
571 @failingTest | |
572 test_unsafeBlockClosureInference_closureCall() async { | |
573 await super.test_unsafeBlockClosureInference_closureCall(); | |
574 } | |
575 | |
576 @override | |
577 @failingTest | |
578 test_unsafeBlockClosureInference_constructorCall_implicitTypeParam() async { | |
579 return super | |
580 .test_unsafeBlockClosureInference_constructorCall_implicitTypeParam(); | |
581 } | |
582 | |
583 @override | |
584 @failingTest | |
585 test_unsafeBlockClosureInference_functionCall_explicitDynamicParam_viaExpr2()
async { | |
586 return super | |
587 .test_unsafeBlockClosureInference_functionCall_explicitDynamicParam_viaE
xpr2(); | |
588 } | |
589 | |
590 @override | |
591 @failingTest | |
592 test_unsafeBlockClosureInference_functionCall_explicitDynamicParam_viaExpr2_co
mment() async { | |
593 return super | |
594 .test_unsafeBlockClosureInference_functionCall_explicitDynamicParam_viaE
xpr2_comment(); | |
595 } | |
596 | |
597 @override | |
598 @failingTest | |
599 test_unsafeBlockClosureInference_functionCall_explicitTypeParam_viaExpr2() asy
nc { | |
600 return super | |
601 .test_unsafeBlockClosureInference_functionCall_explicitTypeParam_viaExpr
2(); | |
602 } | |
603 | |
604 @override | |
605 @failingTest | |
606 test_unsafeBlockClosureInference_functionCall_explicitTypeParam_viaExpr2_comme
nt() async { | |
607 return super | |
608 .test_unsafeBlockClosureInference_functionCall_explicitTypeParam_viaExpr
2_comment(); | |
609 } | |
610 | |
611 @override | |
612 @failingTest | |
613 test_unsafeBlockClosureInference_functionCall_implicitTypeParam() async { | |
614 return super | |
615 .test_unsafeBlockClosureInference_functionCall_implicitTypeParam(); | |
616 } | |
617 | |
618 @override | |
619 @failingTest | |
620 test_unsafeBlockClosureInference_functionCall_implicitTypeParam_comment() asyn
c { | |
621 return super | |
622 .test_unsafeBlockClosureInference_functionCall_implicitTypeParam_comment
(); | |
623 } | |
624 | |
625 @override | |
626 @failingTest | |
627 test_unsafeBlockClosureInference_functionCall_implicitTypeParam_viaExpr() asyn
c { | |
628 return super | |
629 .test_unsafeBlockClosureInference_functionCall_implicitTypeParam_viaExpr
(); | |
630 } | |
631 | |
632 @override | |
633 @failingTest | |
634 test_unsafeBlockClosureInference_functionCall_implicitTypeParam_viaExpr_commen
t() async { | |
635 return super | |
636 .test_unsafeBlockClosureInference_functionCall_implicitTypeParam_viaExpr
_comment(); | |
637 } | |
638 | |
639 @override | |
640 @failingTest | |
641 test_unsafeBlockClosureInference_functionCall_noTypeParam_viaExpr() async { | |
642 return super | |
643 .test_unsafeBlockClosureInference_functionCall_noTypeParam_viaExpr(); | |
644 } | |
645 | |
646 @override | |
647 @failingTest | |
648 test_unsafeBlockClosureInference_inList_untyped() async { | |
649 await super.test_unsafeBlockClosureInference_inList_untyped(); | |
650 } | |
651 | |
652 @override | |
653 @failingTest | |
654 test_unsafeBlockClosureInference_inMap_untyped() async { | |
655 await super.test_unsafeBlockClosureInference_inMap_untyped(); | |
656 } | |
657 | |
658 @override | |
659 @failingTest | |
660 test_unsafeBlockClosureInference_methodCall_implicitTypeParam() async { | |
661 return super | |
662 .test_unsafeBlockClosureInference_methodCall_implicitTypeParam(); | |
663 } | |
664 | |
665 @override | |
666 @failingTest | |
667 test_unsafeBlockClosureInference_methodCall_implicitTypeParam_comment() async
{ | |
668 return super | |
669 .test_unsafeBlockClosureInference_methodCall_implicitTypeParam_comment()
; | |
670 } | |
671 | |
672 LibraryElementImpl _checkSource( | |
673 SummaryResynthesizer resynthesizer, Source source) { | |
674 LibraryElementImpl resynthesized = | |
675 resynthesizer.getLibraryElement(source.uri.toString()); | |
676 LibraryElementImpl original = context.computeLibraryElement(source); | |
677 checkLibraryElements(original, resynthesized); | |
678 return resynthesized; | |
679 } | |
680 } | |
681 | |
682 @reflectiveTest | |
683 class ResynthesizeAstSpecTest extends _ResynthesizeAstTest { | 49 class ResynthesizeAstSpecTest extends _ResynthesizeAstTest { |
684 @override | 50 @override |
685 bool get isStrongMode => false; | 51 bool get isStrongMode => false; |
686 } | 52 } |
687 | 53 |
688 @reflectiveTest | 54 @reflectiveTest |
689 class ResynthesizeAstStrongTest extends _ResynthesizeAstTest { | 55 class ResynthesizeAstStrongTest extends _ResynthesizeAstTest { |
690 @override | 56 @override |
691 bool get isStrongMode => true; | 57 bool get isStrongMode => true; |
692 | 58 |
693 @override | 59 @override |
694 AnalysisOptionsImpl createOptions() => | 60 AnalysisOptionsImpl createOptions() => |
695 super.createOptions()..strongMode = true; | 61 super.createOptions()..strongMode = true; |
696 | 62 |
697 @override | 63 @override |
| 64 @failingTest |
| 65 test_const_invokeConstructor_generic_noTypeArguments() async { |
| 66 await super.test_const_invokeConstructor_generic_noTypeArguments(); |
| 67 } |
| 68 |
| 69 @override |
| 70 @failingTest |
698 test_instantiateToBounds_boundRefersToItself() async { | 71 test_instantiateToBounds_boundRefersToItself() async { |
699 await super.test_instantiateToBounds_boundRefersToItself(); | 72 await super.test_instantiateToBounds_boundRefersToItself(); |
700 } | 73 } |
701 | 74 |
702 @override | 75 @override |
703 @failingTest | 76 @failingTest |
704 test_syntheticFunctionType_genericClosure() async { | 77 test_syntheticFunctionType_genericClosure() async { |
705 await super.test_syntheticFunctionType_genericClosure(); | 78 await super.test_syntheticFunctionType_genericClosure(); |
706 } | 79 } |
707 | 80 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 } | 193 } |
821 return null; | 194 return null; |
822 } | 195 } |
823 CompilationUnit unit = context.computeResult(source, PARSED_UNIT); | 196 CompilationUnit unit = context.computeResult(source, PARSED_UNIT); |
824 UnlinkedUnitBuilder unlinkedUnit = serializeAstUnlinked(unit); | 197 UnlinkedUnitBuilder unlinkedUnit = serializeAstUnlinked(unit); |
825 bundleAssembler.addUnlinkedUnit(source, unlinkedUnit); | 198 bundleAssembler.addUnlinkedUnit(source, unlinkedUnit); |
826 return unlinkedUnit; | 199 return unlinkedUnit; |
827 }); | 200 }); |
828 } | 201 } |
829 | 202 |
830 void _reset() { | |
831 serializedSources.clear(); | |
832 bundleAssembler = new PackageBundleAssembler(); | |
833 uriToUnit.clear(); | |
834 } | |
835 | |
836 void _serializeLibrary(Source librarySource) { | 203 void _serializeLibrary(Source librarySource) { |
837 if (librarySource == null || librarySource.isInSystemLibrary) { | 204 if (librarySource == null || librarySource.isInSystemLibrary) { |
838 return; | 205 return; |
839 } | 206 } |
840 if (!serializedSources.add(librarySource)) { | 207 if (!serializedSources.add(librarySource)) { |
841 return; | 208 return; |
842 } | 209 } |
843 | 210 |
844 UnlinkedUnit getPart(String absoluteUri) { | 211 UnlinkedUnit getPart(String absoluteUri) { |
845 Source source = context.sourceFactory.forUri(absoluteUri); | 212 Source source = context.sourceFactory.forUri(absoluteUri); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 | 275 |
909 @override | 276 @override |
910 AnalysisOptionsImpl createOptions() => | 277 AnalysisOptionsImpl createOptions() => |
911 super.createOptions()..strongMode = isStrongMode; | 278 super.createOptions()..strongMode = isStrongMode; |
912 | 279 |
913 @override | 280 @override |
914 TestSummaryResynthesizer encodeDecodeLibrarySource(Source source) { | 281 TestSummaryResynthesizer encodeDecodeLibrarySource(Source source) { |
915 return _encodeLibrary(source); | 282 return _encodeLibrary(source); |
916 } | 283 } |
917 } | 284 } |
OLD | NEW |