| // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| |
| /// @assertion The value of a constant list literal const <E>[e1... en] is an |
| /// object a that implements the built-in class List<E>. The ith element of a is |
| /// vi+1, where vi is the value of the compile time expression ei. |
| /// @description Checks that the value of a constant list literal is an object |
| /// that implements interface List<E>. |
| /// @author msyabro |
| |
| import '../../../Utils/expect.dart'; |
| |
| class C { |
| const C(); |
| } |
| |
| main() { |
| checkType(checkIs<List<int>>, true, const <int>[]); |
| checkType(checkIs<List<int>>, true, const <int>[1, 2, 3 + 4]); |
| checkType(checkIs<List<bool>>, true, const <bool>[false, 1 < 2]); |
| checkType(checkIs<List<String>>, true, <String>["a", "b", "c"]); |
| checkType(checkIs<List<C>>, true, const <C>[const C(), const C()]); |
| } |