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 class C { | 5 class C { |
6 final double d; | 6 final double d; |
7 const C(this.d); | 7 const C(this.d); |
8 } | 8 } |
9 | 9 |
10 class D extends C { | 10 class D extends C { |
11 const D(var d) : super(d); | 11 const D(var d) : super(d); |
12 } | 12 } |
13 | 13 |
14 const c = const C(0.0); //# 01: ok | 14 const c = const C(0.0); //# 01: ok |
15 const d = const C(0); //# 02: static type warning, checked mode compile-time err
or | 15 const d = const C(0); //# 02: static type warning, checked mode compile-time err
or |
16 const e = const D(0.0); //# 03: ok | 16 const e = const D(0.0); //# 03: ok |
17 const f = const D(0); //# 04: checked mode compile-time error | 17 const f = const D(0); //# 04: checked mode compile-time error |
18 | 18 |
19 main() { | 19 main() { |
20 print(c); //# 01: continued | 20 print(c); //# 01: continued |
21 print(d); //# 02: continued | 21 print(d); //# 02: continued |
22 print(e); //# 03: continued | 22 print(e); //# 03: continued |
23 print(f); //# 04: continued | 23 print(f); //# 04: continued |
24 } | 24 } |
OLD | NEW |