mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 14:32:49 +00:00
b101a7d002
Change-Id: Ib33169c3e0ffc870915c189404074a1dea472546 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196548 Reviewed-by: Bob Nystrom <rnystrom@google.com> Commit-Queue: Leaf Petersen <leafp@google.com>
53 lines
1.6 KiB
Dart
53 lines
1.6 KiB
Dart
// Copyright (c) 2013, 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.
|
|
|
|
// @dart = 2.9
|
|
|
|
// Regression test for dart2js where [List.addAll] was not typed
|
|
// correctly.
|
|
|
|
import 'iterable_return_type_helper.dart';
|
|
|
|
import 'dart:collection';
|
|
import 'dart:typed_data';
|
|
|
|
main() {
|
|
// Empty lists.
|
|
testList(<int>[]);
|
|
testList(new List<int>(0));
|
|
testList(new List<int>());
|
|
testList(const <int>[]);
|
|
testList(new List<int>.generate(0, (x) => x + 1));
|
|
// Singleton lists.
|
|
testList(<int>[1]);
|
|
testList(new List<int>(1)..[0] = 1);
|
|
testList(new List<int>()..add(1));
|
|
testList(const <int>[1]);
|
|
testList(new List<int>.generate(1, (x) => x + 1));
|
|
|
|
// Typed lists.
|
|
testList(new Uint8List(1)..[0] = 1);
|
|
testList(new Int8List(1)..[0] = 1);
|
|
testList(new Uint16List(1)..[0] = 1);
|
|
testList(new Int16List(1)..[0] = 1);
|
|
testList(new Uint32List(1)..[0] = 1);
|
|
testList(new Int32List(1)..[0] = 1);
|
|
|
|
testIterable(new Set<int>()..add(1));
|
|
testIterable(new HashSet<int>()..add(1));
|
|
testIterable(new LinkedHashSet<int>()..add(1));
|
|
testIterable(new SplayTreeSet<int>()..add(1));
|
|
|
|
testIterable(new Queue<int>()..add(1));
|
|
testIterable(new DoubleLinkedQueue<int>()..add(1));
|
|
testIterable(new ListQueue<int>()..add(1));
|
|
|
|
testMap(new Map<int, int>()..[1] = 1);
|
|
testMap(new HashMap<int, int>()..[1] = 1);
|
|
testMap(new LinkedHashMap<int, int>()..[1] = 1);
|
|
testMap(new SplayTreeMap<int, int>()..[1] = 1);
|
|
testMap(<int, int>{1: 1});
|
|
testMap(const <int, int>{1: 1});
|
|
}
|