open class A(val t: T) { open val foo: T = t } open class B : A("Fail") class Z : B() { override val foo = "OK" } fun box() = (Z() : A).foo