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

Unified Diff: tests/language/vm/unique_selector_test.dart

Issue 2412653002: VM Propagate receiver type from calls to unique selectors in AOT compilation. (Closed)
Patch Set: addressed comments, added test Created 4 years, 2 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
« no previous file with comments | « runtime/vm/precompiler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/vm/unique_selector_test.dart
diff --git a/tests/language/vm/unique_selector_test.dart b/tests/language/vm/unique_selector_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..e26d4b53e8a35735cd10b7633a7f48320ba8178c
--- /dev/null
+++ b/tests/language/vm/unique_selector_test.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+
+class A {
+ _unique_method() => "foo";
+ bar() => "A";
+}
+
+class B {
+ noSuchMethod(invocation) => "nsm";
+ bar() => "B";
+}
+
+confuse(x) {
+ try {
+ throw x;
+ } catch (e) {
+ return e;
+ }
+ return null;
+}
+
+main() {
+ var a = confuse(new A());
+ Expect.equals("foo", a._unique_method());
+ Expect.equals("A", a.bar());
+
+ var b = confuse(new B());
+ Expect.equals("nsm", b._unique_method());
+ Expect.equals("B", b.bar()); // Don't propagate type A to b.
+}
« no previous file with comments | « runtime/vm/precompiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698