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 // We used to always nullify the element type of a list we are tracing in | 5 // We used to always nullify the element type of a list we are tracing in |
6 // the presence of a fixed length list constructor call. | 6 // the presence of a fixed length list constructor call. |
7 | 7 |
8 import 'package:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
9 import "package:async_helper/async_helper.dart"; | 9 import "package:async_helper/async_helper.dart"; |
10 import 'package:compiler/src/types/types.dart' | 10 import 'package:compiler/src/types/types.dart' |
11 show ContainerTypeMask, TypeMask; | 11 show ContainerTypeMask, TypeMask; |
12 | 12 |
13 import 'compiler_helper.dart'; | 13 import 'compiler_helper.dart'; |
14 import 'parser_helper.dart'; | |
15 import 'type_mask_test_helper.dart'; | 14 import 'type_mask_test_helper.dart'; |
16 | 15 |
17 | 16 |
18 const String TEST = r''' | 17 const String TEST = r''' |
19 var myList = []; | 18 var myList = []; |
20 var otherList = ['foo', 42]; | 19 var otherList = ['foo', 42]; |
21 main() { | 20 main() { |
22 var a = otherList[0]; | 21 var a = otherList[0]; |
23 a += 54; | 22 a += 54; |
24 myList.add(a); | 23 myList.add(a); |
(...skipping 11 matching lines...) Expand all Loading... |
36 ContainerTypeMask mask = typesInferrer.getTypeOfElement(element); | 35 ContainerTypeMask mask = typesInferrer.getTypeOfElement(element); |
37 Expect.equals(type, simplify(mask.elementType, compiler), name); | 36 Expect.equals(type, simplify(mask.elementType, compiler), name); |
38 } | 37 } |
39 | 38 |
40 var interceptorType = | 39 var interceptorType = |
41 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'); | 40 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'); |
42 | 41 |
43 checkType('myList', interceptorType); | 42 checkType('myList', interceptorType); |
44 })); | 43 })); |
45 } | 44 } |
OLD | NEW |