mirror of
https://github.com/dart-lang/sdk
synced 2024-11-05 18:22:09 +00:00
3b64211ab2
Change-Id: I05a4baa3c641d71ccee1fce1e7f680f3fd9f42fc Reviewed-on: https://dart-review.googlesource.com/9041 Commit-Queue: Jakob Roland Andersen <jakobr@google.com> Reviewed-by: Jakob Roland Andersen <jakobr@google.com>
39 lines
958 B
Dart
39 lines
958 B
Dart
// 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.
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
class ListLiteral4Test<T> {
|
|
void test() {
|
|
int result = 0;
|
|
{
|
|
var m = <String>[0, 1]; //# 00: compile-time error
|
|
}
|
|
{
|
|
var m = <int>[0, 1];
|
|
m["0"] = 1; //# 01: compile-time error
|
|
}
|
|
{
|
|
var m = <T>["a" as T, "b" as T]; //# 02: runtime error
|
|
}
|
|
var m = <T>[0 as T, 1 as T]; // OK.
|
|
{
|
|
var m = <T>[0 as T, 1 as T];
|
|
m["0"] = 1; //# 03: compile-time error
|
|
}
|
|
{
|
|
var m = const <int>[0, 1];
|
|
m["0"] = 1; //# 04: compile-time error
|
|
}
|
|
{
|
|
var m = <T>[0 as T, 1 as T]; // OK. Tested above.
|
|
List<String> ls = m; //# 05: compile-time error
|
|
}
|
|
}
|
|
}
|
|
|
|
main() {
|
|
var t = new ListLiteral4Test<int>();
|
|
t.test();
|
|
}
|