OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // Check that the implicit super call for synthetic constructors are checked. | 5 // Check that the implicit super call for synthetic constructors are checked. |
6 | 6 |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 | 8 |
9 class A { | 9 class A { |
10 final x; | 10 final x; |
11 A([this.x = 499]); | 11 A([this.x = 499]); |
12 } | 12 } |
13 | 13 |
14 class B extends A { | 14 class B extends A {} |
15 } | |
16 | 15 |
17 // ========== | 16 // ========== |
18 | 17 |
19 class X { | 18 class X { |
20 final x; | 19 final x; |
21 X([this.x = 42]); | 20 X([this.x = 42]); |
22 } | 21 } |
23 | 22 |
24 class Y extends X { | 23 class Y extends X {} |
25 } | |
26 | 24 |
27 class Z extends Y { | 25 class Z extends Y { |
28 Z() : super(); | 26 Z() : super(); |
29 } | 27 } |
30 | 28 |
31 // ============== | 29 // ============== |
32 | 30 |
33 class F { | 31 class F { |
34 final x; | 32 final x; |
35 F([this.x = 99]); | 33 F([this.x = 99]); |
36 } | 34 } |
37 | 35 |
38 class G extends F { | 36 class G extends F {} |
39 } | |
40 | 37 |
41 class H extends G { | 38 class H extends G {} |
42 } | |
43 | 39 |
44 main() { | 40 main() { |
45 Expect.equals(499, new B().x); | 41 Expect.equals(499, new B().x); |
46 Expect.equals(42, new Z().x); | 42 Expect.equals(42, new Z().x); |
47 Expect.equals(99, new H().x); | 43 Expect.equals(99, new H().x); |
48 } | 44 } |
OLD | NEW |