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 | 4 |
5 class A<T> { | 5 class A<T> { |
6 A() : x = null; | 6 A() : x = null; |
7 | 7 |
8 const A.constant(this.x); | 8 const A.constant(this.x); |
9 | 9 |
10 factory A.factory() { | 10 factory A.factory() { |
11 return new B<Set>(); | 11 return new B<Set>(); |
12 } | 12 } |
13 | 13 |
14 factory A.test01() = T; /// 01: runtime error | 14 factory A.test01() = T; /// 01: runtime error |
15 | 15 |
16 factory A.test02() = Dynamic; /// 02: runtime error | 16 factory A.test02() = dynamic; /// 02: runtime error |
17 | 17 |
18 factory A.test03() = Undefined; /// 03: runtime error | 18 factory A.test03() = Undefined; /// 03: runtime error |
19 | 19 |
20 factory A.test04() = C.test04; /// 04: compile-time error | 20 factory A.test04() = C.test04; /// 04: compile-time error |
21 | 21 |
22 final T x; | 22 final T x; |
23 } | 23 } |
24 | 24 |
25 class B<T> extends A<T> { | 25 class B<T> extends A<T> { |
26 B(); | 26 B(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 Expect.isTrue(new A<List>() is A<List>); | 63 Expect.isTrue(new A<List>() is A<List>); |
64 Expect.isTrue(new A<bool>.constant(true).x); | 64 Expect.isTrue(new A<bool>.constant(true).x); |
65 Expect.isTrue(new A<List>.factory() is B<Set>); | 65 Expect.isTrue(new A<List>.factory() is B<Set>); |
66 Expect.isTrue(new B<List>.A() is A<List>); | 66 Expect.isTrue(new B<List>.A() is A<List>); |
67 Expect.isTrue(new B<bool>.A_constant(true).x); | 67 Expect.isTrue(new B<bool>.A_constant(true).x); |
68 Expect.isTrue(new B<List>.A_factory() is B<Set>); | 68 Expect.isTrue(new B<List>.A_factory() is B<Set>); |
69 Expect.isTrue(new C<String, num>.A() is A<num>); | 69 Expect.isTrue(new C<String, num>.A() is A<num>); |
70 Expect.isTrue(new C<String, num>.A_factory() is B<Set>); | 70 Expect.isTrue(new C<String, num>.A_factory() is B<Set>); |
71 Expect.isTrue(new C<String, bool>.B_constant(true).x); | 71 Expect.isTrue(new C<String, bool>.B_constant(true).x); |
72 } | 72 } |
OLD | NEW |