Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: pkg/analyzer/test/src/summary/resynthesize_ast_test.dart

Issue 2762863002: Issue 28580. Relax instantiate to bounds. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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'; 7 import 'dart:async';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/element/element.dart'; 10 import 'package:analyzer/dart/element/element.dart';
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 @reflectiveTest 52 @reflectiveTest
53 class AstInferredTypeTest extends AbstractResynthesizeTest 53 class AstInferredTypeTest extends AbstractResynthesizeTest
54 with _AstResynthesizeTestMixin, InferredTypeMixin { 54 with _AstResynthesizeTestMixin, InferredTypeMixin {
55 @override 55 @override
56 bool get isStrongMode => true; 56 bool get isStrongMode => true;
57 57
58 @override 58 @override
59 bool get mayCheckTypesOfLocals => false; 59 bool get mayCheckTypesOfLocals => false;
60 60
61 bool shouldCompareElementsWithAnalysisContext = true;
62
61 @override 63 @override
62 void addFile(String content, {String name: '/main.dart'}) { 64 void addFile(String content, {String name: '/main.dart'}) {
63 addLibrarySource(name, content); 65 addLibrarySource(name, content);
64 } 66 }
65 67
66 @override 68 @override
67 Future<CompilationUnitElement> checkFileElement(String content) async { 69 Future<CompilationUnitElement> checkFileElement(String content) async {
68 Source source = addSource('/main.dart', content); 70 Source source = addSource('/main.dart', content);
69 SummaryResynthesizer resynthesizer = _encodeLibrary(source); 71 SummaryResynthesizer resynthesizer = _encodeLibrary(source);
70 LibraryElementImpl resynthesized = _checkSource(resynthesizer, source); 72 LibraryElementImpl resynthesized = _checkSource(resynthesizer, source);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 152 }
151 153
152 @override 154 @override
153 @failingTest 155 @failingTest
154 test_blockBodiedLambdas_nestedLambdas_topLevel() async { 156 test_blockBodiedLambdas_nestedLambdas_topLevel() async {
155 await super.test_blockBodiedLambdas_nestedLambdas_topLevel(); 157 await super.test_blockBodiedLambdas_nestedLambdas_topLevel();
156 } 158 }
157 159
158 @override 160 @override
159 @failingTest 161 @failingTest
162 test_blockBodiedLambdas_noReturn_topLevel() =>
163 super.test_blockBodiedLambdas_noReturn_topLevel();
164
165 @override
166 @failingTest
160 test_blockBodiedLambdas_syncStar_topLevel() async { 167 test_blockBodiedLambdas_syncStar_topLevel() async {
161 await super.test_blockBodiedLambdas_syncStar_topLevel(); 168 await super.test_blockBodiedLambdas_syncStar_topLevel();
162 } 169 }
163 170
164 @override 171 @override
165 @failingTest 172 @failingTest
166 test_circularReference_viaClosures_initializerTypes() async { 173 test_circularReference_viaClosures_initializerTypes() async {
167 await super.test_circularReference_viaClosures_initializerTypes(); 174 await super.test_circularReference_viaClosures_initializerTypes();
168 } 175 }
169 176
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 { 177 test_infer_extractIndex_custom() async {
186 var unit = await checkFileElement(''' 178 var unit = await checkFileElement('''
187 class A { 179 class A {
188 String operator [](_) => null; 180 String operator [](_) => null;
189 } 181 }
190 var a = new A(); 182 var a = new A();
191 var b = a[0]; 183 var b = a[0];
192 '''); 184 ''');
193 expect(unit.topLevelVariables[1].type.toString(), 'String'); 185 expect(unit.topLevelVariables[1].type.toString(), 'String');
194 } 186 }
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 test_inferredType_blockBodiedClosure_noArguments() async { 526 test_inferredType_blockBodiedClosure_noArguments() async {
535 await super.test_inferredType_blockBodiedClosure_noArguments(); 527 await super.test_inferredType_blockBodiedClosure_noArguments();
536 } 528 }
537 529
538 @override 530 @override
539 @failingTest 531 @failingTest
540 test_inferredType_blockClosure_noArgs_noReturn() async { 532 test_inferredType_blockClosure_noArgs_noReturn() async {
541 await super.test_inferredType_blockClosure_noArgs_noReturn(); 533 await super.test_inferredType_blockClosure_noArgs_noReturn();
542 } 534 }
543 535
536 @override
537 test_instantiateToBounds_typeName_OK_hasBound_definedAfter() async {
538 shouldCompareElementsWithAnalysisContext = false;
539 await super.test_instantiateToBounds_typeName_OK_hasBound_definedAfter();
540 }
541
544 test_invokeMethod_notGeneric_genericClass() async { 542 test_invokeMethod_notGeneric_genericClass() async {
545 var unit = await checkFileElement(r''' 543 var unit = await checkFileElement(r'''
546 class C<T> { 544 class C<T> {
547 T m(int a, {String b, T c}) => null; 545 T m(int a, {String b, T c}) => null;
548 } 546 }
549 var v = new C<double>().m(1, b: 'bbb', c: 2.0); 547 var v = new C<double>().m(1, b: 'bbb', c: 2.0);
550 '''); 548 ''');
551 expect(unit.topLevelVariables[0].type.toString(), 'double'); 549 expect(unit.topLevelVariables[0].type.toString(), 'double');
552 } 550 }
553 551
554 test_invokeMethod_notGeneric_notGenericClass() async { 552 test_invokeMethod_notGeneric_notGenericClass() async {
555 var unit = await checkFileElement(r''' 553 var unit = await checkFileElement(r'''
556 class C { 554 class C {
557 int m(int a, {String b, int c}) => null; 555 int m(int a, {String b, int c}) => null;
558 } 556 }
559 var v = new C().m(1, b: 'bbb', c: 2.0); 557 var v = new C().m(1, b: 'bbb', c: 2.0);
560 '''); 558 ''');
561 expect(unit.topLevelVariables[0].type.toString(), 'int'); 559 expect(unit.topLevelVariables[0].type.toString(), 'int');
562 } 560 }
563 561
562 @failingTest
563 @override
564 test_listLiteralsCanInferNull_topLevel() =>
565 super.test_listLiteralsCanInferNull_topLevel();
566
567 @failingTest
568 @override
569 test_mapLiteralsCanInferNull_topLevel() =>
570 super.test_mapLiteralsCanInferNull_topLevel();
571
564 @override 572 @override
565 @failingTest 573 @failingTest
566 test_nullCoalescingOperator() async { 574 test_nullCoalescingOperator() async {
567 await super.test_nullCoalescingOperator(); 575 await super.test_nullCoalescingOperator();
568 } 576 }
569 577
570 @override 578 @override
571 @failingTest 579 @failingTest
572 test_unsafeBlockClosureInference_closureCall() async { 580 test_unsafeBlockClosureInference_closureCall() async {
573 await super.test_unsafeBlockClosureInference_closureCall(); 581 await super.test_unsafeBlockClosureInference_closureCall();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 @failingTest 674 @failingTest
667 test_unsafeBlockClosureInference_methodCall_implicitTypeParam_comment() async { 675 test_unsafeBlockClosureInference_methodCall_implicitTypeParam_comment() async {
668 return super 676 return super
669 .test_unsafeBlockClosureInference_methodCall_implicitTypeParam_comment() ; 677 .test_unsafeBlockClosureInference_methodCall_implicitTypeParam_comment() ;
670 } 678 }
671 679
672 LibraryElementImpl _checkSource( 680 LibraryElementImpl _checkSource(
673 SummaryResynthesizer resynthesizer, Source source) { 681 SummaryResynthesizer resynthesizer, Source source) {
674 LibraryElementImpl resynthesized = 682 LibraryElementImpl resynthesized =
675 resynthesizer.getLibraryElement(source.uri.toString()); 683 resynthesizer.getLibraryElement(source.uri.toString());
676 LibraryElementImpl original = context.computeLibraryElement(source); 684 if (shouldCompareElementsWithAnalysisContext) {
677 checkLibraryElements(original, resynthesized); 685 LibraryElementImpl original = context.computeLibraryElement(source);
686 checkLibraryElements(original, resynthesized);
687 }
678 return resynthesized; 688 return resynthesized;
679 } 689 }
680 } 690 }
681 691
682 @reflectiveTest 692 @reflectiveTest
683 class ResynthesizeAstSpecTest extends _ResynthesizeAstTest { 693 class ResynthesizeAstSpecTest extends _ResynthesizeAstTest {
684 @override 694 @override
685 bool get isStrongMode => false; 695 bool get isStrongMode => false;
686 } 696 }
687 697
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 918
909 @override 919 @override
910 AnalysisOptionsImpl createOptions() => 920 AnalysisOptionsImpl createOptions() =>
911 super.createOptions()..strongMode = isStrongMode; 921 super.createOptions()..strongMode = isStrongMode;
912 922
913 @override 923 @override
914 TestSummaryResynthesizer encodeDecodeLibrarySource(Source source) { 924 TestSummaryResynthesizer encodeDecodeLibrarySource(Source source) {
915 return _encodeLibrary(source); 925 return _encodeLibrary(source);
916 } 926 }
917 } 927 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698