FIR: Properly deserialize upper bounds of classes type parameters

^KT-46661 Fixed
This commit is contained in:
Denis.Zharkov
2021-05-14 14:39:24 +03:00
committed by teamcityserver
parent 858e3584a9
commit d4586cefb4
17 changed files with 24 additions and 49 deletions
@@ -1,23 +0,0 @@
// 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<out Foo>? = if (f != null) f::class else null
fun test2(): KClass<out Foo>? {
var f: Foo? = null
if (f != null) {
run { f = null }
return <!RETURN_TYPE_MISMATCH!><!EXPRESSION_OF_NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>f<!>::class<!>
}
return null
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// KT-16291 Smart cast doesn't work when getting class of instance
import kotlin.reflect.KClass