Index: tests/compiler/dart2js/union_type_test.dart |
diff --git a/tests/compiler/dart2js/union_type_test.dart b/tests/compiler/dart2js/union_type_test.dart |
index 584ad70e0b459a97128f7e913254e81ea07c3cda..4ae2dac475ca8311fb8930621ab6fda7cf704c32 100644 |
--- a/tests/compiler/dart2js/union_type_test.dart |
+++ b/tests/compiler/dart2js/union_type_test.dart |
@@ -5,22 +5,29 @@ |
import "package:async_helper/async_helper.dart"; |
import "package:expect/expect.dart"; |
import "package:compiler/src/types/types.dart"; |
- |
-import "compiler_helper.dart"; |
+import "package:compiler/src/world.dart"; |
+import 'type_test_helper.dart'; |
main() { |
- MockCompiler compiler = new MockCompiler.internal(analyzeOnly: true); |
- asyncTest(() => compiler.run(null, """ |
+ |
+ asyncTest(() async { |
+ TypeEnvironment env = await TypeEnvironment.create(r""" |
+ class A {} |
+ class B {} |
+ """, |
+ mainSource: r""" |
main() { |
- print(2); print("Hello"); |
+ new A(); |
+ new B(); |
} |
- """).then((_) { |
- FlatTypeMask mask1 = |
- new FlatTypeMask.exact(compiler.coreClasses.intClass); |
- FlatTypeMask mask2 = |
- new FlatTypeMask.exact(compiler.coreClasses.stringClass); |
- UnionTypeMask union1 = mask1.nonNullable().union(mask2, compiler.world); |
- UnionTypeMask union2 = mask2.nonNullable().union(mask1, compiler.world); |
+ """, |
+ useMockCompiler: false); |
+ World world = env.compiler.world; |
+ world.populate(); |
+ FlatTypeMask mask1 = new FlatTypeMask.exact(env.getElement('A')); |
+ FlatTypeMask mask2 = new FlatTypeMask.exact(env.getElement('B')); |
+ UnionTypeMask union1 = mask1.nonNullable().union(mask2, world); |
+ UnionTypeMask union2 = mask2.nonNullable().union(mask1, world); |
Expect.equals(union1, union2); |
- })); |
+ }); |
} |