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

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

Issue 1020853007: Don't bailout of type inference for simple NSM implementations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: unnecessary blank line Created 5 years, 9 months 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
Index: tests/compiler/dart2js/simple_inferrer_no_such_method_test.dart
diff --git a/tests/compiler/dart2js/simple_inferrer_no_such_method_test.dart b/tests/compiler/dart2js/simple_inferrer_no_such_method_test.dart
index 9e3a9875ba20d0585c739eb68484b466c8b4d736..431466cf7d5e9954a0f9cbc98a34fcde018bf19e 100644
--- a/tests/compiler/dart2js/simple_inferrer_no_such_method_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_no_such_method_test.dart
@@ -6,6 +6,7 @@ import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
import 'compiler_helper.dart';
+import 'package:compiler/src/types/types.dart';
import 'parser_helper.dart';
import 'type_mask_test_helper.dart';
@@ -94,6 +95,70 @@ main() {
}
""";
+const String TEST3 = """
+class A {
+ // We can ignore because we know this throws
floitsch 2015/03/23 21:02:27 Missing ".", and I have the impression this isn't
Harry Terkelsen 2015/03/23 22:31:18 Done.
+ noSuchMethod(im) => throw 'foo';
+}
+
+class B extends A {
+ foo() => {};
+}
+
+class C extends B {
+ foo() => {};
+}
+
+var a = [new B(), new C()][0];
+test1() => new A().foo();
+test2() => a.foo();
+test3() => new B().foo();
+test4() => new C().foo();
+test5() => (a ? new A() : new B()).foo();
+test6() => (a ? new B() : new C()).foo();
+
+main() {
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
+ test6();
+}
+""";
+
+const String TEST4 = """
+class A {
+ // We can ignore
floitsch 2015/03/23 21:02:27 unfinished comment.
Harry Terkelsen 2015/03/23 22:31:18 Done.
+ noSuchMethod(im) => super.noSuchMethod(im);
+}
+
+class B extends A {
+ foo() => {};
+}
+
+class C extends B {
+ foo() => {};
+}
+
+var a = [new B(), new C()][0];
+test1() => new A().foo();
+test2() => a.foo();
+test3() => new B().foo();
+test4() => new C().foo();
+test5() => (a ? new A() : new B()).foo();
+test6() => (a ? new B() : new C()).foo();
+
+main() {
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
+ test6();
+}
+""";
+
main() {
Uri uri = new Uri(scheme: 'source');
@@ -134,4 +199,24 @@ main() {
checkReturn(compiler2, 'test10', compiler2.typesTask.numType);
checkReturn(compiler2, 'test11', compiler2.typesTask.doubleType);
}));
+
+ var compiler3 = compilerFor(TEST3, uri);
+ asyncTest(() => compiler3.runCompiler(uri).then((_) {
+ checkReturn(compiler3, 'test1', const TypeMask.nonNullEmpty());
+ checkReturn(compiler3, 'test2', compiler3.typesTask.mapType);
+ checkReturn(compiler3, 'test3', compiler3.typesTask.mapType);
+ checkReturn(compiler3, 'test4', compiler3.typesTask.mapType);
+ checkReturn(compiler3, 'test5', compiler3.typesTask.mapType);
+ checkReturn(compiler3, 'test6', compiler3.typesTask.mapType);
+ }));
+
+ var compiler4 = compilerFor(TEST4, uri);
+ asyncTest(() => compiler4.runCompiler(uri).then((_) {
+ checkReturn(compiler4, 'test1', const TypeMask.nonNullEmpty());
+ checkReturn(compiler4, 'test2', compiler4.typesTask.mapType);
+ checkReturn(compiler4, 'test3', compiler4.typesTask.mapType);
+ checkReturn(compiler4, 'test4', compiler4.typesTask.mapType);
+ checkReturn(compiler4, 'test5', compiler4.typesTask.mapType);
+ checkReturn(compiler4, 'test6', compiler4.typesTask.mapType);
+ }));
}

Powered by Google App Engine
This is Rietveld 408576698