| 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 /// Tests for type inference. | 5 /// Tests for type inference. |
| 6 library dev_compiler.test.inferred_type_test; | 6 library dev_compiler.test.inferred_type_test; |
| 7 | 7 |
| 8 import 'package:test/test.dart'; | 8 import 'package:test/test.dart'; |
| 9 | 9 |
| 10 import 'package:dev_compiler/src/testing.dart'; | 10 import '../testing.dart'; |
| 11 | 11 |
| 12 void main() { | 12 void main() { |
| 13 test('infer type on var', () { | 13 test('infer type on var', () { |
| 14 // Error also expected when declared type is `int`. | 14 // Error also expected when declared type is `int`. |
| 15 testChecker({ | 15 testChecker({ |
| 16 '/main.dart': ''' | 16 '/main.dart': ''' |
| 17 test1() { | 17 test1() { |
| 18 int x = 3; | 18 int x = 3; |
| 19 x = /*severe:StaticTypeError*/"hi"; | 19 x = /*severe:StaticTypeError*/"hi"; |
| 20 } | 20 } |
| (...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1517 }); | 1517 }); |
| 1518 | 1518 |
| 1519 test('inferred initializing formal checks default value', () => testChecker({ | 1519 test('inferred initializing formal checks default value', () => testChecker({ |
| 1520 '/main.dart': ''' | 1520 '/main.dart': ''' |
| 1521 class Foo { | 1521 class Foo { |
| 1522 var x = 1; | 1522 var x = 1; |
| 1523 Foo([this.x = /*severe:StaticTypeError*/"1"]); | 1523 Foo([this.x = /*severe:StaticTypeError*/"1"]); |
| 1524 }''' | 1524 }''' |
| 1525 })); | 1525 })); |
| 1526 } | 1526 } |
| OLD | NEW |