| 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 '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/dart/element/type.dart'; | 9 import 'package:analyzer/dart/element/type.dart'; |
| 10 import 'package:analyzer/src/dart/element/element.dart'; | 10 import 'package:analyzer/src/dart/element/element.dart'; |
| (...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1443 for (int i = 1; i <= 5; i++) { | 1443 for (int i = 1; i <= 5; i++) { |
| 1444 Expression exp = (statements[i] as ExpressionStatement).expression; | 1444 Expression exp = (statements[i] as ExpressionStatement).expression; |
| 1445 expect(exp.staticType, typeProvider.dynamicType); | 1445 expect(exp.staticType, typeProvider.dynamicType); |
| 1446 } | 1446 } |
| 1447 } | 1447 } |
| 1448 | 1448 |
| 1449 checkBody("C"); | 1449 checkBody("C"); |
| 1450 checkBody("D"); | 1450 checkBody("D"); |
| 1451 } | 1451 } |
| 1452 | 1452 |
| 1453 void test_genericFunction_upwardsAndDownwards() { |
| 1454 // Regression tests for https://github.com/dart-lang/sdk/issues/27151. |
| 1455 resolveTestUnit(r'List<num> x = [1, 2];'); |
| 1456 expectInitializerType('x', 'List<int>'); |
| 1457 } |
| 1458 |
| 1453 void test_genericMethod() { | 1459 void test_genericMethod() { |
| 1454 resolveTestUnit(r''' | 1460 resolveTestUnit(r''' |
| 1455 class C<E> { | 1461 class C<E> { |
| 1456 List/*<T>*/ f/*<T>*/(E e) => null; | 1462 List/*<T>*/ f/*<T>*/(E e) => null; |
| 1457 } | 1463 } |
| 1458 main() { | 1464 main() { |
| 1459 C<String> cOfString; | 1465 C<String> cOfString; |
| 1460 } | 1466 } |
| 1461 '''); | 1467 '''); |
| 1462 expectFunctionType('f', '<T>(E) → List<T>', | 1468 expectFunctionType('f', '<T>(E) → List<T>', |
| (...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2402 main() { | 2408 main() { |
| 2403 var v = x; | 2409 var v = x; |
| 2404 v; // marker | 2410 v; // marker |
| 2405 } | 2411 } |
| 2406 int x = 3; | 2412 int x = 3; |
| 2407 '''; | 2413 '''; |
| 2408 assertPropagatedAssignedType(code, typeProvider.intType, null); | 2414 assertPropagatedAssignedType(code, typeProvider.intType, null); |
| 2409 assertTypeOfMarkedExpression(code, typeProvider.intType, null); | 2415 assertTypeOfMarkedExpression(code, typeProvider.intType, null); |
| 2410 } | 2416 } |
| 2411 } | 2417 } |
| OLD | NEW |