| Index: tests/language/final_syntax_test.dart
|
| diff --git a/tests/language/const_syntax_test.dart b/tests/language/final_syntax_test.dart
|
| similarity index 51%
|
| copy from tests/language/const_syntax_test.dart
|
| copy to tests/language/final_syntax_test.dart
|
| index 7540709735aafdcec99ff02f1e295c133315f884..8bed47069ab4d4d788c2f51f587bda5d2038fe81 100644
|
| --- a/tests/language/const_syntax_test.dart
|
| +++ b/tests/language/final_syntax_test.dart
|
| @@ -3,10 +3,10 @@
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| main() {
|
| - const f0 = 42;
|
| - const f1; /// 01: compile-time error
|
| - const int f2 = 87;
|
| - const int f3; /// 02: compile-time error
|
| + final f0 = 42;
|
| + final f1; /// 01: compile-time error
|
| + final int f2 = 87;
|
| + final int f3; /// 02: compile-time error
|
| Expect.equals(42, f0);
|
| Expect.equals(87, f2);
|
|
|
| @@ -16,49 +16,49 @@ main() {
|
| Expect.equals(null, F3); /// 04: compile-time error
|
|
|
| Expect.isTrue(P0 is Point);
|
| - Expect.isTrue(P1 is int); /// 05: compile-time error
|
| - Expect.isTrue(P2 is Point); /// 06: compile-time error
|
| - Expect.isTrue(P3 is int); /// 07: compile-time error
|
| + Expect.isTrue(P1 is int);
|
| + Expect.isTrue(P2 is Point);
|
| + Expect.isTrue(P3 is int);
|
|
|
| Expect.isTrue(A0 is int);
|
| Expect.isTrue(A1 is int);
|
| - Expect.isTrue(A2 is int); /// 08: compile-time error
|
| + Expect.isTrue(A2 is int); /// 08: runtime error
|
| Expect.isTrue(A3 is int); /// 08: continued
|
|
|
| Expect.isTrue(C0.X is C1);
|
| Expect.isTrue(C0.X.x is C1); /// 09: compile-time error
|
|
|
| Expect.equals("Hello 42", B2);
|
| - Expect.equals("42Hello", B3); /// 10: compile-time error
|
| + Expect.equals("42Hello", B3); /// 10: runtime error
|
| }
|
|
|
| -const F0 = 42;
|
| -const F1; /// 03: continued
|
| -const int F2 = 87;
|
| -const int F3; /// 04: continued
|
| +final F0 = 42;
|
| +final F1; /// 03: continued
|
| +final int F2 = 87;
|
| +final int F3; /// 04: continued
|
|
|
| class Point {
|
| final x, y;
|
| - const Point(this.x, this.y);
|
| + final Point(this.x, this.y);
|
| operator +(int other) => x;
|
| }
|
|
|
| // Check that compile time expressions can include invocations of
|
| -// user-defined const constructors.
|
| -const P0 = const Point(0, 0);
|
| -const P1 = const Point(0, 0) + 1; /// 05: continued
|
| -const P2 = new Point(0, 0); /// 06: continued
|
| -const P3 = new Point(0, 0) + 1; /// 07: continued
|
| +// user-defined final constructors.
|
| +final P0 = const Point(0, 0);
|
| +final P1 = const Point(0, 0) + 1;
|
| +final P2 = new Point(0, 0);
|
| +final P3 = new Point(0, 0) + 1;
|
|
|
| // Check that we cannot have cyclic references in compile time
|
| // expressions.
|
| -const A0 = 42;
|
| -const A1 = A0 + 1;
|
| -const A2 = A3 + 1; /// 08: continued
|
| -const A3 = A2 + 1; /// 08: continued
|
| +final A0 = 42;
|
| +final A1 = A0 + 1;
|
| +final A2 = A3 + 1; /// 08: continued
|
| +final A3 = A2 + 1; /// 08: continued
|
|
|
| class C0 {
|
| - static const X = const C1();
|
| + static final X = const C1();
|
| }
|
|
|
| class C1 {
|
| @@ -69,7 +69,7 @@ class C1 {
|
| }
|
|
|
| // Check that sub-expressions of binary + are numeric.
|
| -const B0 = 42;
|
| -const B1 = "Hello";
|
| -const B2 = "$B1 $B0";
|
| -const B3 = B0 + B1; /// 10: continued
|
| +final B0 = 42;
|
| +final B1 = "Hello";
|
| +final B2 = "$B1 $B0";
|
| +final B3 = B0 + B1; /// 10: continued
|
|
|