Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Unified Diff: tests/compiler/dart2js/union_type_test.dart

Issue 1413613010: Normalize type masks to use the least upper instantiated subclass/type. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix try/poi Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/compiler/dart2js/type_mask2_test.dart ('k') | tests/try/poi/forget_element_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
- }));
+ });
}
« no previous file with comments | « tests/compiler/dart2js/type_mask2_test.dart ('k') | tests/try/poi/forget_element_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698