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