OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // Test that 'dynamic' can be used in const expressions and has the expected | 5 // Test that 'dynamic' can be used in const expressions and has the expected |
6 // behavior. | 6 // behavior. |
7 | 7 |
8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
9 | 9 |
10 const d = dynamic; | 10 const d = dynamic; |
11 const i = int; | 11 const i = int; |
12 | 12 |
13 void main() { | 13 void main() { |
14 Expect.isTrue(identical(d, dynamic)); /// 01: ok | 14 Expect.isTrue(identical(d, dynamic)); //# 01: ok |
15 Expect.equals(1, const { d: 1, d: 2 }.length); /// 02: static type warning | 15 Expect.equals(1, const { d: 1, d: 2 }.length); //# 02: static type warning |
16 Expect.equals(2, const { d: 1, i: 2 }.length); /// 03: ok | 16 Expect.equals(2, const { d: 1, i: 2 }.length); //# 03: ok |
17 } | 17 } |
OLD | NEW |