| 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 // Check that initializers of static const fields are compile time constants. | 4 // Check that initializers of static const fields are compile time constants. |
| 5 | 5 |
| 6 class CanonicalConstTest { | 6 class CanonicalConstTest { |
| 7 static final A = const C1(); | 7 static const A = const C1(); |
| 8 static final B = const C2(); | 8 static const B = const C2(); |
| 9 | 9 |
| 10 static testMain() { | 10 static testMain() { |
| 11 Expect.isTrue(null===null); | 11 Expect.isTrue(null===null); |
| 12 Expect.isTrue(null!==0); | 12 Expect.isTrue(null!==0); |
| 13 Expect.isTrue(1===1); | 13 Expect.isTrue(1===1); |
| 14 Expect.isTrue(1!==2); | 14 Expect.isTrue(1!==2); |
| 15 Expect.isTrue(true===true); | 15 Expect.isTrue(true===true); |
| 16 Expect.isTrue("so"==="so"); | 16 Expect.isTrue("so"==="so"); |
| 17 Expect.isTrue(const Object()===const Object()); | 17 Expect.isTrue(const Object()===const Object()); |
| 18 Expect.isTrue(const Object()!==const C1()); | 18 Expect.isTrue(const Object()!==const C1()); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 35 const C1(); | 35 const C1(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 class C2 extends C1 { | 38 class C2 extends C1 { |
| 39 const C2() : super(); | 39 const C2() : super(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 main() { | 42 main() { |
| 43 CanonicalConstTest.testMain(); | 43 CanonicalConstTest.testMain(); |
| 44 } | 44 } |
| OLD | NEW |