blob: 5dda1bd3908b61f4fc4a93281412a7a17080de80 [file] [log] [blame]
class MapLike<K, V> {
V? get(Object key) => _map[key];
V put(K key, V value) => _map[key] = value;
final Map<K, V> _map = {};
}
class MapLike2<K, V> {
MapLike2(this.defaultValue);
V get(Object key) => _map[key] ?? defaultValue;
V put(K key, V value) => _map[key] = value;
final Map<K, V> _map = {};
final V defaultValue;
}
expect(expected, actual) {}
explicitInferredTypeArguments() {}
explicitWithTypeArguments() {}
extension Extension<K, V> on MapLike<K, V> {
V? operator [](Object key) => get(key);
void operator []=(K key, V value) => put(key, value);
}
extension Extension2<K, V> on MapLike2<K, V> {
V operator [](Object key) => get(key);
void operator []=(K key, V value) => put(key, value);
}
implicit() {}
main() {}