dart-sdk/tests/corelib/regress_42011_test.dart
Tess Strickland 367761987b [vm/corelib] Fix ConcurrentModificationError for empty addAll.
Since we only add elements if the iterator is non-empty, we
shouldn't get a ConcurrentModificationError if both the iterator
and receiver are the same empty EfficientLengthIterator.

Fixes https://github.com/dart-lang/sdk/issues/42011

TEST=New regression test added that fails without the sdk change.

Fixed: 42011
Change-Id: Ib5259c8f043cc8277d2fea407d1f64a24430c4d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173901
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-11-25 12:01:44 +00:00

11 lines
403 B
Dart

// Copyright (c) 2020, 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.
// Regression test for https://github.com/dart-lang/sdk/issues/42011
main() {
var a = [];
// No elements are added, so should not get a ConcurrentModificationError.
a.addAll(a);
}