OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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'; | 5 import 'package:expect/expect.dart'; |
6 | 6 |
7 abstract class B { | 7 abstract class B { |
8 int get x; | 8 int get x; |
9 } | 9 } |
10 | 10 |
11 class C { | 11 class C { |
12 int get x => 42; | 12 int get x => 42; |
13 } | 13 } |
14 | 14 |
15 class D extends C with B { | 15 class D extends C with B { |
16 final int x; | 16 final int x; |
17 | 17 |
18 D(this.x); | 18 D(this.x); |
19 } | 19 } |
20 | 20 |
21 | |
22 class C2 { | 21 class C2 { |
23 int get x => 42; | 22 int get x => 42; |
24 } | 23 } |
25 | 24 |
26 abstract class B2 extends C2 { | 25 abstract class B2 extends C2 { |
27 int get x; | 26 int get x; |
28 } | 27 } |
29 | 28 |
30 class D2 extends B2 { | 29 class D2 extends B2 { |
31 final int x; | 30 final int x; |
32 | 31 |
33 D2(this.x); | 32 D2(this.x); |
34 } | 33 } |
35 | 34 |
36 | |
37 void main() { | 35 void main() { |
38 var d = new D(17); | 36 var d = new D(17); |
39 Expect.equals(d.x, 17); | 37 Expect.equals(d.x, 17); |
40 | 38 |
41 var d2 = new D2(17); | 39 var d2 = new D2(17); |
42 Expect.equals(d.x, 17); | 40 Expect.equals(d.x, 17); |
43 } | 41 } |
OLD | NEW |