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 'package:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
6 | 6 |
7 import "package:async_helper/async_helper.dart"; | 7 import "package:async_helper/async_helper.dart"; |
8 import 'compiler_helper.dart'; | 8 import 'compiler_helper.dart'; |
9 import 'package:compiler/src/types/types.dart'; | 9 import 'package:compiler/src/types/types.dart'; |
10 import 'type_mask_test_helper.dart'; | 10 import 'type_mask_test_helper.dart'; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 var typesInferrer = compiler.globalInference.typesInferrer; | 167 var typesInferrer = compiler.globalInference.typesInferrer; |
168 var element = findElement(compiler, name); | 168 var element = findElement(compiler, name); |
169 Expect.equals( | 169 Expect.equals( |
170 type, | 170 type, |
171 simplify(typesInferrer.getReturnTypeOfElement(element), compiler), | 171 simplify(typesInferrer.getReturnTypeOfElement(element), compiler), |
172 name); | 172 name); |
173 } | 173 } |
174 | 174 |
175 var compiler1 = compilerFor(TEST1, uri); | 175 var compiler1 = compilerFor(TEST1, uri); |
176 asyncTest(() => compiler1.run(uri).then((_) { | 176 asyncTest(() => compiler1.run(uri).then((_) { |
177 checkReturn(compiler1, 'test1', compiler1.commonMasks.uint31Type); | 177 checkReturn(compiler1, 'test1', compiler1.commonMasks.uint31Type); |
178 checkReturn(compiler1, 'test2', | 178 checkReturn(compiler1, 'test2', |
179 compiler1.commonMasks.dynamicType.nonNullable()); | 179 compiler1.commonMasks.dynamicType.nonNullable()); |
180 checkReturn(compiler1, 'test3', compiler1.commonMasks.uint31Type); | 180 checkReturn(compiler1, 'test3', compiler1.commonMasks.uint31Type); |
181 checkReturn(compiler1, 'test4', compiler1.commonMasks.mapType); | 181 checkReturn(compiler1, 'test4', compiler1.commonMasks.mapType); |
182 checkReturn(compiler1, 'test5', | 182 checkReturn(compiler1, 'test5', |
183 compiler1.commonMasks.dynamicType.nonNullable()); | 183 compiler1.commonMasks.dynamicType.nonNullable()); |
184 checkReturn(compiler1, 'test6', | 184 checkReturn(compiler1, 'test6', |
185 compiler1.commonMasks.dynamicType.nonNullable()); | 185 compiler1.commonMasks.dynamicType.nonNullable()); |
186 })); | 186 })); |
187 | 187 |
188 var compiler2 = compilerFor(TEST2, uri); | 188 var compiler2 = compilerFor(TEST2, uri); |
189 asyncTest(() => compiler2.run(uri).then((_) { | 189 asyncTest(() => compiler2.run(uri).then((_) { |
190 checkReturn(compiler2, 'test1', | 190 checkReturn( |
191 compiler2.commonMasks.mapType.nonNullable()); | 191 compiler2, 'test1', compiler2.commonMasks.mapType.nonNullable()); |
192 checkReturn(compiler2, 'test2', compiler2.commonMasks.mapType); | 192 checkReturn(compiler2, 'test2', compiler2.commonMasks.mapType); |
193 checkReturn(compiler2, 'test3', compiler2.commonMasks.mapType); | 193 checkReturn(compiler2, 'test3', compiler2.commonMasks.mapType); |
194 checkReturn(compiler2, 'test4', compiler2.commonMasks.mapType); | 194 checkReturn(compiler2, 'test4', compiler2.commonMasks.mapType); |
195 checkReturn(compiler2, 'test5', compiler2.commonMasks.mapType); | 195 checkReturn(compiler2, 'test5', compiler2.commonMasks.mapType); |
196 | 196 |
197 checkReturn(compiler2, 'test6', compiler2.commonMasks.numType); | 197 checkReturn(compiler2, 'test6', compiler2.commonMasks.numType); |
198 checkReturn(compiler2, 'test7', compiler2.commonMasks.uint31Type); | 198 checkReturn(compiler2, 'test7', compiler2.commonMasks.uint31Type); |
199 checkReturn(compiler2, 'test8', compiler2.commonMasks.uint31Type); | 199 checkReturn(compiler2, 'test8', compiler2.commonMasks.uint31Type); |
200 checkReturn(compiler2, 'test9', compiler2.commonMasks.uint31Type); | 200 checkReturn(compiler2, 'test9', compiler2.commonMasks.uint31Type); |
201 checkReturn(compiler2, 'test10', compiler2.commonMasks.numType); | 201 checkReturn(compiler2, 'test10', compiler2.commonMasks.numType); |
202 checkReturn(compiler2, 'test11', compiler2.commonMasks.doubleType); | 202 checkReturn(compiler2, 'test11', compiler2.commonMasks.doubleType); |
203 })); | 203 })); |
204 | 204 |
205 var compiler3 = compilerFor(TEST3, uri); | 205 var compiler3 = compilerFor(TEST3, uri); |
206 asyncTest(() => compiler3.run(uri).then((_) { | 206 asyncTest(() => compiler3.run(uri).then((_) { |
207 checkReturn(compiler3, 'test1', const TypeMask.nonNullEmpty()); | 207 checkReturn(compiler3, 'test1', const TypeMask.nonNullEmpty()); |
208 checkReturn(compiler3, 'test2', compiler3.commonMasks.mapType); | 208 checkReturn(compiler3, 'test2', compiler3.commonMasks.mapType); |
209 checkReturn(compiler3, 'test3', compiler3.commonMasks.mapType); | 209 checkReturn(compiler3, 'test3', compiler3.commonMasks.mapType); |
210 checkReturn(compiler3, 'test4', compiler3.commonMasks.mapType); | 210 checkReturn(compiler3, 'test4', compiler3.commonMasks.mapType); |
211 checkReturn(compiler3, 'test5', compiler3.commonMasks.mapType); | 211 checkReturn(compiler3, 'test5', compiler3.commonMasks.mapType); |
212 checkReturn(compiler3, 'test6', compiler3.commonMasks.mapType); | 212 checkReturn(compiler3, 'test6', compiler3.commonMasks.mapType); |
213 })); | 213 })); |
214 | 214 |
215 var compiler4 = compilerFor(TEST4, uri); | 215 var compiler4 = compilerFor(TEST4, uri); |
216 asyncTest(() => compiler4.run(uri).then((_) { | 216 asyncTest(() => compiler4.run(uri).then((_) { |
217 checkReturn(compiler4, 'test1', const TypeMask.nonNullEmpty()); | 217 checkReturn(compiler4, 'test1', const TypeMask.nonNullEmpty()); |
218 checkReturn(compiler4, 'test2', compiler4.commonMasks.mapType); | 218 checkReturn(compiler4, 'test2', compiler4.commonMasks.mapType); |
219 checkReturn(compiler4, 'test3', compiler4.commonMasks.mapType); | 219 checkReturn(compiler4, 'test3', compiler4.commonMasks.mapType); |
220 checkReturn(compiler4, 'test4', compiler4.commonMasks.mapType); | 220 checkReturn(compiler4, 'test4', compiler4.commonMasks.mapType); |
221 checkReturn(compiler4, 'test5', compiler4.commonMasks.mapType); | 221 checkReturn(compiler4, 'test5', compiler4.commonMasks.mapType); |
222 checkReturn(compiler4, 'test6', compiler4.commonMasks.mapType); | 222 checkReturn(compiler4, 'test6', compiler4.commonMasks.mapType); |
223 })); | 223 })); |
224 } | 224 } |
OLD | NEW |