| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// General type checking tests | 5 /// General type checking tests |
| 6 library dev_compiler.test.checker_test; | 6 library dev_compiler.test.checker_test; |
| 7 | 7 |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 | 9 |
| 10 import 'package:dev_compiler/src/testing.dart'; | 10 import 'package:dev_compiler/src/testing.dart'; |
| (...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1402 }); | 1402 }); |
| 1403 | 1403 |
| 1404 test('Relaxed casts', () { | 1404 test('Relaxed casts', () { |
| 1405 testChecker({ | 1405 testChecker({ |
| 1406 '/main.dart': ''' | 1406 '/main.dart': ''' |
| 1407 | 1407 |
| 1408 class A {} | 1408 class A {} |
| 1409 | 1409 |
| 1410 class L<T> {} | 1410 class L<T> {} |
| 1411 class M<T> extends L<T> {} | 1411 class M<T> extends L<T> {} |
| 1412 // L<dynamic> | 1412 // L<dynamic|Object> |
| 1413 // / \ | 1413 // / \ |
| 1414 // M<dynamic> L<Object> | 1414 // M<dynamic|Object> L<A> |
| 1415 // | / / | 1415 // \ / |
| 1416 // M<Object> L<A> | 1416 // M<A> |
| 1417 // \ / | |
| 1418 // M<A> | |
| 1419 // In normal Dart, there are additional edges | 1417 // In normal Dart, there are additional edges |
| 1420 // from M<A> to M<dynamic> | 1418 // from M<A> to M<dynamic> |
| 1421 // from L<Object> to M<dynamic> | |
| 1422 // from L<Object> to L<dynamic> | |
| 1423 // from L<A> to M<dynamic> | 1419 // from L<A> to M<dynamic> |
| 1424 // from L<A> to L<dynamic> | 1420 // from L<A> to L<dynamic> |
| 1425 void main() { | 1421 void main() { |
| 1426 L lOfDs; | 1422 L lOfDs; |
| 1427 L<Object> lOfOs; | 1423 L<Object> lOfOs; |
| 1428 L<A> lOfAs; | 1424 L<A> lOfAs; |
| 1429 | 1425 |
| 1430 M mOfDs; | 1426 M mOfDs; |
| 1431 M<Object> mOfOs; | 1427 M<Object> mOfOs; |
| 1432 M<A> mOfAs; | 1428 M<A> mOfAs; |
| 1433 | 1429 |
| 1434 { | 1430 { |
| 1435 lOfDs = mOfDs; | 1431 lOfDs = mOfDs; |
| 1436 lOfDs = mOfOs; | 1432 lOfDs = mOfOs; |
| 1437 lOfDs = mOfAs; | 1433 lOfDs = mOfAs; |
| 1438 lOfDs = lOfDs; | 1434 lOfDs = lOfDs; |
| 1439 lOfDs = lOfOs; | 1435 lOfDs = lOfOs; |
| 1440 lOfDs = lOfAs; | 1436 lOfDs = lOfAs; |
| 1441 } | 1437 } |
| 1442 { | 1438 { |
| 1443 lOfOs = /*warning:DownCastDynamic*/mOfDs; | 1439 lOfOs = mOfDs; |
| 1444 lOfOs = mOfOs; | 1440 lOfOs = mOfOs; |
| 1445 lOfOs = mOfAs; | 1441 lOfOs = mOfAs; |
| 1446 lOfOs = /*warning:DownCastDynamic*/lOfDs; | 1442 lOfOs = lOfDs; |
| 1447 lOfOs = lOfOs; | 1443 lOfOs = lOfOs; |
| 1448 lOfOs = lOfAs; | 1444 lOfOs = lOfAs; |
| 1449 } | 1445 } |
| 1450 { | 1446 { |
| 1451 lOfAs = /*warning:DownCastDynamic*/mOfDs; | 1447 lOfAs = /*warning:DownCastDynamic*/mOfDs; |
| 1452 lOfAs = /*severe:StaticTypeError*/mOfOs; | 1448 lOfAs = /*severe:StaticTypeError*/mOfOs; |
| 1453 lOfAs = mOfAs; | 1449 lOfAs = mOfAs; |
| 1454 lOfAs = /*warning:DownCastDynamic*/lOfDs; | 1450 lOfAs = /*warning:DownCastDynamic*/lOfDs; |
| 1455 lOfAs = /*info:DownCast*/lOfOs; | 1451 lOfAs = /*info:DownCast*/lOfOs; |
| 1456 lOfAs = lOfAs; | 1452 lOfAs = lOfAs; |
| 1457 } | 1453 } |
| 1458 { | 1454 { |
| 1459 mOfDs = mOfDs; | 1455 mOfDs = mOfDs; |
| 1460 mOfDs = mOfOs; | 1456 mOfDs = mOfOs; |
| 1461 mOfDs = mOfAs; | 1457 mOfDs = mOfAs; |
| 1462 mOfDs = /*info:DownCast*/lOfDs; | 1458 mOfDs = /*info:DownCast*/lOfDs; |
| 1463 mOfDs = /*info:DownCast*/lOfOs; | 1459 mOfDs = /*info:DownCast*/lOfOs; |
| 1464 mOfDs = /*info:DownCast*/lOfAs; | 1460 mOfDs = /*info:DownCast*/lOfAs; |
| 1465 } | 1461 } |
| 1466 { | 1462 { |
| 1467 mOfOs = /*warning:DownCastDynamic*/mOfDs; | 1463 mOfOs = mOfDs; |
| 1468 mOfOs = mOfOs; | 1464 mOfOs = mOfOs; |
| 1469 mOfOs = mOfAs; | 1465 mOfOs = mOfAs; |
| 1470 mOfOs = /*info:DownCast*/lOfDs; | 1466 mOfOs = /*info:DownCast*/lOfDs; |
| 1471 mOfOs = /*info:DownCast*/lOfOs; | 1467 mOfOs = /*info:DownCast*/lOfOs; |
| 1472 mOfOs = /*severe:StaticTypeError*/lOfAs; | 1468 mOfOs = /*severe:StaticTypeError*/lOfAs; |
| 1473 } | 1469 } |
| 1474 { | 1470 { |
| 1475 mOfAs = /*warning:DownCastDynamic*/mOfDs; | 1471 mOfAs = /*warning:DownCastDynamic*/mOfDs; |
| 1476 mOfAs = /*info:DownCast*/mOfOs; | 1472 mOfAs = /*info:DownCast*/mOfOs; |
| 1477 mOfAs = mOfAs; | 1473 mOfAs = mOfAs; |
| (...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2803 f = bar as II2D; | 2799 f = bar as II2D; |
| 2804 f = bar as DD2I; | 2800 f = bar as DD2I; |
| 2805 f = bar as DI2D; | 2801 f = bar as DI2D; |
| 2806 f = bar as ID2D; | 2802 f = bar as ID2D; |
| 2807 f = bar as DD2D; | 2803 f = bar as DD2D; |
| 2808 } | 2804 } |
| 2809 ''' | 2805 ''' |
| 2810 }); | 2806 }); |
| 2811 }); | 2807 }); |
| 2812 } | 2808 } |
| OLD | NEW |