| 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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 | 6 |
| 7 main() { | 7 main() { |
| 8 final f0 = 42; | 8 final f0 = 42; |
| 9 final f1; /// 01: compile-time error | 9 final f1; /// 01: compile-time error |
| 10 final int f2 = 87; | 10 final int f2 = 87; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 Expect.isTrue(A3 is int); /// 08: continued | 28 Expect.isTrue(A3 is int); /// 08: continued |
| 29 | 29 |
| 30 Expect.isTrue(C0.X is C1); | 30 Expect.isTrue(C0.X is C1); |
| 31 Expect.isTrue(C0.X.x is C1); /// 09: compile-time error | 31 Expect.isTrue(C0.X.x is C1); /// 09: compile-time error |
| 32 | 32 |
| 33 Expect.equals("Hello 42", B2); | 33 Expect.equals("Hello 42", B2); |
| 34 Expect.equals("42Hello", B3); /// 10: runtime error | 34 Expect.equals("42Hello", B3); /// 10: runtime error |
| 35 } | 35 } |
| 36 | 36 |
| 37 final F0 = 42; | 37 final F0 = 42; |
| 38 final F1; /// 03: continued | 38 final F1; // /// 03: continued |
| 39 final int F2 = 87; | 39 final int F2 = 87; |
| 40 final int F3; /// 04: continued | 40 final int F3; // /// 04: continued |
| 41 | 41 |
| 42 class Point { | 42 class Point { |
| 43 final x, y; | 43 final x, y; |
| 44 const Point(this.x, this.y); | 44 const Point(this.x, this.y); |
| 45 operator +(int other) => x; | 45 operator +(int other) => x; |
| 46 } | 46 } |
| 47 | 47 |
| 48 // Check that compile time expressions can include invocations of | 48 // Check that compile time expressions can include invocations of |
| 49 // user-defined final constructors. | 49 // user-defined final constructors. |
| 50 final P0 = const Point(0, 0); | 50 final P0 = const Point(0, 0); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 68 : x = C0.X /// 09: continued | 68 : x = C0.X /// 09: continued |
| 69 ; | 69 ; |
| 70 final x = null; | 70 final x = null; |
| 71 } | 71 } |
| 72 | 72 |
| 73 // Check that sub-expressions of binary + are numeric. | 73 // Check that sub-expressions of binary + are numeric. |
| 74 final B0 = 42; | 74 final B0 = 42; |
| 75 final B1 = "Hello"; | 75 final B1 = "Hello"; |
| 76 final B2 = "$B1 $B0"; | 76 final B2 = "$B1 $B0"; |
| 77 final B3 = B0 + B1; /// 10: continued | 77 final B3 = B0 + B1; /// 10: continued |
| OLD | NEW |