OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // VMOptions=--enable_type_checks --enable_asserts | 4 // VMOptions=--enable_type_checks --enable_asserts |
5 // Tests the type checking when passing code into closure from inside a factory
method | 5 // Tests the type checking when passing code into closure from inside a factory
method |
6 | 6 |
7 interface Foo<T> default Bar<T> { | 7 interface Foo<T> default Bar<T> { |
8 Foo.from(); | 8 Foo.from(); |
9 } | 9 } |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 } | 25 } |
26 | 26 |
27 main() { | 27 main() { |
28 Foo<String> value1; | 28 Foo<String> value1; |
29 value1 = new Foo<String>.from(); | 29 value1 = new Foo<String>.from(); |
30 | 30 |
31 bool gotError = false; | 31 bool gotError = false; |
32 | 32 |
33 try { | 33 try { |
34 Foo<int> value2 = new Foo<int>.from(); | 34 Foo<int> value2 = new Foo<int>.from(); |
35 } catch (TypeError e) { | 35 } on TypeError catch (e) { |
36 gotError = true; | 36 gotError = true; |
37 } | 37 } |
38 Expect.equals(true, gotError); | 38 Expect.equals(true, gotError); |
39 } | 39 } |
OLD | NEW |