| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 T foo() => /*warning:DownCastImplicit*/null; | 160 T foo() => /*warning:DownCastImplicit*/null; |
| 161 | 161 |
| 162 void bar() { | 162 void bar() { |
| 163 int /*severe:InvalidVariableDeclaration*/x; | 163 int /*severe:InvalidVariableDeclaration*/x; |
| 164 num y; | 164 num y; |
| 165 // TODO(vsm): This should be a runtime check: | 165 // TODO(vsm): This should be a runtime check: |
| 166 // Transformed to: T z = cast(null, T) | 166 // Transformed to: T z = cast(null, T) |
| 167 T /*severe:InvalidVariableDeclaration*/z; | 167 T /*severe:InvalidVariableDeclaration*/z; |
| 168 } | 168 } |
| 169 | 169 |
| 170 void baz(T x, [T /*severe:InvalidVariableDeclaration*/y, T z = /*sever
e:StaticTypeError*/null]) { | 170 void baz(T x, [T /*severe:InvalidVariableDeclaration*/y, T z = /*warni
ng:DownCastImplicit*/null]) { |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 class B<T extends List> { | 174 class B<T extends List> { |
| 175 T x; | 175 T x; |
| 176 | 176 |
| 177 // T cannot be primitive. | 177 // T cannot be primitive. |
| 178 T foo() => null; | 178 T foo() => null; |
| 179 } | 179 } |
| 180 | 180 |
| (...skipping 2651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2832 f = bar as II2D; | 2832 f = bar as II2D; |
| 2833 f = bar as DD2I; | 2833 f = bar as DD2I; |
| 2834 f = bar as DI2D; | 2834 f = bar as DI2D; |
| 2835 f = bar as ID2D; | 2835 f = bar as ID2D; |
| 2836 f = bar as DD2D; | 2836 f = bar as DD2D; |
| 2837 } | 2837 } |
| 2838 ''' | 2838 ''' |
| 2839 }); | 2839 }); |
| 2840 }); | 2840 }); |
| 2841 } | 2841 } |
| OLD | NEW |