raulraja
01/29/2018, 1:42 AMvar occupant: T happens in invariant position and you are stating that crate: Crate<in Dog> is contravariant. If you change crate: Crate<in Dog> to crate: Crate<out Dog> or just crate: Crate<Dog> it will compile.
I'm guessing star projections are equivalent to existential types and unaffected by variance and Animal is all it can infer there based on your T : Animal constrain.Dave Leeds
01/29/2018, 4:38 AMDave Leeds
01/29/2018, 4:54 AMAnimal, but in-projection is stuck using Any?.Max Russek
01/29/2018, 5:24 AMfun Dog.withInProjection(crate: Crate<in Dog>) {
val starCrate: Crate<*> = crate
val occupant: Animal = starCrate.occupant
}
does in fact compile.Max Russek
01/29/2018, 5:34 AM