// !CHECK_TYPE class Outer { inner open class InnerBase inner class Inner : InnerBase() { val prop: E = null!! } fun foo(x: InnerBase, y: Any?, z: Outer<*>.InnerBase) { if (x is Inner) { x.prop.checkType { _() } } if (y is Inner) return if (z is Inner) { z.prop.checkType { _() } return } if (y is Outer<*>.Inner<*>) { y.prop.checkType { _() } } } fun bar(x: InnerBase, y: Any?, z: Outer<*>.InnerBase) { x as Inner y as Inner z as Inner } }