// FIR_IDENTICAL // KT-16291 Smart cast doesn't work when getting class of instance import kotlin.reflect.KClass class Foo { override fun equals(other: Any?): Boolean { if (this === other) return true if (other === null || other::class != this::class) return false return true } } fun test(f: Foo?): KClass? = if (f != null) f::class else null fun test2(): KClass? { var f: Foo? = null if (f != null) { run { f = null } return f::class } return null }