OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 // Test that optimized '+' and slow path '+' produce the same error. | 7 // Test that optimized '+' and slow path '+' produce the same error. |
8 | 8 |
9 @NoInline() | 9 @NoInline() |
10 @AssumeDynamic() | 10 @AssumeDynamic() |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 static f3() { | 47 static f3() { |
48 return (confuse(1) as int) + confuse(null); | 48 return (confuse(1) as int) + confuse(null); |
49 } | 49 } |
50 | 50 |
51 static f4() { | 51 static f4() { |
52 return (confuse(1) as int) + null; | 52 return (confuse(1) as int) + null; |
53 } | 53 } |
54 | 54 |
55 static f5() { | 55 static f5() { |
56 var a = confuse(true) ? 1 : 2; // Small int with unknown value. | 56 var a = confuse(true) ? 1 : 2; // Small int with unknown value. |
57 return a + confuse(null); | 57 return a + confuse(null); |
58 } | 58 } |
59 | 59 |
60 static f6() { | 60 static f6() { |
61 var a = confuse(true) ? 1 : 2; // Small int with unknown value. | 61 var a = confuse(true) ? 1 : 2; // Small int with unknown value. |
62 return a + null; | 62 return a + null; |
63 } | 63 } |
64 | 64 |
65 static f7() { | 65 static f7() { |
66 return 1 + null; | 66 return 1 + null; |
67 } | 67 } |
68 | 68 |
69 static test() { | 69 static test() { |
70 check('IntPlusNull', f1, f2, f3, f4, f5, f6, f7); | 70 check('IntPlusNull', f1, f2, f3, f4, f5, f6, f7); |
71 } | 71 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 class IntPlusString { | 110 class IntPlusString { |
111 static f1() { | 111 static f1() { |
112 return confuse(1) + confuse('a'); | 112 return confuse(1) + confuse('a'); |
113 } | 113 } |
114 | 114 |
115 static f2() { | 115 static f2() { |
116 return confuse(1) + 'a'; | 116 return confuse(1) + 'a'; |
117 } | 117 } |
118 | 118 |
119 static f3() { | 119 static f3() { |
120 var a = confuse(true) ? 1 : 2; // Small int with unknown value. | 120 var a = confuse(true) ? 1 : 2; // Small int with unknown value. |
121 return a + confuse('a'); | 121 return a + confuse('a'); |
122 } | 122 } |
123 | 123 |
124 static f4() { | 124 static f4() { |
125 return (confuse(1) as int) + confuse('a'); | 125 return (confuse(1) as int) + confuse('a'); |
126 } | 126 } |
127 | 127 |
128 static f5() { | 128 static f5() { |
129 return (confuse(1) as int) + 'a'; | 129 return (confuse(1) as int) + 'a'; |
130 } | 130 } |
131 | 131 |
132 static f6() { | 132 static f6() { |
133 var a = confuse(true) ? 1 : 2; // Small int with unknown value. | 133 var a = confuse(true) ? 1 : 2; // Small int with unknown value. |
134 return a + 'a'; | 134 return a + 'a'; |
135 } | 135 } |
136 | 136 |
137 static f7() { | 137 static f7() { |
138 return 1 + 'a'; | 138 return 1 + 'a'; |
139 } | 139 } |
140 | 140 |
141 static test() { | 141 static test() { |
142 check('IntPlusString', f1, f2, f3, f4, f5, f6, f7); | 142 check('IntPlusString', f1, f2, f3, f4, f5, f6, f7); |
143 } | 143 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 check('StringPlusInt', f1, f2, f3, f4, f5, f6, f7); | 178 check('StringPlusInt', f1, f2, f3, f4, f5, f6, f7); |
179 } | 179 } |
180 } | 180 } |
181 | 181 |
182 main() { | 182 main() { |
183 IntPlusNull.test(); | 183 IntPlusNull.test(); |
184 StringPlusNull.test(); | 184 StringPlusNull.test(); |
185 IntPlusString.test(); | 185 IntPlusString.test(); |
186 StringPlusInt.test(); | 186 StringPlusInt.test(); |
187 } | 187 } |
OLD | NEW |