Open
Description
Let:
abstract class Entity<T> {
T get id;
}
class EntityStore<T extends Entity<K>, K> {
T getById(K id) {
...
}
}
class Customer extends Entity<int> {
final int id;
Customer(this.id);
}
Calling Code:
final store = EntityStore<Customer, int>();
But type parameter K
could already be inferred from T
:
final store = EntityStore<Customer>(); // this doesn't work
I propose infer
keyword for type parameters that could be inferred from other type parameters:
class EntityStore<T extends Entity<K>, infer K> {}