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

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

Issue 2769703002: Revert "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
63 @override 61 @override
64 void addFile(String content, {String name: '/main.dart'}) { 62 void addFile(String content, {String name: '/main.dart'}) {
65 addLibrarySource(name, content); 63 addLibrarySource(name, content);
66 } 64 }
67 65
68 @override 66 @override
69 Future<CompilationUnitElement> checkFileElement(String content) async { 67 Future<CompilationUnitElement> checkFileElement(String content) async {
70 Source source = addSource('/main.dart', content); 68 Source source = addSource('/main.dart', content);
71 SummaryResynthesizer resynthesizer = _encodeLibrary(source); 69 SummaryResynthesizer resynthesizer = _encodeLibrary(source);
72 LibraryElementImpl resynthesized = _checkSource(resynthesizer, source); 70 LibraryElementImpl resynthesized = _checkSource(resynthesizer, source);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 150 }
153 151
154 @override 152 @override
155 @failingTest 153 @failingTest
156 test_blockBodiedLambdas_nestedLambdas_topLevel() async { 154 test_blockBodiedLambdas_nestedLambdas_topLevel() async {
157 await super.test_blockBodiedLambdas_nestedLambdas_topLevel(); 155 await super.test_blockBodiedLambdas_nestedLambdas_topLevel();
158 } 156 }
159 157
160 @override 158 @override
161 @failingTest 159 @failingTest
162 test_blockBodiedLambdas_noReturn_topLevel() =>
163 super.test_blockBodiedLambdas_noReturn_topLevel();
164
165 @override
166 @failingTest
167 test_blockBodiedLambdas_syncStar_topLevel() async { 160 test_blockBodiedLambdas_syncStar_topLevel() async {
168 await super.test_blockBodiedLambdas_syncStar_topLevel(); 161 await super.test_blockBodiedLambdas_syncStar_topLevel();
169 } 162 }
170 163
171 @override 164 @override
172 @failingTest 165 @failingTest
173 test_circularReference_viaClosures_initializerTypes() async { 166 test_circularReference_viaClosures_initializerTypes() async {
174 await super.test_circularReference_viaClosures_initializerTypes(); 167 await super.test_circularReference_viaClosures_initializerTypes();
175 } 168 }
176 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
177 test_infer_extractIndex_custom() async { 185 test_infer_extractIndex_custom() async {
178 var unit = await checkFileElement(''' 186 var unit = await checkFileElement('''
179 class A { 187 class A {
180 String operator [](_) => null; 188 String operator [](_) => null;
181 } 189 }
182 var a = new A(); 190 var a = new A();
183 var b = a[0]; 191 var b = a[0];
184 '''); 192 ''');
185 expect(unit.topLevelVariables[1].type.toString(), 'String'); 193 expect(unit.topLevelVariables[1].type.toString(), 'String');
186 } 194 }
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 test_inferredType_blockBodiedClosure_noArguments() async { 534 test_inferredType_blockBodiedClosure_noArguments() async {
527 await super.test_inferredType_blockBodiedClosure_noArguments(); 535 await super.test_inferredType_blockBodiedClosure_noArguments();
528 } 536 }
529 537
530 @override 538 @override
531 @failingTest 539 @failingTest
532 test_inferredType_blockClosure_noArgs_noReturn() async { 540 test_inferredType_blockClosure_noArgs_noReturn() async {
533 await super.test_inferredType_blockClosure_noArgs_noReturn(); 541 await super.test_inferredType_blockClosure_noArgs_noReturn();
534 } 542 }
535 543
536 @override
537 test_instantiateToBounds_typeName_OK_hasBound_definedAfter() async {
538 shouldCompareElementsWithAnalysisContext = false;
539 await super.test_instantiateToBounds_typeName_OK_hasBound_definedAfter();
540 }
541
542 test_invokeMethod_notGeneric_genericClass() async { 544 test_invokeMethod_notGeneric_genericClass() async {
543 var unit = await checkFileElement(r''' 545 var unit = await checkFileElement(r'''
544 class C<T> { 546 class C<T> {
545 T m(int a, {String b, T c}) => null; 547 T m(int a, {String b, T c}) => null;
546 } 548 }
547 var v = new C<double>().m(1, b: 'bbb', c: 2.0); 549 var v = new C<double>().m(1, b: 'bbb', c: 2.0);
548 '''); 550 ''');
549 expect(unit.topLevelVariables[0].type.toString(), 'double'); 551 expect(unit.topLevelVariables[0].type.toString(), 'double');
550 } 552 }
551 553
552 test_invokeMethod_notGeneric_notGenericClass() async { 554 test_invokeMethod_notGeneric_notGenericClass() async {
553 var unit = await checkFileElement(r''' 555 var unit = await checkFileElement(r'''
554 class C { 556 class C {
555 int m(int a, {String b, int c}) => null; 557 int m(int a, {String b, int c}) => null;
556 } 558 }
557 var v = new C().m(1, b: 'bbb', c: 2.0); 559 var v = new C().m(1, b: 'bbb', c: 2.0);
558 '''); 560 ''');
559 expect(unit.topLevelVariables[0].type.toString(), 'int'); 561 expect(unit.topLevelVariables[0].type.toString(), 'int');
560 } 562 }
561 563
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
572 @override 564 @override
573 @failingTest 565 @failingTest
574 test_nullCoalescingOperator() async { 566 test_nullCoalescingOperator() async {
575 await super.test_nullCoalescingOperator(); 567 await super.test_nullCoalescingOperator();
576 } 568 }
577 569
578 @override 570 @override
579 @failingTest 571 @failingTest
580 test_unsafeBlockClosureInference_closureCall() async { 572 test_unsafeBlockClosureInference_closureCall() async {
581 await super.test_unsafeBlockClosureInference_closureCall(); 573 await super.test_unsafeBlockClosureInference_closureCall();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 @failingTest 666 @failingTest
675 test_unsafeBlockClosureInference_methodCall_implicitTypeParam_comment() async { 667 test_unsafeBlockClosureInference_methodCall_implicitTypeParam_comment() async {
676 return super 668 return super
677 .test_unsafeBlockClosureInference_methodCall_implicitTypeParam_comment() ; 669 .test_unsafeBlockClosureInference_methodCall_implicitTypeParam_comment() ;
678 } 670 }
679 671
680 LibraryElementImpl _checkSource( 672 LibraryElementImpl _checkSource(
681 SummaryResynthesizer resynthesizer, Source source) { 673 SummaryResynthesizer resynthesizer, Source source) {
682 LibraryElementImpl resynthesized = 674 LibraryElementImpl resynthesized =
683 resynthesizer.getLibraryElement(source.uri.toString()); 675 resynthesizer.getLibraryElement(source.uri.toString());
684 if (shouldCompareElementsWithAnalysisContext) { 676 LibraryElementImpl original = context.computeLibraryElement(source);
685 LibraryElementImpl original = context.computeLibraryElement(source); 677 checkLibraryElements(original, resynthesized);
686 checkLibraryElements(original, resynthesized);
687 }
688 return resynthesized; 678 return resynthesized;
689 } 679 }
690 } 680 }
691 681
692 @reflectiveTest 682 @reflectiveTest
693 class ResynthesizeAstSpecTest extends _ResynthesizeAstTest { 683 class ResynthesizeAstSpecTest extends _ResynthesizeAstTest {
694 @override 684 @override
695 bool get isStrongMode => false; 685 bool get isStrongMode => false;
696 } 686 }
697 687
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 908
919 @override 909 @override
920 AnalysisOptionsImpl createOptions() => 910 AnalysisOptionsImpl createOptions() =>
921 super.createOptions()..strongMode = isStrongMode; 911 super.createOptions()..strongMode = isStrongMode;
922 912
923 @override 913 @override
924 TestSummaryResynthesizer encodeDecodeLibrarySource(Source source) { 914 TestSummaryResynthesizer encodeDecodeLibrarySource(Source source) {
925 return _encodeLibrary(source); 915 return _encodeLibrary(source);
926 } 916 }
927 } 917 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/strong_mode_test.dart ('k') | pkg/analyzer/test/src/task/strong/inferred_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698