K2: expand types during smartcasting to prevent redundant intersections

#KT-53184 Fixed
This commit is contained in:
Mikhail Glukhikh
2022-07-18 15:17:37 +02:00
committed by Space
parent bc396b9765
commit 5445f4043a
16 changed files with 344 additions and 128 deletions
@@ -0,0 +1,18 @@
// TARGET_BACKEND: JVM_IR
// WITH_REFLECT
import kotlin.reflect.KProperty1
private typealias PropAlias<T> = KProperty1<T, Any?>?
fun box(): String {
val backRefProp: PropAlias<Foo> = Foo::bar
if (backRefProp != null) {
return backRefProp.get(Foo()) as String
}
return "FAIL"
}
class Foo {
val bar: String = "OK"
}