OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Dart test program for testing factory generic result types. | 4 // Dart test program for testing factory generic result types. |
5 | 5 |
6 class A<T> { | 6 class A<T> { |
7 A() {} | 7 A() { } |
8 factory A.factory() { | 8 factory A.factory() { |
9 return new A<String>(); | 9 return new A<String>(); |
10 } | 10 } |
11 } | 11 } |
12 | 12 |
13 class B<T> extends A<T> { | 13 class B<T> extends A<T> { |
14 B() {} | 14 B() { } |
15 factory B.factory() { | 15 factory B.factory() { |
16 return new B<String>(); | 16 return new B<String>(); |
17 } | 17 } |
18 } | 18 } |
19 | 19 |
| 20 |
20 main() { | 21 main() { |
21 new A<String>.factory(); | 22 new A<String>.factory(); |
22 new A<int>.factory(); // //# 00: dynamic type error | 23 new A<int>.factory(); // //# 00: dynamic type error |
23 new B<String>.factory(); | 24 new B<String>.factory(); |
24 new B<int>.factory(); // //# 01: dynamic type error | 25 new B<int>.factory(); // //# 01: dynamic type error |
25 } | 26 } |
OLD | NEW |