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