FIR2IR: avoid redundant implicit cast creation

Related to KT-62544
This commit is contained in:
Mikhail Glukhikh
2023-10-27 17:08:58 +02:00
committed by Space Team
parent ba06af9d7f
commit 168b3416ea
6 changed files with 22 additions and 260 deletions
@@ -68,13 +68,9 @@ FILE fqName:<root> fileName:/smartCastAside.kt
then: BLOCK type=kotlin.Unit origin=null
CALL 'public abstract fun foo (): kotlin.Unit declared in <root>.A' type=kotlin.Unit origin=null
$this: TYPE_OP type=<root>.C origin=IMPLICIT_CAST typeOperand=<root>.C
TYPE_OP type=<root>.A origin=IMPLICIT_CAST typeOperand=<root>.A
GET_VAR 'param: <root>.B declared in <root>.test' type=<root>.B origin=null
GET_VAR 'param: <root>.B declared in <root>.test' type=<root>.B origin=null
CALL 'public abstract fun bar (): kotlin.Unit declared in <root>.B' type=kotlin.Unit origin=null
$this: TYPE_OP type=<root>.B origin=IMPLICIT_CAST typeOperand=<root>.B
TYPE_OP type=<root>.A origin=IMPLICIT_CAST typeOperand=<root>.A
GET_VAR 'param: <root>.B declared in <root>.test' type=<root>.B origin=null
$this: GET_VAR 'param: <root>.B declared in <root>.test' type=<root>.B origin=null
CALL 'public abstract fun baz (): kotlin.Unit declared in <root>.C' type=kotlin.Unit origin=null
$this: TYPE_OP type=<root>.C origin=IMPLICIT_CAST typeOperand=<root>.C
TYPE_OP type=<root>.A origin=IMPLICIT_CAST typeOperand=<root>.A
GET_VAR 'param: <root>.B declared in <root>.test' type=<root>.B origin=null
GET_VAR 'param: <root>.B declared in <root>.test' type=<root>.B origin=null
@@ -16,9 +16,9 @@ interface C : A {
fun test(param: B) {
when {
param is C -> { // BLOCK
param /*as A */ /*as C */.foo()
param /*as A */ /*as B */.bar()
param /*as A */ /*as C */.baz()
param /*as C */.foo()
param.bar()
param /*as C */.baz()
}
}
}