-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.closed-not-plannedClosed as we don't intend to take action on the reported issueClosed as we don't intend to take action on the reported issuelibrary-coretype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
The native List type, at least on the VM, throws a RangeError
if removeLast()
is called on an empty list. A list created using ListBase
or ListMixin
, on the other hand, throws a StateError
in the same situation. The following reproduces this:
import 'dart:collection';
class CustomList extends ListBase {
final List _inner;
int get length => _inner.length;
set length(int value) => _inner.length = value;
CustomList() : _inner = [];
operator [](int index) => _inner[index];
operator []=(int index, value) => _inner[index] = value;
}
void main() {
try {
new CustomList().removeLast();
} catch (error) {
print(error);
}
try {
[].removeLast();
} catch (error) {
print(error);
}
}
I'm using 8922198.
Metadata
Metadata
Assignees
Labels
area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.closed-not-plannedClosed as we don't intend to take action on the reported issueClosed as we don't intend to take action on the reported issuelibrary-coretype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)