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

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

Issue 1023673012: Emit diagnostics for bad NSM implementations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« pkg/compiler/lib/src/warnings.dart ('K') | « pkg/compiler/lib/src/warnings.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/no_such_method_enabled_test.dart
diff --git a/tests/compiler/dart2js/no_such_method_enabled_test.dart b/tests/compiler/dart2js/no_such_method_enabled_test.dart
index c9da1a05f9fb8b4a00f897e3555a378dab0dca31..cb994a948420975d6e1dd5871b428cae417afb55 100644
--- a/tests/compiler/dart2js/no_such_method_enabled_test.dart
+++ b/tests/compiler/dart2js/no_such_method_enabled_test.dart
@@ -231,6 +231,57 @@ main() {
}));
}
+dummyImplTest11() {
+ String source = """
+class A {
+ noSuchMethod(Invocation x) {
+ print('foo');
+ throw 'foo';
+ }
+}
+main() {
+ print(new A().foo());
+}
+""";
+ Uri uri = new Uri(scheme: 'source');
+ var compiler = compilerFor(source, uri);
+ asyncTest(() => compiler.runCompiler(uri).then((_) {
+ Expect.isTrue(compiler.backend.enabledNoSuchMethod);
+ ClassElement clsA = findElement(compiler, 'A');
+ Expect.isTrue(
+ compiler.backend.noSuchMethodRegistry.otherImpls.contains(
+ clsA.lookupMember('noSuchMethod')));
+ Expect.isTrue(
+ compiler.backend.noSuchMethodRegistry.complexNoReturnImpls.contains(
+ clsA.lookupMember('noSuchMethod')));
+ }));
+}
+
+dummyImplTest12() {
+ String source = """
+class A {
+ noSuchMethod(Invocation x) {
+ return toString();
+ }
+}
+main() {
+ print(new A().foo());
+}
+""";
+ Uri uri = new Uri(scheme: 'source');
+ var compiler = compilerFor(source, uri);
+ asyncTest(() => compiler.runCompiler(uri).then((_) {
+ Expect.isTrue(compiler.backend.enabledNoSuchMethod);
+ ClassElement clsA = findElement(compiler, 'A');
+ Expect.isTrue(
+ compiler.backend.noSuchMethodRegistry.otherImpls.contains(
+ clsA.lookupMember('noSuchMethod')));
+ Expect.isTrue(
+ compiler.backend.noSuchMethodRegistry.complexReturningImpls.contains(
+ clsA.lookupMember('noSuchMethod')));
+ }));
+}
+
main() {
dummyImplTest();
dummyImplTest2();
@@ -242,4 +293,6 @@ main() {
dummyImplTest8();
dummyImplTest9();
dummyImplTest10();
+ dummyImplTest11();
+ dummyImplTest12();
}
« pkg/compiler/lib/src/warnings.dart ('K') | « pkg/compiler/lib/src/warnings.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698