mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:27:17 +00:00
ecc87a177f
Change-Id: Id33f3088391815686b04f437cbf756b5718ed9bb Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163664 Reviewed-by: Bob Nystrom <rnystrom@google.com> Commit-Queue: Erik Ernst <eernst@google.com>
27 lines
1.1 KiB
Dart
27 lines
1.1 KiB
Dart
// Copyright (c) 2019, 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.
|
|
|
|
void main() {
|
|
// Spread non-iterable or non-map.
|
|
var _ = [...(3)]; //# 00: compile-time error
|
|
var _ = <int, int>{...(3)}; //# 01: compile-time error
|
|
var _ = <int>{...(3)}; //# 02: compile-time error
|
|
|
|
// Object.
|
|
var _ = [...([] as Object)]; //# 03: compile-time error
|
|
var _ = <int, int>{...({} as Object)}; //# 04: compile-time error
|
|
var _ = <int>{...([] as Object)}; //# 05: compile-time error
|
|
|
|
// Wrong element type.
|
|
var _ = <int>[...<String>[]]; //# 06: compile-time error
|
|
var _ = <int, int>{...<String, int>{}}; //# 07: compile-time error
|
|
var _ = <int, int>{...<int, String>{}}; //# 08: compile-time error
|
|
var _ = <int>{...<String>[]}; //# 09: compile-time error
|
|
|
|
// Downcast element.
|
|
var _ = <int>[...<num>[1, 2]]; //# 10: compile-time error
|
|
var _ = <int, int>{...<num, num>{1: 1, 2: 2}}; //# 11: compile-time error
|
|
var _ = <int>{...<num>[1, 2]}; //# 12: compile-time error
|
|
}
|