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 // Check that dart2js emits code for classes that implement another | 4 // Check that dart2js emits code for classes that implement another |
5 // class. | 5 // class. |
6 | 6 |
7 import "package:expect/expect.dart"; | |
8 | |
9 class A { | 7 class A { |
10 factory A() => new B(); | 8 factory A() => new B(); |
11 foo() => 0; | 9 foo() => 0; |
12 } | 10 } |
13 | 11 |
14 class B implements A { | 12 class B implements A { |
15 foo() => 42; | 13 foo() => 42; |
16 } | 14 } |
17 | 15 |
18 main() { | 16 main() { |
19 var a = new A(); | 17 var a = new A(); |
20 if (a is A) { | 18 if (a is A) { |
21 Expect.equals(42, a.foo()); | 19 Expect.equals(42, a.foo()); |
22 } else { | 20 } else { |
23 Expect.fail('Should not be here'); | 21 Expect.fail('Should not be here'); |
24 } | 22 } |
25 } | 23 } |
OLD | NEW |