Index: tests/compiler/dart2js_native/load_elim_refinement_test.dart |
diff --git a/tests/compiler/dart2js_native/load_elim_refinement_test.dart b/tests/compiler/dart2js_native/load_elim_refinement_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..026b142ac3eab8d90a4118a75522d501466d7a1f |
--- /dev/null |
+++ b/tests/compiler/dart2js_native/load_elim_refinement_test.dart |
@@ -0,0 +1,30 @@ |
+// Copyright (c) 2011, 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"; |
+import 'dart:_foreign_helper' show JS; |
+ |
+class A { |
+ int a; |
+} |
+ |
+class B extends A { |
+ int b; |
+} |
+ |
+@NoInline() |
+escape(v) { g = v; } |
+var g; |
+ |
+main() { |
+ g = new A(); |
+ var a = JS('returns:A;new:true', '(1,#)', new B()); |
+ |
+ a.a = 1; |
+ if (a is B) { |
+ escape(a); // Here we need to escape 'a' not the refinement of a to B. |
+ g.a = 2; |
+ Expect.equals(2, a.a); |
+ } |
+} |