OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // Regression test for http://dartbug.com/6259. This test used to fail | 5 // Regression test for http://dartbug.com/6259. This test used to fail |
6 // on dart2js because class A does not know [A.document] is a target for | 6 // on dart2js because class A does not know [A.document] is a target for |
7 // the call [:obj.document:] in the [main] method. Therefore, dart2js | 7 // the call [:obj.document:] in the [main] method. Therefore, dart2js |
8 // would not compile [A.document]. | 8 // would not compile [A.document]. |
9 | 9 |
10 class A { | 10 class A { |
11 get document => 42; | 11 get document => 42; |
12 } | 12 } |
13 | 13 |
14 abstract class B { | 14 abstract class B { |
15 abstract get document; | 15 get document; // Abstract. |
16 } | 16 } |
17 | 17 |
18 class C extends A implements B { | 18 class C extends A implements B { |
19 } | 19 } |
20 | 20 |
21 int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1)); | 21 int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1)); |
22 | 22 |
23 void main() { | 23 void main() { |
24 var tab = [new Object(), new C()]; | 24 var tab = [new Object(), new C()]; |
25 var obj = tab[inscrutable(1)]; | 25 var obj = tab[inscrutable(1)]; |
26 int res = 0; | 26 int res = 0; |
27 if (obj is B) res = obj.document; | 27 if (obj is B) res = obj.document; |
28 Expect.equals(42, res); | 28 Expect.equals(42, res); |
29 } | 29 } |
OLD | NEW |