Why does this produce a warning: ```open class Sup...
# getting-started
j
Why does this produce a warning:
Copy code
open class Super

class Container<T: Super>

fun test(thing: Any) {
    if (thing is Container<*>) {
        val thing2 = thing as Container<Super>
    }
}
But this does not?
Copy code
open class Super

class Container<T: Super>

fun test(thing: Any) {
    if (thing is Container<out Super>) {
        val thing2 = thing as Container<Super>
    }
}
Shouldn't
*
be equivalent to
out Super
in this case?
l
I'm more surprised that the second doesn't show a warning. You're doing
is
on an erased type.
1
Ah, it's because you are checking for exactly the toplevel type for
Container
.
j
Seems like a soundness hole to me.