FIR2IR: Fix complex cases of smart cast expressions used as dispatch receiver

It might be not only <ExpressionWithSmartCast>(a).foo(), but also
id(<ExpressionWithSmartCast>(a)).foo() and many other cases
This commit is contained in:
Denis.Zharkov
2021-01-27 19:51:14 +03:00
parent b3b1eb57ae
commit 5c62ee4ba8
45 changed files with 193 additions and 91 deletions
@@ -21,7 +21,7 @@ operator fun Int?.inc(): Int? {
val tmp0_safe_receiver: Int? = <this>
when {
EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null
else -> tmp0_safe_receiver.inc()
else -> tmp0_safe_receiver /*as Int */.inc()
}
}
}
@@ -38,14 +38,14 @@ fun testProperty(nc: C?) {
val tmp1_safe_receiver: C? = nc
when {
EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null
else -> tmp1_safe_receiver.<get-p>()
else -> tmp1_safe_receiver /*as C */.<get-p>()
}
}
{ // BLOCK
val tmp2_safe_receiver: C? = nc
when {
EQEQ(arg0 = tmp2_safe_receiver, arg1 = null) -> null
else -> tmp2_safe_receiver.<set-p>(value = <unary>.inc())
else -> tmp2_safe_receiver /*as C */.<set-p>(value = <unary>.inc())
}
} /*~> Unit */
<unary> /*~> Unit */
@@ -56,7 +56,7 @@ fun testArrayAccess(nc: C?) {
val tmp3_safe_receiver: C? = nc
when {
EQEQ(arg0 = tmp3_safe_receiver, arg1 = null) -> null
else -> tmp3_safe_receiver.<get-p>()
else -> tmp3_safe_receiver /*as C */.<get-p>()
}
}
val <index0>: Int = 0