| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 import "package:expect/expect.dart"; |
| 6 |
| 7 class A { |
| 8 final a; |
| 9 A(this.a); // Not const. |
| 10 const A.five() : a = 5; |
| 11 } |
| 12 |
| 13 class B extends A { |
| 14 final b; |
| 15 B(x) : b = x + 1, super(x); |
| 16 |
| 17 // Const constructor cannot call non-const super constructor. |
| 18 const B.zerofive() : b = 0, super(5); /// 01: compile-time error |
| 19 } |
| 20 |
| 21 class C extends A { |
| 22 C() : super(0); |
| 23 // Implicit call to non-const constructor A(x). |
| 24 const C.named(x); /// 02: compile-time error |
| 25 } |
| 26 |
| 27 main() { |
| 28 var b = new B.zerofive(); /// 01: continued |
| 29 var b1 = new B(0); |
| 30 var c = new C.named(""); /// 02: continued |
| 31 } |
| OLD | NEW |