OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import 'dart:collection'; |
| 6 import 'package:expect/expect.dart'; |
| 7 |
| 8 class OverrideFirstGetter { |
| 9 get first => 9999; |
| 10 } |
| 11 |
| 12 class ListMock extends ListBase with OverrideFirstGetter { |
| 13 final _list = []; |
| 14 int get length => _list.length; |
| 15 void set length(int x) { |
| 16 _list.length = x; |
| 17 } |
| 18 |
| 19 operator [](x) => _list[x]; |
| 20 void operator []=(x, y) { |
| 21 _list[x] = y; |
| 22 } |
| 23 } |
| 24 |
| 25 // Regression test for |
| 26 // https://github.com/dart-lang/sdk/issues/29273#issuecomment-292384130 |
| 27 main() { |
| 28 List x = new ListMock(); |
| 29 x.add(42); |
| 30 Expect.equals(x[0], 42); |
| 31 Expect.equals(x.first, 9999); |
| 32 } |
OLD | NEW |