OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 proper canonicalization (fields must be canonicalized as well). | 5 // Check proper canonicalization (fields must be canonicalized as well). |
6 | 6 |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 | 8 |
9 main() { | 9 main() { |
10 Expect.isFalse(identical(new Duration(days: 1), new Duration(days: 1))); | 10 Expect.isFalse(identical(new Duration(days: 1), new Duration(days: 1))); |
11 Expect.isTrue(identical(const Duration(days: 2), const Duration(days: 2))); | 11 Expect.isTrue(identical(const Duration(days: 2), const Duration(days: 2))); |
12 Expect.isTrue(identical(const B(3.0), const B(3.0))); | 12 Expect.isTrue(identical(const B(3.0), const B(3.0))); |
13 Expect.isTrue(identical(const F(main), const F(main))); | 13 Expect.isTrue(identical(const F(main), const F(main))); |
14 } | 14 } |
15 | 15 |
16 class A { | 16 class A { |
17 final a; | 17 final a; |
18 const A(v) : a = v + 3.4; | 18 const A(v) : a = v + 3.4; |
19 } | 19 } |
20 | 20 |
21 class B extends A { | 21 class B extends A { |
22 final b; | 22 final b; |
23 const B(v) | 23 const B(v) |
24 : super(v), | 24 : b = v + 1.0, |
25 b = v + 1.0; | 25 super(v); |
26 } | 26 } |
27 | 27 |
28 class F { | 28 class F { |
29 final f; | 29 final f; |
30 const F(v) : f = v; | 30 const F(v) : f = v; |
31 } | 31 } |
OLD | NEW |