9370281400
Change-Id: Ia12f714f41ad9bd9e6c0ddf051a8e05ab2d6282b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149392 Commit-Queue: Bob Nystrom <rnystrom@google.com> Auto-Submit: Bob Nystrom <rnystrom@google.com> Reviewed-by: Erik Ernst <eernst@google.com>
19 lines
331 B
Dart
19 lines
331 B
Dart
import 'dart:collection';
|
|
import 'package:expect/expect.dart';
|
|
|
|
class MyList extends ListBase {
|
|
int get length => 4;
|
|
set length(int x) {}
|
|
int operator [](int x) => 42;
|
|
void operator []=(int x, val) {}
|
|
}
|
|
|
|
main() {
|
|
var x = new MyList();
|
|
int z = 0;
|
|
x.forEach((y) {
|
|
z += y as int;
|
|
});
|
|
Expect.equals(z, 4 * 42);
|
|
}
|