| 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.generated.strong_mode_test; | 5 library analyzer.test.generated.strong_mode_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/ast/standard_resolution_map.dart'; | 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| 11 import 'package:analyzer/dart/element/element.dart'; | 11 import 'package:analyzer/dart/element/element.dart'; |
| 12 import 'package:analyzer/dart/element/type.dart'; | 12 import 'package:analyzer/dart/element/type.dart'; |
| 13 import 'package:analyzer/src/dart/element/element.dart'; | 13 import 'package:analyzer/src/dart/element/element.dart'; |
| 14 import 'package:analyzer/src/error/codes.dart'; | 14 import 'package:analyzer/src/error/codes.dart'; |
| 15 import 'package:analyzer/src/generated/engine.dart'; | 15 import 'package:analyzer/src/generated/engine.dart'; |
| 16 import 'package:analyzer/src/generated/source_io.dart'; | 16 import 'package:analyzer/src/generated/source_io.dart'; |
| 17 import 'package:test/test.dart'; | 17 import 'package:test/test.dart'; |
| 18 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 18 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 19 | 19 |
| 20 import '../utils.dart'; | 20 import '../utils.dart'; |
| 21 import 'resolver_test_case.dart'; | 21 import 'resolver_test_case.dart'; |
| 22 | 22 |
| 23 main() { | 23 main() { |
| 24 defineReflectiveSuite(() { | 24 defineReflectiveSuite(() { |
| 25 defineReflectiveTests(StrongModeDownwardsInferenceTest); | 25 defineReflectiveTests(StrongModeDownwardsInferenceTest); |
| 26 defineReflectiveTests(StrongModeStaticTypeAnalyzer2Test); | 26 defineReflectiveTests(StrongModeStaticTypeAnalyzer2Test); |
| 27 defineReflectiveTests(StrongModeTypePropagationTest); | 27 defineReflectiveTests(StrongModeTypePropagationTest); |
| 28 defineReflectiveTests(StrongModeDownwardsInferenceTest_Driver); | |
| 29 defineReflectiveTests(StrongModeStaticTypeAnalyzer2Test_Driver); | |
| 30 defineReflectiveTests(StrongModeTypePropagationTest_Driver); | |
| 31 }); | 28 }); |
| 32 } | 29 } |
| 33 | 30 |
| 34 /** | 31 /** |
| 35 * Strong mode static analyzer downwards inference tests | 32 * Strong mode static analyzer downwards inference tests |
| 36 */ | 33 */ |
| 37 @reflectiveTest | 34 @reflectiveTest |
| 38 class StrongModeDownwardsInferenceTest extends ResolverTestCase { | 35 class StrongModeDownwardsInferenceTest extends ResolverTestCase { |
| 39 TypeAssertions _assertions; | 36 TypeAssertions _assertions; |
| 40 | 37 |
| (...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 } | 1287 } |
| 1291 | 1288 |
| 1292 check("f0", _isListOf(_isDynamic)); | 1289 check("f0", _isListOf(_isDynamic)); |
| 1293 check("f1", _isListOf(_isDynamic)); | 1290 check("f1", _isListOf(_isDynamic)); |
| 1294 | 1291 |
| 1295 check("f2", _isListOf(_isInt)); | 1292 check("f2", _isListOf(_isInt)); |
| 1296 check("f3", _isListOf((DartType type) => _isListOf(_isInt)(type))); | 1293 check("f3", _isListOf((DartType type) => _isListOf(_isInt)(type))); |
| 1297 } | 1294 } |
| 1298 } | 1295 } |
| 1299 | 1296 |
| 1300 @reflectiveTest | |
| 1301 class StrongModeDownwardsInferenceTest_Driver | |
| 1302 extends StrongModeDownwardsInferenceTest { | |
| 1303 @override | |
| 1304 bool get enableNewAnalysisDriver => true; | |
| 1305 | |
| 1306 @failingTest | |
| 1307 @override | |
| 1308 test_inference_hints() { | |
| 1309 return super.test_inference_hints(); | |
| 1310 } | |
| 1311 } | |
| 1312 | |
| 1313 /** | 1297 /** |
| 1314 * Strong mode static analyzer end to end tests | 1298 * Strong mode static analyzer end to end tests |
| 1315 */ | 1299 */ |
| 1316 @reflectiveTest | 1300 @reflectiveTest |
| 1317 class StrongModeStaticTypeAnalyzer2Test extends StaticTypeAnalyzer2TestShared { | 1301 class StrongModeStaticTypeAnalyzer2Test extends StaticTypeAnalyzer2TestShared { |
| 1318 fail_genericMethod_tearoff_instantiated() async { | 1302 fail_genericMethod_tearoff_instantiated() async { |
| 1319 await resolveTestUnit(r''' | 1303 await resolveTestUnit(r''' |
| 1320 class C<E> { | 1304 class C<E> { |
| 1321 /*=T*/ f/*<T>*/(E e) => null; | 1305 /*=T*/ f/*<T>*/(E e) => null; |
| 1322 static /*=T*/ g/*<T>*/(/*=T*/ e) => null; | 1306 static /*=T*/ g/*<T>*/(/*=T*/ e) => null; |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2182 expectIdentifierType('t0', "String"); | 2166 expectIdentifierType('t0', "String"); |
| 2183 expectIdentifierType('t1', "() → String"); | 2167 expectIdentifierType('t1', "() → String"); |
| 2184 expectIdentifierType('t2', "int"); | 2168 expectIdentifierType('t2', "int"); |
| 2185 expectIdentifierType('t3', "String"); | 2169 expectIdentifierType('t3', "String"); |
| 2186 expectIdentifierType('t4', "() → String"); | 2170 expectIdentifierType('t4', "() → String"); |
| 2187 expectIdentifierType('t5', "int"); | 2171 expectIdentifierType('t5', "int"); |
| 2188 } | 2172 } |
| 2189 } | 2173 } |
| 2190 | 2174 |
| 2191 @reflectiveTest | 2175 @reflectiveTest |
| 2192 class StrongModeStaticTypeAnalyzer2Test_Driver | |
| 2193 extends StrongModeStaticTypeAnalyzer2Test { | |
| 2194 @override | |
| 2195 bool get enableNewAnalysisDriver => true; | |
| 2196 | |
| 2197 @failingTest | |
| 2198 @override | |
| 2199 test_genericFunction_parameter() { | |
| 2200 return super.test_genericFunction_parameter(); | |
| 2201 } | |
| 2202 | |
| 2203 @failingTest | |
| 2204 @override | |
| 2205 test_genericMethod_functionExpressionInvocation_explicit() { | |
| 2206 return super.test_genericMethod_functionExpressionInvocation_explicit(); | |
| 2207 } | |
| 2208 | |
| 2209 @failingTest | |
| 2210 @override | |
| 2211 test_genericMethod_functionExpressionInvocation_inferred() { | |
| 2212 return super.test_genericMethod_functionExpressionInvocation_inferred(); | |
| 2213 } | |
| 2214 | |
| 2215 @failingTest | |
| 2216 @override | |
| 2217 test_genericMethod_functionInvocation_explicit() { | |
| 2218 return super.test_genericMethod_functionInvocation_explicit(); | |
| 2219 } | |
| 2220 | |
| 2221 @failingTest | |
| 2222 @override | |
| 2223 test_genericMethod_functionInvocation_inferred() { | |
| 2224 return super.test_genericMethod_functionInvocation_inferred(); | |
| 2225 } | |
| 2226 | |
| 2227 @failingTest | |
| 2228 @override | |
| 2229 test_genericMethod_tearoff() { | |
| 2230 return super.test_genericMethod_tearoff(); | |
| 2231 } | |
| 2232 } | |
| 2233 | |
| 2234 @reflectiveTest | |
| 2235 class StrongModeTypePropagationTest extends ResolverTestCase { | 2176 class StrongModeTypePropagationTest extends ResolverTestCase { |
| 2236 @override | 2177 @override |
| 2237 void setUp() { | 2178 void setUp() { |
| 2238 super.setUp(); | 2179 super.setUp(); |
| 2239 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | 2180 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 2240 options.strongMode = true; | 2181 options.strongMode = true; |
| 2241 resetWith(options: options); | 2182 resetWith(options: options); |
| 2242 } | 2183 } |
| 2243 | 2184 |
| 2244 test_foreachInference_dynamic_disabled() async { | 2185 test_foreachInference_dynamic_disabled() async { |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2471 main() { | 2412 main() { |
| 2472 var v = x; | 2413 var v = x; |
| 2473 v; // marker | 2414 v; // marker |
| 2474 } | 2415 } |
| 2475 int x = 3; | 2416 int x = 3; |
| 2476 '''; | 2417 '''; |
| 2477 await assertPropagatedAssignedType(code, typeProvider.intType, null); | 2418 await assertPropagatedAssignedType(code, typeProvider.intType, null); |
| 2478 await assertTypeOfMarkedExpression(code, typeProvider.intType, null); | 2419 await assertTypeOfMarkedExpression(code, typeProvider.intType, null); |
| 2479 } | 2420 } |
| 2480 } | 2421 } |
| 2481 | |
| 2482 @reflectiveTest | |
| 2483 class StrongModeTypePropagationTest_Driver | |
| 2484 extends StrongModeTypePropagationTest { | |
| 2485 @override | |
| 2486 bool get enableNewAnalysisDriver => true; | |
| 2487 } | |
| OLD | NEW |