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 #source("../../../lib/compiler/implementation/ssa/types.dart"); | 5 #source("../../../lib/compiler/implementation/ssa/types.dart"); |
6 | 6 |
7 class Type { | 7 class Type { |
8 const Type(this.str); | 8 const Type(this.str); |
9 final String str; | 9 final String str; |
10 } | 10 } |
11 | 11 |
12 final CONFLICTING = HType.CONFLICTING; | 12 const CONFLICTING = HType.CONFLICTING; |
13 final UNKNOWN = HType.UNKNOWN; | 13 const UNKNOWN = HType.UNKNOWN; |
14 final BOOLEAN = HType.BOOLEAN; | 14 const BOOLEAN = HType.BOOLEAN; |
15 final NUMBER = HType.NUMBER; | 15 const NUMBER = HType.NUMBER; |
16 final INTEGER = HType.INTEGER; | 16 const INTEGER = HType.INTEGER; |
17 final DOUBLE = HType.DOUBLE; | 17 const DOUBLE = HType.DOUBLE; |
18 final INDEXABLE_PRIMITIVE = HType.INDEXABLE_PRIMITIVE; | 18 const INDEXABLE_PRIMITIVE = HType.INDEXABLE_PRIMITIVE; |
19 final STRING = HType.STRING; | 19 const STRING = HType.STRING; |
20 final READABLE_ARRAY = HType.READABLE_ARRAY; | 20 const READABLE_ARRAY = HType.READABLE_ARRAY; |
21 final MUTABLE_ARRAY = HType.MUTABLE_ARRAY; | 21 const MUTABLE_ARRAY = HType.MUTABLE_ARRAY; |
22 final EXTENDABLE_ARRAY = HType.EXTENDABLE_ARRAY; | 22 const EXTENDABLE_ARRAY = HType.EXTENDABLE_ARRAY; |
23 final NON_PRIMITIVE1 = const HBoundedType.nonNull(const Type("type1")); | 23 const NON_PRIMITIVE1 = const HBoundedType.nonNull(const Type("type1")); |
24 final NON_PRIMITIVE2 = const HBoundedType.nonNull(const Type("type2")); | 24 const NON_PRIMITIVE2 = const HBoundedType.nonNull(const Type("type2")); |
25 final POTENTIAL_ARRAY = | 25 const POTENTIAL_ARRAY = |
26 const HBoundedPotentialPrimitiveArray(const Type('type 3'), true); | 26 const HBoundedPotentialPrimitiveArray(const Type('type 3'), true); |
27 final POTENTIAL_STRING = | 27 const POTENTIAL_STRING = |
28 const HBoundedPotentialPrimitiveString(const Type('type 4'), true); | 28 const HBoundedPotentialPrimitiveString(const Type('type 4'), true); |
29 final BOOLEAN_OR_NULL = HType.BOOLEAN_OR_NULL; | 29 const BOOLEAN_OR_NULL = HType.BOOLEAN_OR_NULL; |
30 final NUMBER_OR_NULL = HType.NUMBER_OR_NULL; | 30 const NUMBER_OR_NULL = HType.NUMBER_OR_NULL; |
31 final INTEGER_OR_NULL = HType.INTEGER_OR_NULL; | 31 const INTEGER_OR_NULL = HType.INTEGER_OR_NULL; |
32 final DOUBLE_OR_NULL = HType.DOUBLE_OR_NULL; | 32 const DOUBLE_OR_NULL = HType.DOUBLE_OR_NULL; |
33 final STRING_OR_NULL = HType.STRING_OR_NULL; | 33 const STRING_OR_NULL = HType.STRING_OR_NULL; |
34 final NULL = HType.NULL; | 34 const NULL = HType.NULL; |
35 | 35 |
36 void testUnion() { | 36 void testUnion() { |
37 Expect.equals(CONFLICTING, CONFLICTING.union(CONFLICTING)); | 37 Expect.equals(CONFLICTING, CONFLICTING.union(CONFLICTING)); |
38 Expect.equals(UNKNOWN, CONFLICTING.union(UNKNOWN)); | 38 Expect.equals(UNKNOWN, CONFLICTING.union(UNKNOWN)); |
39 Expect.equals(BOOLEAN, CONFLICTING.union(BOOLEAN)); | 39 Expect.equals(BOOLEAN, CONFLICTING.union(BOOLEAN)); |
40 Expect.equals(NUMBER, CONFLICTING.union(NUMBER)); | 40 Expect.equals(NUMBER, CONFLICTING.union(NUMBER)); |
41 Expect.equals(INTEGER, CONFLICTING.union(INTEGER)); | 41 Expect.equals(INTEGER, CONFLICTING.union(INTEGER)); |
42 Expect.equals(DOUBLE, CONFLICTING.union(DOUBLE)); | 42 Expect.equals(DOUBLE, CONFLICTING.union(DOUBLE)); |
43 Expect.equals(INDEXABLE_PRIMITIVE, CONFLICTING.union(INDEXABLE_PRIMITIVE)); | 43 Expect.equals(INDEXABLE_PRIMITIVE, CONFLICTING.union(INDEXABLE_PRIMITIVE)); |
44 Expect.equals(STRING, CONFLICTING.union(STRING)); | 44 Expect.equals(STRING, CONFLICTING.union(STRING)); |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 Expect.equals(NULL, NULL.intersection(INTEGER_OR_NULL)); | 970 Expect.equals(NULL, NULL.intersection(INTEGER_OR_NULL)); |
971 Expect.equals(NULL, NULL.intersection(DOUBLE_OR_NULL)); | 971 Expect.equals(NULL, NULL.intersection(DOUBLE_OR_NULL)); |
972 Expect.equals(NULL, NULL.intersection(STRING_OR_NULL)); | 972 Expect.equals(NULL, NULL.intersection(STRING_OR_NULL)); |
973 Expect.equals(NULL, NULL.intersection(NULL)); | 973 Expect.equals(NULL, NULL.intersection(NULL)); |
974 } | 974 } |
975 | 975 |
976 void main() { | 976 void main() { |
977 testUnion(); | 977 testUnion(); |
978 testIntersection(); | 978 testIntersection(); |
979 } | 979 } |
OLD | NEW |