| 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 class A { | 5 class A { |
| 6 final int x; | 6 final int x; |
| 7 const A.a1() : x = 'foo'; | 7 const A.a1() : x = 'foo'; /// 01: continued |
| 8 const A.a2(this.x); | 8 const A.a2(this.x); |
| 9 const A.a3([this.x = 'foo']); | 9 const A.a3([this.x = 'foo']); /// 03: continued |
| 10 const A.a4(String this.x); | 10 const A.a4(String this.x); /// 04: continued |
| 11 const A.a5(String x) : this.x = x; | 11 const A.a5(String x) : this.x = x; /// 05: continued |
| 12 const A.a6(int x) : this.x = x; | 12 const A.a6(int x) : this.x = x; |
| 13 } | 13 } |
| 14 | 14 |
| 15 const a1 = const A.a1(); /// 01: compile-time error | 15 const a1 = const A.a1(); /// 01: static type warning, compile-time error |
| 16 const a2 = const A.a2('foo'); /// 02: compile-time error | 16 const a2 = const A.a2('foo'); /// 02: static type warning, compile-time error |
| 17 const a3 = const A.a3(); /// 03: compile-time error | 17 const a3 = const A.a3(); /// 03: static type warning, compile-time error |
| 18 const a4 = const A.a4('foo'); /// 04: compile-time error | 18 const a4 = const A.a4('foo'); /// 04: static type warning, compile-time error |
| 19 const a5 = const A.a5('foo'); /// 05: compile-time error | 19 const a5 = const A.a5('foo'); /// 05: static type warning, compile-time error |
| 20 const a6 = const A.a6('foo'); /// 06: compile-time error | 20 const a6 = const A.a6('foo'); /// 06: static type warning, compile-time error |
| 21 | |
| 22 var b1 = const A.a1(); /// 07: compile-time error | |
| 23 var b2 = const A.a2('foo'); /// 08: compile-time error | |
| 24 var b3 = const A.a3(); /// 09: compile-time error | |
| 25 var b4 = const A.a4('foo'); /// 10: compile-time error | |
| 26 var b5 = const A.a5('foo'); /// 11: compile-time error | |
| 27 var b6 = const A.a6('foo'); /// 12: compile-time error | |
| 28 | 21 |
| 29 main() { | 22 main() { |
| 30 print(a1); /// 01: continued | 23 print(a1); /// 01: continued |
| 31 print(a2); /// 02: continued | 24 print(a2); /// 02: continued |
| 32 print(a3); /// 03: continued | 25 print(a3); /// 03: continued |
| 33 print(a4); /// 04: continued | 26 print(a4); /// 04: continued |
| 34 print(a5); /// 05: continued | 27 print(a5); /// 05: continued |
| 35 print(a6); /// 06: continued | 28 print(a6); /// 06: continued |
| 36 | |
| 37 print(b1); /// 07: continued | |
| 38 print(b2); /// 08: continued | |
| 39 print(b3); /// 09: continued | |
| 40 print(b4); /// 10: continued | |
| 41 print(b5); /// 11: continued | |
| 42 print(b6); /// 12: continued | |
| 43 } | 29 } |
| OLD | NEW |