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:async_helper/async_helper.dart"; | 5 import "package:async_helper/async_helper.dart"; |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 import "package:compiler/src/types/types.dart"; | 7 import "package:compiler/src/types/types.dart"; |
8 import "package:compiler/src/world.dart"; | 8 import "package:compiler/src/world.dart"; |
9 import 'type_test_helper.dart'; | 9 import 'type_test_helper.dart'; |
10 | 10 |
11 main() { | 11 main() { |
12 asyncTest(() async { | 12 asyncTest(() async { |
13 TypeEnvironment env = await TypeEnvironment.create( | 13 TypeEnvironment env = await TypeEnvironment.create(r""" |
14 r""" | |
15 class A {} | 14 class A {} |
16 class B {} | 15 class B {} |
17 """, | 16 """, mainSource: r""" |
18 mainSource: r""" | |
19 main() { | 17 main() { |
20 new A(); | 18 new A(); |
21 new B(); | 19 new B(); |
22 } | 20 } |
23 """, | 21 """, useMockCompiler: false); |
24 useMockCompiler: false); | |
25 ClosedWorld world = env.closedWorld; | 22 ClosedWorld world = env.closedWorld; |
26 FlatTypeMask mask1 = new FlatTypeMask.exact(env.getClass('A')); | 23 FlatTypeMask mask1 = new FlatTypeMask.exact(env.getClass('A')); |
27 FlatTypeMask mask2 = new FlatTypeMask.exact(env.getClass('B')); | 24 FlatTypeMask mask2 = new FlatTypeMask.exact(env.getClass('B')); |
28 UnionTypeMask union1 = mask1.nonNullable().union(mask2, world); | 25 UnionTypeMask union1 = mask1.nonNullable().union(mask2, world); |
29 UnionTypeMask union2 = mask2.nonNullable().union(mask1, world); | 26 UnionTypeMask union2 = mask2.nonNullable().union(mask1, world); |
30 Expect.equals(union1, union2); | 27 Expect.equals(union1, union2); |
31 }); | 28 }); |
32 } | 29 } |
OLD | NEW |