OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import "dart:mirrors"; | 5 import "dart:mirrors"; |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 import "stringify.dart"; | 7 import "stringify.dart"; |
8 | 8 |
9 class Class<T1, T2> { | 9 class Class<T1, T2> { |
10 final field; | 10 final field; |
(...skipping 25 matching lines...) Expand all Loading... |
36 } | 36 } |
37 | 37 |
38 factory Class.redirectingFactoryMoreUnnamedOptional(a, [b]) = | 38 factory Class.redirectingFactoryMoreUnnamedOptional(a, [b]) = |
39 Class.factoryMoreUnnamedOptional; | 39 Class.factoryMoreUnnamedOptional; |
40 | 40 |
41 factory Class.redirectingFactoryStringIntTypeParameters(a, b) = | 41 factory Class.redirectingFactoryStringIntTypeParameters(a, b) = |
42 Class<String, int>.factoryNoOptional; | 42 Class<String, int>.factoryNoOptional; |
43 | 43 |
44 factory Class.redirectingFactoryStringTypeParameters(a, b) = | 44 factory Class.redirectingFactoryStringTypeParameters(a, b) = |
45 Class | 45 Class |
46 <String> // /// 02: static type warning | 46 <String> // //# 02: static type warning |
47 .factoryNoOptional; | 47 .factoryNoOptional; |
48 | 48 |
49 factory Class.redirectingFactoryTypeParameters(a, b) = | 49 factory Class.redirectingFactoryTypeParameters(a, b) = |
50 Class<T1, T2>.factoryNoOptional; | 50 Class<T1, T2>.factoryNoOptional; |
51 | 51 |
52 factory Class.redirectingFactoryReversedTypeParameters(a, b) = | 52 factory Class.redirectingFactoryReversedTypeParameters(a, b) = |
53 Class<T2, T1>.factoryNoOptional; | 53 Class<T2, T1>.factoryNoOptional; |
54 } | 54 } |
55 | 55 |
56 main() { | 56 main() { |
(...skipping 21 matching lines...) Expand all Loading... |
78 Expect.isFalse(instanceMirror.reflectee is Class<int, String>); | 78 Expect.isFalse(instanceMirror.reflectee is Class<int, String>); |
79 | 79 |
80 instanceMirror = classMirror.newInstance( | 80 instanceMirror = classMirror.newInstance( |
81 #redirectingFactoryStringTypeParameters, [43, 1]); | 81 #redirectingFactoryStringTypeParameters, [43, 1]); |
82 Expect.equals(42, instanceMirror.reflectee.field); | 82 Expect.equals(42, instanceMirror.reflectee.field); |
83 Expect.isTrue(instanceMirror.reflectee is Class<String, int>); | 83 Expect.isTrue(instanceMirror.reflectee is Class<String, int>); |
84 Expect.isTrue(instanceMirror.reflectee is Class<String, String>); | 84 Expect.isTrue(instanceMirror.reflectee is Class<String, String>); |
85 Expect.isTrue(instanceMirror.reflectee is Class<int, String>); | 85 Expect.isTrue(instanceMirror.reflectee is Class<int, String>); |
86 | 86 |
87 bool isDart2js = false; | 87 bool isDart2js = false; |
88 isDart2js = true; /// 01: ok | 88 isDart2js = true; //# 01: ok |
89 if (isDart2js) return; | 89 if (isDart2js) return; |
90 | 90 |
91 instanceMirror = classMirror.newInstance( | 91 instanceMirror = classMirror.newInstance( |
92 #redirectingFactoryUnnamedOptional, [43]); | 92 #redirectingFactoryUnnamedOptional, [43]); |
93 Expect.equals(1, instanceMirror.reflectee.field); | 93 Expect.equals(1, instanceMirror.reflectee.field); |
94 | 94 |
95 instanceMirror = classMirror.newInstance( | 95 instanceMirror = classMirror.newInstance( |
96 #redirectingFactoryNamedOptional, [43]); | 96 #redirectingFactoryNamedOptional, [43]); |
97 Expect.equals(1, instanceMirror.reflectee.field); | 97 Expect.equals(1, instanceMirror.reflectee.field); |
98 | 98 |
(...skipping 16 matching lines...) Expand all Loading... |
115 Expect.isTrue(instanceMirror.reflectee is Class<String, int>); | 115 Expect.isTrue(instanceMirror.reflectee is Class<String, int>); |
116 Expect.isFalse(instanceMirror.reflectee is Class<int, String>); | 116 Expect.isFalse(instanceMirror.reflectee is Class<int, String>); |
117 | 117 |
118 instanceMirror = classMirror.newInstance( | 118 instanceMirror = classMirror.newInstance( |
119 #redirectingFactoryReversedTypeParameters, [43, 1]); | 119 #redirectingFactoryReversedTypeParameters, [43, 1]); |
120 Expect.equals(42, instanceMirror.reflectee.field); | 120 Expect.equals(42, instanceMirror.reflectee.field); |
121 Expect.isTrue(instanceMirror.reflectee is Class<int, String>); | 121 Expect.isTrue(instanceMirror.reflectee is Class<int, String>); |
122 Expect.isFalse(instanceMirror.reflectee is Class<String, int>); | 122 Expect.isFalse(instanceMirror.reflectee is Class<String, int>); |
123 } | 123 } |
124 | 124 |
OLD | NEW |