Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: tests/language_strong/const_syntax_test.dart

Issue 2763823002: Move spaces from before comments to within comments (Closed)
Patch Set: Fix comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 const f0 = 42; 8 const f0 = 42;
9 const f1; /// 01: compile-time error 9 const f1; /// 01: compile-time error
10 const int f2 = 87; 10 const int f2 = 87;
11 const int f3; /// 02: compile-time error 11 const int f3; /// 02: compile-time error
12 Expect.equals(42, f0); 12 Expect.equals(42, f0);
13 Expect.equals(87, f2); 13 Expect.equals(87, f2);
14 14
15 Expect.equals(42, F0); 15 Expect.equals(42, F0);
16 Expect.equals(null, F1); /// 03: compile-time error 16 Expect.equals(null, F1); /// 03: compile-time error
17 Expect.equals(87, F2); 17 Expect.equals(87, F2);
18 Expect.equals(null, F3); /// 04: compile-time error 18 Expect.equals(null, F3); /// 04: compile-time error
19 19
20 Expect.isTrue(P0 is Point); 20 Expect.isTrue(P0 is Point);
21 Expect.isTrue(P1 is int); /// 05: compile-time error 21 Expect.isTrue(P1 is int); // /// 05: compile-time error
22 Expect.isTrue(P2 is Point); /// 06: compile-time error 22 Expect.isTrue(P2 is Point); /// 06: compile-time error
23 Expect.isTrue(P3 is int); /// 07: compile-time error 23 Expect.isTrue(P3 is int); // /// 07: compile-time error
24 24
25 Expect.isTrue(A0 is int); 25 Expect.isTrue(A0 is int);
26 Expect.isTrue(A1 is int); 26 Expect.isTrue(A1 is int);
27 Expect.isTrue(A2 is int); /// 08: compile-time error 27 Expect.isTrue(A2 is int); /// 08: compile-time error
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: compile-time error 34 Expect.equals("42Hello", B3); /// 10: compile-time error
35 35
36 const cf1 = identical(const Point(1, 2), const Point(1, 2)); 36 const cf1 = identical(const Point(1, 2), const Point(1, 2));
37 37
38 const cf2 = identical(const Point(1, 2), new Point(1, 2)); /// 11: compile-ti me error 38 const cf2 = identical(const Point(1, 2), new Point(1, 2)); // /// 11: compile- time error
39 39
40 var f4 = B4; /// 12: compile-time error 40 var f4 = B4; // /// 12: compile-time error
41 var f5 = B5; 41 var f5 = B5;
42 } 42 }
43 43
44 const F0 = 42; 44 const F0 = 42;
45 const F1; /// 03: continued 45 const F1; // /// 03: continued
46 const int F2 = 87; 46 const int F2 = 87;
47 const int F3; /// 04: continued 47 const int F3; // /// 04: continued
48 48
49 class Point { 49 class Point {
50 final x, y; 50 final x, y;
51 const Point(this.x, this.y); 51 const Point(this.x, this.y);
52 operator +(int other) => x; 52 operator +(int other) => x;
53 } 53 }
54 54
55 // Check that compile time expressions can include invocations of 55 // Check that compile time expressions can include invocations of
56 // user-defined const constructors. 56 // user-defined const constructors.
57 const P0 = const Point(0, 0); 57 const P0 = const Point(0, 0);
58 const P1 = const Point(0, 0) + 1; /// 05: continued 58 const P1 = const Point(0, 0) + 1; /// 05: continued
59 const P2 = new Point(0, 0); /// 06: continued 59 const P2 = new Point(0, 0); // /// 06: continued
60 const P3 = new Point(0, 0) + 1; /// 07: continued 60 const P3 = new Point(0, 0) + 1; // /// 07: continued
61 61
62 // Check that we cannot have cyclic references in compile time 62 // Check that we cannot have cyclic references in compile time
63 // expressions. 63 // expressions.
64 const A0 = 42; 64 const A0 = 42;
65 const A1 = A0 + 1; 65 const A1 = A0 + 1;
66 const A2 = A3 + 1; /// 08: continued 66 const A2 = A3 + 1; /// 08: continued
67 const A3 = A2 + 1; /// 08: continued 67 const A3 = A2 + 1; /// 08: continued
68 68
69 class C0 { 69 class C0 {
70 static const X = const C1(); 70 static const X = const C1();
71 } 71 }
72 72
73 class C1 { 73 class C1 {
74 const C1() 74 const C1()
75 : x = C0.X /// 09: continued 75 : x = C0.X /// 09: continued
76 ; 76 ;
77 final x = null; 77 final x = null;
78 } 78 }
79 79
80 // Check that sub-expressions of binary + are numeric. 80 // Check that sub-expressions of binary + are numeric.
81 const B0 = 42; 81 const B0 = 42;
82 const B1 = "Hello"; 82 const B1 = "Hello";
83 const B2 = "$B1 $B0"; 83 const B2 = "$B1 $B0";
84 const B3 = B0 + B1; /// 10: continued 84 const B3 = B0 + B1; /// 10: continued
85 85
86 // Check identical. 86 // Check identical.
87 87
88 const B4 = identical(1, new Point(1,2)); /// 12: compile-time error 88 const B4 = identical(1, new Point(1,2)); // /// 12: compile-time error
89 const B5 = identical(1, const Point(1,2)); 89 const B5 = identical(1, const Point(1,2));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698