[FIR2IR] Don't insert not-needed upcasts for smartcasted expressions

Related to KT-63257
This commit is contained in:
Dmitriy Novozhilov
2023-11-09 10:51:17 +02:00
committed by Space Team
parent aa1a997f8a
commit c70a6425f5
18 changed files with 55 additions and 62 deletions
@@ -180,8 +180,7 @@ FILE fqName:<root> fileName:/caoWithAdaptationForSam.kt
VAR IR_TEMPORARY_VARIABLE name:tmp_6 type:<root>.A [val]
GET_OBJECT 'CLASS OBJECT name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.A
VAR IR_TEMPORARY_VARIABLE name:tmp_7 type:kotlin.Any [val]
TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'fn: kotlin.Function1<kotlin.Int, kotlin.Unit> declared in <root>.test4' type=kotlin.Function1<kotlin.Int, kotlin.Unit> origin=null
GET_VAR 'fn: kotlin.Function1<kotlin.Int, kotlin.Unit> declared in <root>.test4' type=kotlin.Function1<kotlin.Int, kotlin.Unit> origin=null
CALL 'public final fun set (i: <root>.IFoo, newValue: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
$receiver: GET_VAR 'val tmp_6: <root>.A declared in <root>.test4' type=<root>.A origin=null
i: GET_VAR 'val tmp_7: kotlin.Any declared in <root>.test4' type=kotlin.Any origin=null
@@ -84,7 +84,7 @@ fun test4(fn: Function1<Int, Unit>) {
fn is IFoo -> { // BLOCK
{ // BLOCK
val tmp_6: A = A
val tmp_7: Any = fn /*as Any */
val tmp_7: Any = fn
tmp_6.set(i = tmp_7, newValue = tmp_6.get(i = tmp_7).plus(other = 1))
}
}