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 final x = "foo"; | 5 const x = "foo"; |
6 final y = "foo"; | 6 const y = "foo"; |
7 final g1 = x | 7 const g1 = x |
8 + "bar" /// 01: compile-time error | 8 + "bar" /// 01: compile-time error |
9 ; | 9 ; |
10 final g2 = x | 10 const g2 = x |
11 + null /// 02: compile-time error | 11 + null /// 02: compile-time error |
12 ; | 12 ; |
13 final g3 = x | 13 const g3 = x |
14 + 499 /// 03: compile-time error | 14 + 499 /// 03: compile-time error |
15 ; | 15 ; |
16 final g4 = x | 16 const g4 = x |
17 + 3.3 /// 04: compile-time error | 17 + 3.3 /// 04: compile-time error |
18 ; | 18 ; |
19 final g5 = x | 19 const g5 = x |
20 + true /// 05: compile-time error | 20 + true /// 05: compile-time error |
21 ; | 21 ; |
22 final g6 = x | 22 const g6 = x |
23 + false /// 06: compile-time error | 23 + false /// 06: compile-time error |
24 ; | 24 ; |
25 final g7 = "foo" | 25 const g7 = "foo" |
26 + x[0] /// 07: compile-time error | 26 + x[0] /// 07: compile-time error |
27 ; | 27 ; |
28 final g8 = 1 | 28 const g8 = 1 |
29 + x.length /// 08: compile-time error | 29 + x.length /// 08: compile-time error |
30 ; | 30 ; |
31 final g9 = x == y; | 31 const g9 = x == y; |
32 | 32 |
33 use(x) => x; | 33 use(x) => x; |
34 | 34 |
35 main() { | 35 main() { |
36 Expect.equals("foo", g1); | 36 Expect.equals("foo", g1); |
37 Expect.isTrue(g9); | 37 Expect.isTrue(g9); |
38 use(g1); | 38 use(g1); |
39 use(g2); | 39 use(g2); |
40 use(g3); | 40 use(g3); |
41 use(g4); | 41 use(g4); |
42 use(g5); | 42 use(g5); |
43 use(g6); | 43 use(g6); |
44 use(g7); | 44 use(g7); |
45 use(g8); | 45 use(g8); |
46 } | 46 } |
OLD | NEW |