Chromium Code Reviews| Index: pkg/analyzer/test/generated/strong_mode_test.dart |
| diff --git a/pkg/analyzer/test/generated/strong_mode_test.dart b/pkg/analyzer/test/generated/strong_mode_test.dart |
| index 6bb7778be9ea5ea0b229851598a16a95a88880ca..074d804b23128b2f4848b41afc1e40eff8e554b1 100644 |
| --- a/pkg/analyzer/test/generated/strong_mode_test.dart |
| +++ b/pkg/analyzer/test/generated/strong_mode_test.dart |
| @@ -57,11 +57,8 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase { |
| AsserterBuilder<DartType, DartType> _hasElementOf; |
| @override |
| - void setUp() { |
| - super.setUp(); |
| - AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| - options.strongMode = true; |
| - resetWith(options: options); |
| + Future<TestAnalysisResult> computeAnalysisResult(Source source) async { |
|
Brian Wilkerson
2017/01/23 20:50:34
I assume that none of the initializations that wer
scheglov
2017/01/23 21:26:33
They are not, but it is still wasteful.
I changed
|
| + TestAnalysisResult result = await super.computeAnalysisResult(source); |
| _assertions = new TypeAssertions(typeProvider); |
| _isType = _assertions.isType; |
| _hasElement = _assertions.hasElement; |
| @@ -78,6 +75,15 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase { |
| _isFutureOfDynamic = _isFutureOf([_isDynamic]); |
| _isFutureOfInt = _isFutureOf([_isInt]); |
| _isStreamOf = _isInstantiationOf(_hasElementOf(typeProvider.streamType)); |
| + return result; |
| + } |
| + |
| + @override |
| + void setUp() { |
| + super.setUp(); |
| + AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| + options.strongMode = true; |
| + resetWith(options: options); |
| } |
| test_async_method_propagation() async { |
| @@ -2353,8 +2359,9 @@ main() { |
| v; // marker |
| } |
| }'''; |
| - await assertPropagatedIterationType(code, typeProvider.dynamicType, null); |
| - await assertTypeOfMarkedExpression(code, typeProvider.dynamicType, null); |
| + CompilationUnit unit = await resolveSource(code); |
| + assertPropagatedIterationType(code, unit, typeProvider.dynamicType, null); |
| + assertTypeOfMarkedExpression(code, unit, typeProvider.dynamicType, null); |
| } |
| test_foreachInference_reusedVar_disabled() async { |
| @@ -2366,8 +2373,9 @@ main() { |
| v; // marker |
| } |
| }'''; |
| - await assertPropagatedIterationType(code, typeProvider.dynamicType, null); |
| - await assertTypeOfMarkedExpression(code, typeProvider.dynamicType, null); |
| + CompilationUnit unit = await resolveSource(code); |
| + assertPropagatedIterationType(code, unit, typeProvider.dynamicType, null); |
| + assertTypeOfMarkedExpression(code, unit, typeProvider.dynamicType, null); |
| } |
| test_foreachInference_var() async { |
| @@ -2378,8 +2386,9 @@ main() { |
| v; // marker |
| } |
| }'''; |
| - await assertPropagatedIterationType(code, typeProvider.intType, null); |
| - await assertTypeOfMarkedExpression(code, typeProvider.intType, null); |
| + CompilationUnit unit = await resolveSource(code); |
| + assertPropagatedIterationType(code, unit, typeProvider.intType, null); |
| + assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null); |
| } |
| test_foreachInference_var_iterable() async { |
| @@ -2390,8 +2399,9 @@ main() { |
| v; // marker |
| } |
| }'''; |
| - await assertPropagatedIterationType(code, typeProvider.intType, null); |
| - await assertTypeOfMarkedExpression(code, typeProvider.intType, null); |
| + CompilationUnit unit = await resolveSource(code); |
| + assertPropagatedIterationType(code, unit, typeProvider.intType, null); |
| + assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null); |
| } |
| test_foreachInference_var_stream() async { |
| @@ -2403,8 +2413,9 @@ main() async { |
| v; // marker |
| } |
| }'''; |
| - await assertPropagatedIterationType(code, typeProvider.intType, null); |
| - await assertTypeOfMarkedExpression(code, typeProvider.intType, null); |
| + CompilationUnit unit = await resolveSource(code); |
| + assertPropagatedIterationType(code, unit, typeProvider.intType, null); |
| + assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null); |
| } |
| test_localVariableInference_bottom_disabled() async { |
| @@ -2413,8 +2424,9 @@ main() { |
| var v = null; |
| v; // marker |
| }'''; |
| - await assertPropagatedAssignedType(code, typeProvider.dynamicType, null); |
| - await assertTypeOfMarkedExpression(code, typeProvider.dynamicType, null); |
| + CompilationUnit unit = await resolveSource(code); |
| + assertPropagatedAssignedType(code, unit, typeProvider.dynamicType, null); |
| + assertTypeOfMarkedExpression(code, unit, typeProvider.dynamicType, null); |
| } |
| test_localVariableInference_constant() async { |
| @@ -2423,8 +2435,9 @@ main() { |
| var v = 3; |
| v; // marker |
| }'''; |
| - await assertPropagatedAssignedType(code, typeProvider.intType, null); |
| - await assertTypeOfMarkedExpression(code, typeProvider.intType, null); |
| + CompilationUnit unit = await resolveSource(code); |
| + assertPropagatedAssignedType(code, unit, typeProvider.intType, null); |
| + assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null); |
| } |
| test_localVariableInference_declaredType_disabled() async { |
| @@ -2433,8 +2446,9 @@ main() { |
| dynamic v = 3; |
| v; // marker |
| }'''; |
| - await assertPropagatedAssignedType(code, typeProvider.dynamicType, null); |
| - await assertTypeOfMarkedExpression(code, typeProvider.dynamicType, null); |
| + CompilationUnit unit = await resolveSource(code); |
| + assertPropagatedAssignedType(code, unit, typeProvider.dynamicType, null); |
| + assertTypeOfMarkedExpression(code, unit, typeProvider.dynamicType, null); |
| } |
| test_localVariableInference_noInitializer_disabled() async { |
| @@ -2444,8 +2458,9 @@ main() { |
| v = 3; |
| v; // marker |
| }'''; |
| - await assertPropagatedAssignedType(code, typeProvider.dynamicType, null); |
| - await assertTypeOfMarkedExpression(code, typeProvider.dynamicType, null); |
| + CompilationUnit unit = await resolveSource(code); |
| + assertPropagatedAssignedType(code, unit, typeProvider.dynamicType, null); |
| + assertTypeOfMarkedExpression(code, unit, typeProvider.dynamicType, null); |
| } |
| test_localVariableInference_transitive_field_inferred_lexical() async { |
| @@ -2460,8 +2475,9 @@ class A { |
| main() { |
| } |
| '''; |
| - await assertPropagatedAssignedType(code, typeProvider.intType, null); |
| - await assertTypeOfMarkedExpression(code, typeProvider.intType, null); |
| + CompilationUnit unit = await resolveSource(code); |
| + assertPropagatedAssignedType(code, unit, typeProvider.intType, null); |
| + assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null); |
| } |
| test_localVariableInference_transitive_field_inferred_reversed() async { |
| @@ -2476,8 +2492,9 @@ class A { |
| main() { |
| } |
| '''; |
| - await assertPropagatedAssignedType(code, typeProvider.intType, null); |
| - await assertTypeOfMarkedExpression(code, typeProvider.intType, null); |
| + CompilationUnit unit = await resolveSource(code); |
| + assertPropagatedAssignedType(code, unit, typeProvider.intType, null); |
| + assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null); |
| } |
| test_localVariableInference_transitive_field_lexical() async { |
| @@ -2492,8 +2509,9 @@ class A { |
| main() { |
| } |
| '''; |
| - await assertPropagatedAssignedType(code, typeProvider.intType, null); |
| - await assertTypeOfMarkedExpression(code, typeProvider.intType, null); |
| + CompilationUnit unit = await resolveSource(code); |
| + assertPropagatedAssignedType(code, unit, typeProvider.intType, null); |
| + assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null); |
| } |
| test_localVariableInference_transitive_field_reversed() async { |
| @@ -2508,8 +2526,9 @@ class A { |
| main() { |
| } |
| '''; |
| - await assertPropagatedAssignedType(code, typeProvider.intType, null); |
| - await assertTypeOfMarkedExpression(code, typeProvider.intType, null); |
| + CompilationUnit unit = await resolveSource(code); |
| + assertPropagatedAssignedType(code, unit, typeProvider.intType, null); |
| + assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null); |
| } |
| test_localVariableInference_transitive_list_local() async { |
| @@ -2519,8 +2538,9 @@ main() { |
| var v = x[0]; |
| v; // marker |
| }'''; |
| - await assertPropagatedAssignedType(code, typeProvider.intType, null); |
| - await assertTypeOfMarkedExpression(code, typeProvider.intType, null); |
| + CompilationUnit unit = await resolveSource(code); |
| + assertPropagatedAssignedType(code, unit, typeProvider.intType, null); |
| + assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null); |
| } |
| test_localVariableInference_transitive_local() async { |
| @@ -2530,8 +2550,9 @@ main() { |
| var v = x; |
| v; // marker |
| }'''; |
| - await assertPropagatedAssignedType(code, typeProvider.intType, null); |
| - await assertTypeOfMarkedExpression(code, typeProvider.intType, null); |
| + CompilationUnit unit = await resolveSource(code); |
| + assertPropagatedAssignedType(code, unit, typeProvider.intType, null); |
| + assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null); |
| } |
| test_localVariableInference_transitive_toplevel_inferred_lexical() async { |
| @@ -2542,8 +2563,9 @@ main() { |
| v; // marker |
| } |
| '''; |
| - await assertPropagatedAssignedType(code, typeProvider.intType, null); |
| - await assertTypeOfMarkedExpression(code, typeProvider.intType, null); |
| + CompilationUnit unit = await resolveSource(code); |
| + assertPropagatedAssignedType(code, unit, typeProvider.intType, null); |
| + assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null); |
| } |
| test_localVariableInference_transitive_toplevel_inferred_reversed() async { |
| @@ -2554,8 +2576,9 @@ main() { |
| } |
| final x = 3; |
| '''; |
| - await assertPropagatedAssignedType(code, typeProvider.intType, null); |
| - await assertTypeOfMarkedExpression(code, typeProvider.intType, null); |
| + CompilationUnit unit = await resolveSource(code); |
| + assertPropagatedAssignedType(code, unit, typeProvider.intType, null); |
| + assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null); |
| } |
| test_localVariableInference_transitive_toplevel_lexical() async { |
| @@ -2566,8 +2589,9 @@ main() { |
| v; // marker |
| } |
| '''; |
| - await assertPropagatedAssignedType(code, typeProvider.intType, null); |
| - await assertTypeOfMarkedExpression(code, typeProvider.intType, null); |
| + CompilationUnit unit = await resolveSource(code); |
| + assertPropagatedAssignedType(code, unit, typeProvider.intType, null); |
| + assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null); |
| } |
| test_localVariableInference_transitive_toplevel_reversed() async { |
| @@ -2578,7 +2602,8 @@ main() { |
| } |
| int x = 3; |
| '''; |
| - await assertPropagatedAssignedType(code, typeProvider.intType, null); |
| - await assertTypeOfMarkedExpression(code, typeProvider.intType, null); |
| + CompilationUnit unit = await resolveSource(code); |
| + assertPropagatedAssignedType(code, unit, typeProvider.intType, null); |
| + assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null); |
| } |
| } |