| 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'; |
| (...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1443 Expression exp = (statements[i] as ExpressionStatement).expression; | 1443 Expression exp = (statements[i] as ExpressionStatement).expression; |
| 1444 expect(exp.staticType, typeProvider.dynamicType); | 1444 expect(exp.staticType, typeProvider.dynamicType); |
| 1445 } | 1445 } |
| 1446 } | 1446 } |
| 1447 | 1447 |
| 1448 checkBody("C"); | 1448 checkBody("C"); |
| 1449 checkBody("D"); | 1449 checkBody("D"); |
| 1450 } | 1450 } |
| 1451 | 1451 |
| 1452 test_genericFunction_upwardsAndDownwards() async { | 1452 test_genericFunction_upwardsAndDownwards() async { |
| 1453 // Regression tests for https://github.com/dart-lang/sdk/issues/27151. | 1453 // Regression tests for https://github.com/dart-lang/sdk/issues/27586. |
| 1454 await resolveTestUnit(r'List<num> x = [1, 2];'); | 1454 await resolveTestUnit(r'List<num> x = [1, 2];'); |
| 1455 expectInitializerType('x', 'List<int>'); | 1455 expectInitializerType('x', 'List<num>'); |
| 1456 } | 1456 } |
| 1457 | 1457 |
| 1458 test_genericFunction_upwardsAndDownwards_Object() async { |
| 1459 // Regression tests for https://github.com/dart-lang/sdk/issues/27625. |
| 1460 await resolveTestUnit(r''' |
| 1461 List<Object> aaa = []; |
| 1462 List<Object> bbb = [1, 2, 3]; |
| 1463 List<Object> ccc = [null]; |
| 1464 List<Object> ddd = [1 as dynamic]; |
| 1465 List<Object> eee = [new Object()]; |
| 1466 '''); |
| 1467 expectInitializerType('aaa', 'List<Object>'); |
| 1468 expectInitializerType('bbb', 'List<Object>'); |
| 1469 expectInitializerType('ccc', 'List<Object>'); |
| 1470 expectInitializerType('ddd', 'List<Object>'); |
| 1471 expectInitializerType('eee', 'List<Object>'); |
| 1472 } |
| 1473 |
| 1474 |
| 1458 test_genericMethod() async { | 1475 test_genericMethod() async { |
| 1459 await resolveTestUnit(r''' | 1476 await resolveTestUnit(r''' |
| 1460 class C<E> { | 1477 class C<E> { |
| 1461 List/*<T>*/ f/*<T>*/(E e) => null; | 1478 List/*<T>*/ f/*<T>*/(E e) => null; |
| 1462 } | 1479 } |
| 1463 main() { | 1480 main() { |
| 1464 C<String> cOfString; | 1481 C<String> cOfString; |
| 1465 } | 1482 } |
| 1466 '''); | 1483 '''); |
| 1467 expectFunctionType('f', '<T>(E) → List<T>', | 1484 expectFunctionType('f', '<T>(E) → List<T>', |
| (...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2412 main() { | 2429 main() { |
| 2413 var v = x; | 2430 var v = x; |
| 2414 v; // marker | 2431 v; // marker |
| 2415 } | 2432 } |
| 2416 int x = 3; | 2433 int x = 3; |
| 2417 '''; | 2434 '''; |
| 2418 await assertPropagatedAssignedType(code, typeProvider.intType, null); | 2435 await assertPropagatedAssignedType(code, typeProvider.intType, null); |
| 2419 await assertTypeOfMarkedExpression(code, typeProvider.intType, null); | 2436 await assertTypeOfMarkedExpression(code, typeProvider.intType, null); |
| 2420 } | 2437 } |
| 2421 } | 2438 } |
| OLD | NEW |