dart-sdk/tests/corelib_2/iterable_return_type_test.dart
Michael Thomsen e4cc3c98e5 [3.0 alpha] Remove deprecated dart:core List() constructor.
TEST=ci

Bug: Contributes to https://github.com/dart-lang/sdk/issues/49529
Change-Id: Ic129ef2d89f625d9ec6a7a1c301cffddd60b2ff7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258920
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-12-15 11:36:22 +00:00

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>.filled(0, null));
testList(<int>[]);
testList(const <int>[]);
testList(new List<int>.generate(0, (x) => x + 1));
// Singleton lists.
testList(<int>[1]);
testList(new List<int>.filled(1, null)..[0] = 1);
testList(<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});
}