| 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 ddc.test.checker_test; | 6 library ddc.test.checker_test; |
| 7 | 7 |
| 8 import 'package:unittest/compact_vm_config.dart'; | 8 import 'package:unittest/compact_vm_config.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // num is nullable | 78 // num is nullable |
| 79 z = null; | 79 z = null; |
| 80 z = x; | 80 z = x; |
| 81 z = y; | 81 z = y; |
| 82 | 82 |
| 83 // bool is nullable | 83 // bool is nullable |
| 84 b = null; | 84 b = null; |
| 85 b = true; | 85 b = true; |
| 86 } | 86 } |
| 87 ''' | 87 ''' |
| 88 }); | 88 }, nonnullableTypes: <String>['int', 'double']); |
| 89 }); | 89 }); |
| 90 | 90 |
| 91 test('Primitives and generics', () { | 91 test('Primitives and generics', () { |
| 92 testChecker({ | 92 testChecker({ |
| 93 '/main.dart': ''' | 93 '/main.dart': ''' |
| 94 class A<T> { | 94 class A<T> { |
| 95 // TODO(vsm): This needs a static info indicating a runtime | 95 // TODO(vsm): This needs a static info indicating a runtime |
| 96 // check at construction. | 96 // check at construction. |
| 97 T x; | 97 T x; |
| 98 | 98 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 120 | 120 |
| 121 class C<T extends num> { | 121 class C<T extends num> { |
| 122 // TODO(vsm): This needs a static info indicating a runtime | 122 // TODO(vsm): This needs a static info indicating a runtime |
| 123 // check at construction. | 123 // check at construction. |
| 124 T x; | 124 T x; |
| 125 | 125 |
| 126 // TODO(vsm): Should this be a different type of DownCast? | 126 // TODO(vsm): Should this be a different type of DownCast? |
| 127 T foo() => /*warning:DownCastLiteral*/null; | 127 T foo() => /*warning:DownCastLiteral*/null; |
| 128 } | 128 } |
| 129 ''' | 129 ''' |
| 130 }); | 130 }, nonnullableTypes: <String>['int', 'double']); |
| 131 }); | 131 }); |
| 132 | 132 |
| 133 test('Constructors', () { | 133 test('Constructors', () { |
| 134 testChecker({ | 134 testChecker({ |
| 135 '/main.dart': ''' | 135 '/main.dart': ''' |
| 136 const num z = 25; | 136 const num z = 25; |
| 137 Object obj = "world"; | 137 Object obj = "world"; |
| 138 | 138 |
| 139 class A { | 139 class A { |
| 140 int x; | 140 int x; |
| (...skipping 2563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2704 '/main.dart': ''' | 2704 '/main.dart': ''' |
| 2705 class A {} | 2705 class A {} |
| 2706 class T1 implements A { | 2706 class T1 implements A { |
| 2707 /*severe:InferableOverride*/toString() {} | 2707 /*severe:InferableOverride*/toString() {} |
| 2708 } | 2708 } |
| 2709 ''' | 2709 ''' |
| 2710 }, inferFromOverrides: false); | 2710 }, inferFromOverrides: false); |
| 2711 }); | 2711 }); |
| 2712 }); | 2712 }); |
| 2713 } | 2713 } |
| OLD | NEW |