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 // Test that type variables in try-catch work. | 5 // Test that type variables in try-catch work. |
6 | 6 |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 | 8 |
9 class C<T> { | 9 class C<T> { |
10 C.foo(); | 10 C.foo(); |
11 factory C() { | 11 factory C() { |
12 try { | 12 try { |
13 return new C<T>.foo(); | 13 return new C<T>.foo(); |
14 } finally { | 14 } finally {} |
15 } | |
16 } | 15 } |
17 } | 16 } |
18 | 17 |
19 main() { | 18 main() { |
20 var c = new C<int>(); | 19 var c = new C<int>(); |
21 Expect.isTrue(c is C<int>); | 20 Expect.isTrue(c is C<int>); |
22 Expect.isFalse(c is C<String>); | 21 Expect.isFalse(c is C<String>); |
23 } | 22 } |
OLD | NEW |