OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 class Foo {} | 7 class Foo {} |
8 | 8 |
9 const | 9 const |
10 bool /// 01: ok | 10 bool //# 01: ok |
11 int /// 02: static type warning, checked mode compile-time error | 11 int //# 02: static type warning, checked mode compile-time error |
12 String /// 03: static type warning, checked mode compile-time error | 12 String //# 03: static type warning, checked mode compile-time error |
13 Foo /// 04: static type warning, checked mode compile-time error | 13 Foo //# 04: static type warning, checked mode compile-time error |
14 a = const bool.fromEnvironment('a'); | 14 a = const bool.fromEnvironment('a'); |
15 | 15 |
16 const | 16 const |
17 bool /// 05: ok | 17 bool //# 05: ok |
18 int /// 06: static type warning, checked mode compile-time error | 18 int //# 06: static type warning, checked mode compile-time error |
19 String /// 07: static type warning, checked mode compile-time error | 19 String //# 07: static type warning, checked mode compile-time error |
20 Foo /// 08: static type warning, checked mode compile-time error | 20 Foo //# 08: static type warning, checked mode compile-time error |
21 b = const bool.fromEnvironment('b'); | 21 b = const bool.fromEnvironment('b'); |
22 | 22 |
23 const | 23 const |
24 bool /// 09: static type warning | 24 bool //# 09: static type warning |
25 int /// 10: ok | 25 int //# 10: ok |
26 String /// 11: static type warning | 26 String //# 11: static type warning |
27 Foo /// 12: static type warning | 27 Foo //# 12: static type warning |
28 c = const int.fromEnvironment('c'); | 28 c = const int.fromEnvironment('c'); |
29 | 29 |
30 const | 30 const |
31 bool /// 13: static type warning | 31 bool //# 13: static type warning |
32 int /// 14: static type warning | 32 int //# 14: static type warning |
33 String /// 15: ok | 33 String //# 15: ok |
34 Foo /// 16: static type warning | 34 Foo //# 16: static type warning |
35 d = const String.fromEnvironment('d'); | 35 d = const String.fromEnvironment('d'); |
36 | 36 |
37 main() { | 37 main() { |
38 Expect.equals(a, false); | 38 Expect.equals(a, false); |
39 Expect.equals(b, false); | 39 Expect.equals(b, false); |
40 Expect.equals(c, null); | 40 Expect.equals(c, null); |
41 Expect.equals(d, null); | 41 Expect.equals(d, null); |
42 } | 42 } |
OLD | NEW |