| import 'dart:collection'; |
| |
| class MyList<E> with ListMixin<E> { |
| final List<E> list; |
| StringBuffer sb = new StringBuffer(); |
| MyList(this.list); |
| E operator [](int index) {} |
| void operator []=(int index, E value) {} |
| int get length => list.length; |
| void set length(int value) {} |
| String get log => sb.toString(); |
| void clearLog() {} |
| } |
| |
| String test1(Object o) => |
| switch (o) { [var x, 2, var y] => "match-1", _ => "no match" }; |
| |
| String test2(Object o) => |
| switch (o) { [1, var x, var y] => "match-1", _ => "no match" }; |
| |
| String test3(Object o) => switch (o) { |
| [var x!, 1] => "match-1", |
| [1, var x!] => "match-2", |
| _ => "no match" |
| }; |
| |
| main() {} |
| |
| expect(expected, actual) {} |