mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 23:49:47 +00:00
a4b09ac192
Change-Id: I8b9b7d70abc47d672c68db65bc67d08beb7d41a7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142089 Commit-Queue: Bob Nystrom <rnystrom@google.com> Reviewed-by: Erik Ernst <eernst@google.com>
37 lines
1.7 KiB
Dart
37 lines
1.7 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.
|
|
|
|
// Test cases where the syntax is ambiguous between maps and sets when control
|
|
// flow elements contain spreads.
|
|
import 'dart:collection';
|
|
|
|
import 'utils.dart';
|
|
|
|
void main() {
|
|
Map<int, int> map = {};
|
|
Set<int> set = Set();
|
|
dynamic dyn = map;
|
|
Iterable<int> iterable = [];
|
|
CustomSet customSet = CustomSet();
|
|
CustomMap customMap = CustomMap();
|
|
|
|
var _ = {if (true) ...dyn}; //# 00: compile-time error
|
|
var _ = {if (true) ...map else ...set}; //# 01: compile-time error
|
|
var _ = {if (true) ...map else ...iterable}; //# 02: compile-time error
|
|
var _ = {if (true) ...map else ...customSet}; //# 03: compile-time error
|
|
var _ = {if (true) ...set else ...customMap}; //# 04: compile-time error
|
|
var _ = {if (true) ...dyn else ...dyn}; //# 05: compile-time error
|
|
var _ = {if (true) ...iterable else ...customMap}; //# 06: compile-time error
|
|
var _ = {if (true) ...customSet else ...customMap}; //# 07: compile-time error
|
|
|
|
var _ = {for (; false;) ...dyn}; //# 08: compile-time error
|
|
var _ = {for (; false;) ...map, ...set}; //# 09: compile-time error
|
|
var _ = {for (; false;) ...map, ...iterable}; //# 10: compile-time error
|
|
var _ = {for (; false;) ...map, ...customSet}; //# 11: compile-time error
|
|
var _ = {for (; false;) ...set, ...customMap}; //# 12: compile-time error
|
|
var _ = {for (; false;) ...dyn, ...dyn}; //# 13: compile-time error
|
|
var _ = {for (; false;) ...iterable, ...customMap}; //# 14: compile-time error
|
|
var _ = {for (; false;) ...customSet, ...customMap}; //# 15: compile-time error
|
|
}
|