| 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 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
| 9 import 'package:analyzer/src/dart/element/element.dart'; | 9 import 'package:analyzer/src/dart/element/element.dart'; |
| 10 import 'package:analyzer/src/generated/engine.dart' | 10 import 'package:analyzer/src/generated/engine.dart' |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 @reflectiveTest | 37 @reflectiveTest |
| 38 class AstInferredTypeTest extends AbstractResynthesizeTest | 38 class AstInferredTypeTest extends AbstractResynthesizeTest |
| 39 with _AstResynthesizeTestMixin, InferredTypeMixin { | 39 with _AstResynthesizeTestMixin, InferredTypeMixin { |
| 40 bool get checkPropagatedTypes { | 40 bool get checkPropagatedTypes { |
| 41 // AST-based summaries do not yet handle propagated types. | 41 // AST-based summaries do not yet handle propagated types. |
| 42 // TODO(paulberry): fix this. | 42 // TODO(paulberry): fix this. |
| 43 return false; | 43 return false; |
| 44 } | 44 } |
| 45 | 45 |
| 46 @override | 46 @override |
| 47 bool get mayCheckTypesOfLocals => false; |
| 48 |
| 49 @override |
| 47 bool get skipBrokenAstInference => true; | 50 bool get skipBrokenAstInference => true; |
| 48 | 51 |
| 49 @override | 52 @override |
| 50 void addFile(String content, {String name: '/main.dart'}) { | 53 void addFile(String content, {String name: '/main.dart'}) { |
| 51 addLibrarySource(name, content); | 54 addLibrarySource(name, content); |
| 52 } | 55 } |
| 53 | 56 |
| 54 @override | 57 @override |
| 55 CompilationUnitElement checkFile(String content) { | 58 CompilationUnitElement checkFile(String content) { |
| 56 Source source = addSource('/main.dart', content); | 59 Source source = addSource('/main.dart', content); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 72 @override | 75 @override |
| 73 DartSdk createDartSdk() => AbstractContextTest.SHARED_STRONG_MOCK_SDK; | 76 DartSdk createDartSdk() => AbstractContextTest.SHARED_STRONG_MOCK_SDK; |
| 74 | 77 |
| 75 @override | 78 @override |
| 76 AnalysisOptionsImpl createOptions() => new AnalysisOptionsImpl() | 79 AnalysisOptionsImpl createOptions() => new AnalysisOptionsImpl() |
| 77 ..enableGenericMethods = true | 80 ..enableGenericMethods = true |
| 78 ..strongMode = true; | 81 ..strongMode = true; |
| 79 | 82 |
| 80 @override | 83 @override |
| 81 @failingTest | 84 @failingTest |
| 82 void test_blockBodiedLambdas_async_allReturnsAreValues() { | 85 void test_blockBodiedLambdas_async_allReturnsAreFutures_topLevel() { |
| 83 super.test_blockBodiedLambdas_async_allReturnsAreValues(); | 86 super.test_blockBodiedLambdas_async_allReturnsAreFutures_topLevel(); |
| 84 } | 87 } |
| 85 | 88 |
| 86 @override | 89 @override |
| 87 @failingTest | 90 @failingTest |
| 88 void test_blockBodiedLambdas_async_alReturnsAreFutures() { | 91 void test_blockBodiedLambdas_async_allReturnsAreValues_topLevel() { |
| 89 super.test_blockBodiedLambdas_async_alReturnsAreFutures(); | 92 super.test_blockBodiedLambdas_async_allReturnsAreValues_topLevel(); |
| 90 } | 93 } |
| 91 | 94 |
| 92 @override | 95 @override |
| 93 @failingTest | 96 @failingTest |
| 94 void test_blockBodiedLambdas_async_mixOfValuesAndFutures() { | 97 void test_blockBodiedLambdas_async_mixOfValuesAndFutures_topLevel() { |
| 95 super.test_blockBodiedLambdas_async_mixOfValuesAndFutures(); | 98 super.test_blockBodiedLambdas_async_mixOfValuesAndFutures_topLevel(); |
| 96 } | 99 } |
| 97 | 100 |
| 98 @override | 101 @override |
| 99 @failingTest | 102 @failingTest |
| 100 void test_blockBodiedLambdas_asyncStar() { | 103 void test_blockBodiedLambdas_asyncStar_topLevel() { |
| 101 super.test_blockBodiedLambdas_asyncStar(); | 104 super.test_blockBodiedLambdas_asyncStar_topLevel(); |
| 102 } | 105 } |
| 103 | 106 |
| 104 @override | 107 @override |
| 105 @failingTest | 108 @failingTest |
| 106 void test_blockBodiedLambdas_basic_topLevel() { | 109 void test_blockBodiedLambdas_basic_topLevel() { |
| 107 super.test_blockBodiedLambdas_basic_topLevel(); | 110 super.test_blockBodiedLambdas_basic_topLevel(); |
| 108 } | 111 } |
| 109 | 112 |
| 110 @override | 113 @override |
| 111 @failingTest | 114 @failingTest |
| 112 void test_blockBodiedLambdas_doesNotInferBottom_async() { | 115 void test_blockBodiedLambdas_doesNotInferBottom_async_topLevel() { |
| 113 super.test_blockBodiedLambdas_doesNotInferBottom_async(); | 116 super.test_blockBodiedLambdas_doesNotInferBottom_async_topLevel(); |
| 114 } | 117 } |
| 115 | 118 |
| 116 @override | 119 @override |
| 117 @failingTest | 120 @failingTest |
| 118 void test_blockBodiedLambdas_doesNotInferBottom_asyncStar() { | 121 void test_blockBodiedLambdas_doesNotInferBottom_asyncStar_topLevel() { |
| 119 super.test_blockBodiedLambdas_doesNotInferBottom_asyncStar(); | 122 super.test_blockBodiedLambdas_doesNotInferBottom_asyncStar_topLevel(); |
| 120 } | 123 } |
| 121 | 124 |
| 122 @override | 125 @override |
| 123 @failingTest | 126 @failingTest |
| 124 void test_blockBodiedLambdas_doesNotInferBottom_sync() { | 127 void test_blockBodiedLambdas_doesNotInferBottom_sync_topLevel() { |
| 125 super.test_blockBodiedLambdas_doesNotInferBottom_sync(); | 128 super.test_blockBodiedLambdas_doesNotInferBottom_sync_topLevel(); |
| 126 } | 129 } |
| 127 | 130 |
| 128 @override | 131 @override |
| 129 @failingTest | 132 @failingTest |
| 130 void test_blockBodiedLambdas_doesNotInferBottom_syncStar() { | 133 void test_blockBodiedLambdas_doesNotInferBottom_syncStar_topLevel() { |
| 131 super.test_blockBodiedLambdas_doesNotInferBottom_syncStar(); | 134 super.test_blockBodiedLambdas_doesNotInferBottom_syncStar_topLevel(); |
| 132 } | 135 } |
| 133 | 136 |
| 134 @override | 137 @override |
| 135 @failingTest | |
| 136 void test_blockBodiedLambdas_downwardsIncompatibleWithUpwardsInference() { | |
| 137 super.test_blockBodiedLambdas_downwardsIncompatibleWithUpwardsInference(); | |
| 138 } | |
| 139 | |
| 140 @override | |
| 141 @failingTest | 138 @failingTest |
| 142 void test_blockBodiedLambdas_LUB_topLevel() { | 139 void test_blockBodiedLambdas_LUB_topLevel() { |
| 143 super.test_blockBodiedLambdas_LUB_topLevel(); | 140 super.test_blockBodiedLambdas_LUB_topLevel(); |
| 144 } | 141 } |
| 145 | 142 |
| 146 @override | 143 @override |
| 147 @failingTest | 144 @failingTest |
| 148 void test_blockBodiedLambdas_nestedLambdas() { | 145 void test_blockBodiedLambdas_nestedLambdas_topLevel() { |
| 149 super.test_blockBodiedLambdas_nestedLambdas(); | 146 super.test_blockBodiedLambdas_nestedLambdas_topLevel(); |
| 150 } | 147 } |
| 151 | 148 |
| 152 @override | 149 @override |
| 153 @failingTest | 150 @failingTest |
| 154 void test_blockBodiedLambdas_noReturn() { | 151 void test_blockBodiedLambdas_syncStar_topLevel() { |
| 155 super.test_blockBodiedLambdas_noReturn(); | 152 super.test_blockBodiedLambdas_syncStar_topLevel(); |
| 156 } | 153 } |
| 157 | 154 |
| 158 @override | 155 @override |
| 159 @failingTest | |
| 160 void test_blockBodiedLambdas_syncStar() { | |
| 161 super.test_blockBodiedLambdas_syncStar(); | |
| 162 } | |
| 163 | |
| 164 @override | |
| 165 @failingTest | 156 @failingTest |
| 166 void test_canInferAlsoFromStaticAndInstanceFieldsFlagOn() { | 157 void test_canInferAlsoFromStaticAndInstanceFieldsFlagOn() { |
| 167 super.test_canInferAlsoFromStaticAndInstanceFieldsFlagOn(); | 158 super.test_canInferAlsoFromStaticAndInstanceFieldsFlagOn(); |
| 168 } | 159 } |
| 169 | 160 |
| 170 @override | 161 @override |
| 171 @failingTest | 162 @failingTest |
| 172 void test_downwardsInferenceAnnotations() { | 163 void test_downwardsInferenceAnnotations() { |
| 173 super.test_downwardsInferenceAnnotations(); | 164 super.test_downwardsInferenceAnnotations(); |
| 174 } | 165 } |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 class C { | 604 class C { |
| 614 int m(int a, {String b, int c}) => null; | 605 int m(int a, {String b, int c}) => null; |
| 615 } | 606 } |
| 616 var v = new C().m(1, b: 'bbb', c: 2.0); | 607 var v = new C().m(1, b: 'bbb', c: 2.0); |
| 617 '''); | 608 '''); |
| 618 expect(unit.topLevelVariables[0].type.toString(), 'int'); | 609 expect(unit.topLevelVariables[0].type.toString(), 'int'); |
| 619 } | 610 } |
| 620 | 611 |
| 621 @override | 612 @override |
| 622 @failingTest | 613 @failingTest |
| 623 void test_listLiteralsShouldNotInferBottom() { | |
| 624 super.test_listLiteralsShouldNotInferBottom(); | |
| 625 } | |
| 626 | |
| 627 @override | |
| 628 @failingTest | |
| 629 void test_mapLiteralsShouldNotInferBottom() { | |
| 630 super.test_mapLiteralsShouldNotInferBottom(); | |
| 631 } | |
| 632 | |
| 633 @override | |
| 634 @failingTest | |
| 635 void test_nullLiteralShouldNotInferAsBottom() { | 614 void test_nullLiteralShouldNotInferAsBottom() { |
| 636 super.test_nullLiteralShouldNotInferAsBottom(); | 615 super.test_nullLiteralShouldNotInferAsBottom(); |
| 637 } | 616 } |
| 638 | 617 |
| 639 LibraryElementImpl _checkSource( | 618 LibraryElementImpl _checkSource( |
| 640 SummaryResynthesizer resynthesizer, Source source) { | 619 SummaryResynthesizer resynthesizer, Source source) { |
| 641 LibraryElementImpl resynthesized = | 620 LibraryElementImpl resynthesized = |
| 642 resynthesizer.getLibraryElement(source.uri.toString()); | 621 resynthesizer.getLibraryElement(source.uri.toString()); |
| 643 LibraryElementImpl original = context.computeLibraryElement(source); | 622 LibraryElementImpl original = context.computeLibraryElement(source); |
| 644 checkLibraryElements(original, resynthesized); | 623 checkLibraryElements(original, resynthesized); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 } | 805 } |
| 827 | 806 |
| 828 UnlinkedUnit definingUnit = _getUnlinkedUnit(librarySource); | 807 UnlinkedUnit definingUnit = _getUnlinkedUnit(librarySource); |
| 829 LinkedLibraryBuilder linkedLibrary = | 808 LinkedLibraryBuilder linkedLibrary = |
| 830 prelink(definingUnit, getPart, getImport); | 809 prelink(definingUnit, getPart, getImport); |
| 831 linkedLibrary.dependencies.skip(1).forEach((LinkedDependency d) { | 810 linkedLibrary.dependencies.skip(1).forEach((LinkedDependency d) { |
| 832 _serializeLibrary(resolveRelativeUri(d.uri)); | 811 _serializeLibrary(resolveRelativeUri(d.uri)); |
| 833 }); | 812 }); |
| 834 } | 813 } |
| 835 } | 814 } |
| OLD | NEW |