[FIR2IR] Properly insert implicit casts to extension receiver in case of intersection smartcast type

^KT-62863 Fixed
This commit is contained in:
Dmitriy Novozhilov
2023-11-02 12:27:30 +02:00
committed by Space Team
parent 50106c740c
commit 420fbad73d
25 changed files with 548 additions and 91 deletions
@@ -29,8 +29,8 @@ fun test_1(x: Any) {
x /*as Bar<Any> */ as Foo<Any> /*~> Unit */
x /*as Foo<Any> */.foo()
x /*as Bar<Any> */.bar()
x.extFoo<Any>()
x.extBar<Any>()
x /*as Foo<Any> */.extFoo<Any>()
x /*as Bar<Any> */.extBar<Any>()
}
fun test_2(x: Any) {
@@ -38,8 +38,8 @@ fun test_2(x: Any) {
x /*as Bar<Any> */ as Foo<Any>? /*~> Unit */
CHECK_NOT_NULL<Any>(arg0 = x) /*as Foo<Any> */.foo()
CHECK_NOT_NULL<Any>(arg0 = x) /*as Bar<Any> */.bar()
CHECK_NOT_NULL<Any>(arg0 = x).extFoo<Any>()
CHECK_NOT_NULL<Any>(arg0 = x).extBar<Any>()
CHECK_NOT_NULL<Any>(arg0 = x) /*as Foo<Any> */.extFoo<Any>()
CHECK_NOT_NULL<Any>(arg0 = x) /*as Bar<Any> */.extBar<Any>()
}
fun test_3(x: Any) {
@@ -65,13 +65,13 @@ fun test_3(x: Any) {
EQEQ(arg0 = tmp_2, arg1 = null) -> materialize<Any>()
else -> tmp_2
}
}.extFoo<Any>()
} /*as Foo<Any> */.extFoo<Any>()
{ // BLOCK
val tmp_3: Any = x
when {
EQEQ(arg0 = tmp_3, arg1 = null) -> materialize<Any>()
else -> tmp_3
}
}.extBar<Any>()
} /*as Bar<Any> */.extBar<Any>()
}