OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Dart test for testing implicit super calls with bad arguments or no default | 4 // Dart test for testing implicit super calls with bad arguments or no default |
5 // constructor in super class. | 5 // constructor in super class. |
6 | 6 |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 | 8 |
9 class A { | 9 class A { |
10 A( | 10 A( |
11 this.x // //# 01: compile-time error | 11 this.x // //# 01: compile-time error |
12 ); | 12 ); |
13 final foo = 499; | 13 final foo = 499; |
14 } | 14 } |
15 | 15 |
16 class B extends A {} | 16 class B extends A {} |
17 | 17 |
18 class B2 extends A { | 18 class B2 extends A { |
19 B2(); | 19 B2(); |
20 B2.named() : this.x = 499; | 20 B2.named() : this.x = 499; |
21 var x; | 21 var x; |
22 } | 22 } |
23 | 23 |
24 class C { | 24 class C { |
25 C | 25 C |
26 .named // //# 02: compile-time error | 26 .named // //# 02: compile-time error |
27 (); | 27 (); |
28 final foo = 499; | 28 final foo = 499; |
29 } | 29 } |
30 | 30 |
31 class D extends C {} | 31 class D extends C {} |
| 32 |
32 class D2 extends C { | 33 class D2 extends C { |
33 D2(); | 34 D2(); |
34 D2.named() : this.x = 499; | 35 D2.named() : this.x = 499; |
35 var x; | 36 var x; |
36 } | 37 } |
37 | 38 |
38 main() { | 39 main() { |
39 Expect.equals(499, new B().foo); | 40 Expect.equals(499, new B().foo); |
40 Expect.equals(499, new B2().foo); | 41 Expect.equals(499, new B2().foo); |
41 Expect.equals(499, new B2.named().foo); | 42 Expect.equals(499, new B2.named().foo); |
42 Expect.equals(499, new D().foo); | 43 Expect.equals(499, new D().foo); |
43 Expect.equals(499, new D2().foo); | 44 Expect.equals(499, new D2().foo); |
44 Expect.equals(499, new D2.named().foo); | 45 Expect.equals(499, new D2.named().foo); |
45 } | 46 } |
OLD | NEW |