| 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 import "package:expect/expect.dart"; |
| 6 |
| 5 abstract class A { | 7 abstract class A { |
| 6 factory A(int x, int y) = B; | 8 factory A(int x, int y) = B; |
| 7 } | 9 } |
| 8 | 10 |
| 9 abstract class X { | 11 abstract class X { |
| 10 factory X(int x, int y) = B.X; | 12 factory X(int x, int y) = B.X; |
| 11 } | 13 } |
| 12 | 14 |
| 13 class XImpl implements X { | 15 class XImpl implements X { |
| 14 final int x; | 16 final int x; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 32 var a = new A(1, 2); | 34 var a = new A(1, 2); |
| 33 // Check that constructor B is invoked and not factory B.A. | 35 // Check that constructor B is invoked and not factory B.A. |
| 34 Expect.equals(1, a.x); | 36 Expect.equals(1, a.x); |
| 35 Expect.equals(2, a.y); | 37 Expect.equals(2, a.y); |
| 36 | 38 |
| 37 var x = new X(11, 22); /// 00: dynamic type error | 39 var x = new X(11, 22); /// 00: dynamic type error |
| 38 // Check that factory is invoked. | 40 // Check that factory is invoked. |
| 39 Expect.equals(110, x.x); /// 00: continued | 41 Expect.equals(110, x.x); /// 00: continued |
| 40 Expect.equals(220, x.y); /// 00: continued | 42 Expect.equals(220, x.y); /// 00: continued |
| 41 } | 43 } |
| OLD | NEW |