Suppose I need a `Map<KClass<T>, (T) -&gt...
# compiler
d
Suppose I need a
Map<KClass<T>, (T) -> Unit>
where the value type
(T) -> Unit
is covariant (?) with
T
. e.g.
map[Int::class]
has type
(Int) -> Unit
. There's no way to do this without casting, right?
d
Pretty much (Assuming this is self-contained). Unless you extend
Map
and provide the constraints.
d
It doesn't need to be
Map
- it can be a new class that doesn't extend
Map
.
d
Yeah it can.