OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library test.reflected_type_classes; | 5 library test.reflected_type_classes; |
6 | 6 |
7 import 'dart:mirrors'; | 7 import 'dart:mirrors'; |
8 | 8 |
9 import 'reflected_type_helper.dart'; | 9 import 'reflected_type_helper.dart'; |
10 | 10 |
11 class A<T> {} | 11 class A<T> {} |
| 12 |
12 class B extends A {} | 13 class B extends A {} |
| 14 |
13 class C extends A<num, int> {} // //# 01: static type warning | 15 class C extends A<num, int> {} // //# 01: static type warning |
14 class D extends A<int> {} | 16 class D extends A<int> {} |
| 17 |
15 class E<S> extends A<S> {} | 18 class E<S> extends A<S> {} |
| 19 |
16 class F<R> extends A<int> {} | 20 class F<R> extends A<int> {} |
| 21 |
17 class G {} | 22 class G {} |
18 class H<A,B,C> {} | 23 |
| 24 class H<A, B, C> {} |
19 | 25 |
20 main() { | 26 main() { |
21 // Declarations. | 27 // Declarations. |
22 expectReflectedType(reflectClass(A), null); | 28 expectReflectedType(reflectClass(A), null); |
23 expectReflectedType(reflectClass(B), B); | 29 expectReflectedType(reflectClass(B), B); |
24 expectReflectedType(reflectClass(C), C); // //# 01: continued | 30 expectReflectedType(reflectClass(C), C); // //# 01: continued |
25 expectReflectedType(reflectClass(D), D); | 31 expectReflectedType(reflectClass(D), D); |
26 expectReflectedType(reflectClass(E), null); | 32 expectReflectedType(reflectClass(E), null); |
27 expectReflectedType(reflectClass(F), null); | 33 expectReflectedType(reflectClass(F), null); |
28 expectReflectedType(reflectClass(G), G); | 34 expectReflectedType(reflectClass(G), G); |
29 expectReflectedType(reflectClass(H), null); | 35 expectReflectedType(reflectClass(H), null); |
30 | 36 |
31 // Instantiations. | 37 // Instantiations. |
32 expectReflectedType(reflect(new A()).type, new A().runtimeType); | 38 expectReflectedType(reflect(new A()).type, new A().runtimeType); |
33 expectReflectedType(reflect(new B()).type, new B().runtimeType); | 39 expectReflectedType(reflect(new B()).type, new B().runtimeType); |
34 expectReflectedType(reflect(new C()).type, new C().runtimeType); // //# 01: co
ntinued | 40 expectReflectedType(reflect(new C()).type, new C().runtimeType); // //# 01: co
ntinued |
35 expectReflectedType(reflect(new D()).type, new D().runtimeType); | 41 expectReflectedType(reflect(new D()).type, new D().runtimeType); |
36 expectReflectedType(reflect(new E()).type, new E().runtimeType); | 42 expectReflectedType(reflect(new E()).type, new E().runtimeType); |
37 expectReflectedType(reflect(new F()).type, new F().runtimeType); | 43 expectReflectedType(reflect(new F()).type, new F().runtimeType); |
38 expectReflectedType(reflect(new G()).type, new G().runtimeType); | 44 expectReflectedType(reflect(new G()).type, new G().runtimeType); |
39 expectReflectedType(reflect(new H()).type, new H().runtimeType); | 45 expectReflectedType(reflect(new H()).type, new H().runtimeType); |
40 | 46 |
41 expectReflectedType(reflect(new A<num>()).type, new A<num>().runtimeType); | 47 expectReflectedType(reflect(new A<num>()).type, new A<num>().runtimeType); |
42 expectReflectedType(reflect(new B<num>()).type.superclass, // //# 02: static t
ype warning | 48 expectReflectedType(reflect(new B<num>()).type.superclass, // //# 02: static t
ype warning |
43 new A<dynamic>().runtimeType); // //# 02: continue
d | 49 new A<dynamic>().runtimeType); // //# 02: continue
d |
44 expectReflectedType(reflect(new C<num>()).type.superclass, // //# 01: continue
d | 50 expectReflectedType(reflect(new C<num>()).type.superclass, // //# 01: continue
d |
45 new A<dynamic>().runtimeType); // //# 01: continue
d | 51 new A<dynamic>().runtimeType); // //# 01: continue
d |
46 expectReflectedType(reflect(new D<num>()).type.superclass, // //# 03: static t
ype warning | 52 expectReflectedType(reflect(new D<num>()).type.superclass, // //# 03: static t
ype warning |
47 new A<int>().runtimeType); // //# 03: continue
d | 53 new A<int>().runtimeType); // //# 03: continue
d |
48 expectReflectedType(reflect(new E<num>()).type, new E<num>().runtimeType); | 54 expectReflectedType(reflect(new E<num>()).type, new E<num>().runtimeType); |
49 expectReflectedType(reflect(new E<num>()).type.superclass, | 55 expectReflectedType( |
50 new A<num>().runtimeType); | 56 reflect(new E<num>()).type.superclass, new A<num>().runtimeType); |
51 expectReflectedType(reflect(new F<num>()).type.superclass, | 57 expectReflectedType( |
52 new A<int>().runtimeType); | 58 reflect(new F<num>()).type.superclass, new A<int>().runtimeType); |
53 expectReflectedType(reflect(new F<num>()).type, new F<num>().runtimeType); | 59 expectReflectedType(reflect(new F<num>()).type, new F<num>().runtimeType); |
54 expectReflectedType(reflect(new H<num, num, num>()).type, | 60 expectReflectedType( |
55 new H<num, num, num>().runtimeType); | 61 reflect(new H<num, num, num>()).type, new H<num, num, num>().runtimeType); |
56 } | 62 } |
OLD | NEW |