[FIR2IR] Coerce last operator in a loop to Unit

One of many fixes for https://youtrack.jetbrains.com/issue/KT-59781/K2-investigate-implicit-cast-generation-in-fir2ir-vs-psi2ir

Merge-request: KT-MR-12629
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
This commit is contained in:
Vladimir Sukharev
2023-10-19 09:53:46 +00:00
committed by Space Team
parent 5df8ac4d1a
commit 9b9ddb760a
13 changed files with 102 additions and 86 deletions
@@ -157,7 +157,7 @@ class Fir2IrImplicitCastInserter(
override fun visitDoWhileLoop(doWhileLoop: FirDoWhileLoop, data: IrElement): IrElement {
val loop = data as IrDoWhileLoop
(loop.body as? IrContainerExpression)?.let {
loop.body = it.insertImplicitCasts()
loop.body = it.insertImplicitCasts(coerceLastExpressionToUnit = true)
}
return data
}
@@ -165,7 +165,7 @@ class Fir2IrImplicitCastInserter(
override fun visitWhileLoop(whileLoop: FirWhileLoop, data: IrElement): IrElement {
val loop = data as IrWhileLoop
(loop.body as? IrContainerExpression)?.let {
loop.body = it.insertImplicitCasts()
loop.body = it.insertImplicitCasts(coerceLastExpressionToUnit = true)
}
return data
}
@@ -339,7 +339,7 @@ class Fir2IrImplicitCastInserter(
)
}
private fun coerceToUnitIfNeeded(original: IrExpression, irBuiltIns: IrBuiltIns): IrExpression {
internal fun coerceToUnitIfNeeded(original: IrExpression, irBuiltIns: IrBuiltIns): IrExpression {
val valueType = original.type
return if (valueType.isUnit() || valueType.isNothing())
original
@@ -45,6 +45,7 @@ import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.types.impl.IrErrorClassImpl
import org.jetbrains.kotlin.ir.types.impl.IrErrorTypeImpl
import org.jetbrains.kotlin.ir.util.coerceToUnit
import org.jetbrains.kotlin.ir.util.constructors
import org.jetbrains.kotlin.ir.util.defaultConstructor
import org.jetbrains.kotlin.lexer.KtTokens
@@ -1295,7 +1296,10 @@ class Fir2IrVisitor(
loopMap[doWhileLoop] = this
label = doWhileLoop.label?.name
body = runUnless(doWhileLoop.block is FirEmptyExpressionBlock) {
doWhileLoop.block.convertToIrExpressionOrBlock(origin)
Fir2IrImplicitCastInserter.coerceToUnitIfNeeded(
doWhileLoop.block.convertToIrExpressionOrBlock(origin),
irBuiltIns
)
}
condition = convertToIrExpression(doWhileLoop.condition)
loopMap.remove(doWhileLoop)
@@ -1360,7 +1364,10 @@ class Fir2IrVisitor(
)
}
} else {
firLoopBody.convertToIrExpressionOrBlock(origin)
Fir2IrImplicitCastInserter.coerceToUnitIfNeeded(
firLoopBody.convertToIrExpressionOrBlock(origin),
irBuiltIns
)
}
}
loopMap.remove(whileLoop)
@@ -84,13 +84,14 @@ FILE fqName:<root> fileName:/noSymbolForIntRangeIterator.kt
VAR FOR_LOOP_VARIABLE name:j type:kotlin.Int [val]
CALL 'public final fun next (): kotlin.Int declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT
$this: GET_VAR 'val tmp_2: kotlin.collections.IntIterator declared in <root>.test.localFunc.<anonymous>' type=kotlin.collections.IntIterator origin=null
BLOCK type=java.lang.StringBuilder origin=null
CALL 'public final fun appendLine (value: kotlin.String?): java.lang.StringBuilder declared in kotlin.text' type=java.lang.StringBuilder origin=null
$receiver: GET_VAR '$this$buildString: java.lang.StringBuilder declared in <root>.test.localFunc.<anonymous>' type=java.lang.StringBuilder origin=null
value: STRING_CONCATENATION type=kotlin.String
CALL 'public final fun times (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=MUL
$this: GET_VAR 'val i: kotlin.Int declared in <root>.test.localFunc' type=kotlin.Int origin=null
other: GET_VAR 'val j: kotlin.Int declared in <root>.test.localFunc.<anonymous>' type=kotlin.Int origin=null
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=java.lang.StringBuilder origin=null
CALL 'public final fun appendLine (value: kotlin.String?): java.lang.StringBuilder declared in kotlin.text' type=java.lang.StringBuilder origin=null
$receiver: GET_VAR '$this$buildString: java.lang.StringBuilder declared in <root>.test.localFunc.<anonymous>' type=java.lang.StringBuilder origin=null
value: STRING_CONCATENATION type=kotlin.String
CALL 'public final fun times (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=MUL
$this: GET_VAR 'val i: kotlin.Int declared in <root>.test.localFunc' type=kotlin.Int origin=null
other: GET_VAR 'val j: kotlin.Int declared in <root>.test.localFunc.<anonymous>' type=kotlin.Int origin=null
CALL 'public final fun takeString (s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
s: GET_VAR 'val s: kotlin.String declared in <root>.test.localFunc' type=kotlin.String origin=null
CALL 'local final fun localFunc (): kotlin.Unit declared in <root>.test' type=kotlin.Unit origin=null
@@ -111,11 +111,12 @@ FILE fqName:<root> fileName:/breakContinueInLoopHeader.kt
BLOCK type=kotlin.Unit origin=null
DO_WHILE label=Inner origin=DO_WHILE_LOOP
body: COMPOSITE type=kotlin.Unit origin=null
BLOCK type=kotlin.Int origin=null
SET_VAR 'var j: kotlin.Int declared in <root>.test5' type=kotlin.Unit origin=PREFIX_INCR
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'var j: kotlin.Int declared in <root>.test5' type=kotlin.Int origin=null
GET_VAR 'var j: kotlin.Int declared in <root>.test5' type=kotlin.Int origin=null
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=null
SET_VAR 'var j: kotlin.Int declared in <root>.test5' type=kotlin.Unit origin=PREFIX_INCR
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'var j: kotlin.Int declared in <root>.test5' type=kotlin.Int origin=null
GET_VAR 'var j: kotlin.Int declared in <root>.test5' type=kotlin.Int origin=null
condition: WHEN type=kotlin.Boolean origin=IF
BRANCH
if: CALL 'public final fun greaterOrEqual (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GTEQ
@@ -69,7 +69,7 @@ fun test5() {
{ // BLOCK
j = j.inc()
j
}
} /*~> Unit */
// } while (when {
greaterOrEqual(arg0 = j, arg1 = 3) -> false
else -> break@Inner
@@ -11,25 +11,27 @@ FILE fqName:<root> fileName:/whileDoWhile.kt
condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
arg0: GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=5
body: BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
SET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Unit origin=POSTFIX_INCR
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_0: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
GET_VAR 'val tmp_0: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
body: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
SET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Unit origin=POSTFIX_INCR
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_0: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
GET_VAR 'val tmp_0: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
WHILE label=null origin=WHILE_LOOP
condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
arg0: GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=10
body: BLOCK type=kotlin.Unit origin=null
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val]
GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
SET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Unit origin=POSTFIX_INCR
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_1: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
GET_VAR 'val tmp_1: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val]
GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
SET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Unit origin=POSTFIX_INCR
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_1: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
GET_VAR 'val tmp_1: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
BLOCK type=kotlin.Unit origin=null
DO_WHILE label=null origin=DO_WHILE_LOOP
condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
@@ -43,26 +45,28 @@ FILE fqName:<root> fileName:/whileDoWhile.kt
arg1: CONST Int type=kotlin.Int value=7
BLOCK type=kotlin.Unit origin=null
DO_WHILE label=null origin=DO_WHILE_LOOP
body: BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:kotlin.Int [val]
GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
SET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Unit origin=POSTFIX_INCR
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_2: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
GET_VAR 'val tmp_2: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
body: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:kotlin.Int [val]
GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
SET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Unit origin=POSTFIX_INCR
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_2: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
GET_VAR 'val tmp_2: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
arg0: GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=15
BLOCK type=kotlin.Unit origin=null
DO_WHILE label=null origin=DO_WHILE_LOOP
body: COMPOSITE type=kotlin.Unit origin=null
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.Int [val]
GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
SET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Unit origin=POSTFIX_INCR
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_3: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
GET_VAR 'val tmp_3: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.Int [val]
GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
SET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Unit origin=POSTFIX_INCR
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_3: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
GET_VAR 'val tmp_3: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
arg0: GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=20
@@ -5,13 +5,13 @@ fun test() {
val tmp_0: Int = x
x = tmp_0.inc()
tmp_0
}
} /*~> Unit */
while (less(arg0 = x, arg1 = 10)) { // BLOCK
{ // BLOCK
val tmp_1: Int = x
x = tmp_1.inc()
tmp_1
}
} /*~> Unit */
}
{ // BLOCK
do while (less(arg0 = x, arg1 = 0))
@@ -25,7 +25,7 @@ fun test() {
val tmp_2: Int = x
x = tmp_2.inc()
tmp_2
} while (less(arg0 = x, arg1 = 15))
} /*~> Unit */ while (less(arg0 = x, arg1 = 15))
}
{ // BLOCK
do// COMPOSITE {
@@ -33,7 +33,7 @@ fun test() {
val tmp_3: Int = x
x = tmp_3.inc()
tmp_3
}
} /*~> Unit */
// } while (less(arg0 = x, arg1 = 20))
}
}
@@ -545,15 +545,16 @@ FILE fqName:<root> fileName:/ArrayMap.kt
BLOCK type=kotlin.Unit origin=null
DO_WHILE label=null origin=DO_WHILE_LOOP
body: COMPOSITE type=kotlin.Unit origin=null
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val]
CALL 'private final fun <get-index> (): kotlin.Int declared in <root>.ArrayMapImpl.iterator.<no name provided>' type=kotlin.Int origin=GET_PROPERTY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val]
CALL 'private final fun <get-index> (): kotlin.Int declared in <root>.ArrayMapImpl.iterator.<no name provided>' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=<root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> origin=null
CALL 'private final fun <set-index> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.ArrayMapImpl.iterator.<no name provided>' type=kotlin.Unit origin=POSTFIX_INCR
$this: GET_VAR '<this>: <root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=<root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> origin=null
CALL 'private final fun <set-index> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.ArrayMapImpl.iterator.<no name provided>' type=kotlin.Unit origin=POSTFIX_INCR
$this: GET_VAR '<this>: <root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=<root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> origin=null
<set-?>: CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_1: kotlin.Int declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=kotlin.Int origin=null
GET_VAR 'val tmp_1: kotlin.Int declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=kotlin.Int origin=null
<set-?>: CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_1: kotlin.Int declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=kotlin.Int origin=null
GET_VAR 'val tmp_1: kotlin.Int declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=kotlin.Int origin=null
condition: WHEN type=kotlin.Boolean origin=ANDAND
BRANCH
if: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
@@ -235,7 +235,7 @@ internal class ArrayMapImpl<T : Any> : ArrayMap<T> {
val tmp_1: Int = <this>.<get-index>()
<this>.<set-index>(<set-?> = tmp_1.inc())
tmp_1
}
} /*~> Unit */
// } while (when {
less(arg0 = <this>.<get-index>(), arg1 = <this>.<get-data>().<get-size>()) -> EQEQ(arg0 = <this>.<get-data>().get(index = <this>.<get-index>()), arg1 = null)
else -> false
@@ -187,24 +187,25 @@ FILE fqName:<root> fileName:/DeepCopyIrTree.kt
VAR name:otherTypeParameter type:<root>.IrTypeParameter [val]
CALL 'public final fun component2 (): B of kotlin.Pair declared in kotlin.Pair' type=<root>.IrTypeParameter origin=COMPONENT_N(index=2)
$this: GET_VAR 'val tmp_1: kotlin.Pair<<root>.IrTypeParameter, <root>.IrTypeParameter> declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>' type=kotlin.Pair<<root>.IrTypeParameter, <root>.IrTypeParameter> origin=null
BLOCK type=kotlin.collections.MutableList<<root>.IrType> origin=null
CALL 'public final fun mapTo <T, R, C> (destination: C of kotlin.collections.mapTo, transform: kotlin.Function1<T of kotlin.collections.mapTo, R of kotlin.collections.mapTo>): C of kotlin.collections.mapTo declared in kotlin.collections' type=kotlin.collections.MutableList<<root>.IrType> origin=null
<T>: <root>.IrType
<R>: <root>.IrType
<C>: kotlin.collections.MutableList<<root>.IrType>
$receiver: CALL 'public abstract fun <get-superTypes> (): kotlin.collections.MutableList<<root>.IrType> declared in <root>.IrTypeParameter' type=kotlin.collections.MutableList<<root>.IrType> origin=GET_PROPERTY
$this: GET_VAR 'val otherTypeParameter: <root>.IrTypeParameter declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>' type=<root>.IrTypeParameter origin=null
destination: CALL 'public abstract fun <get-superTypes> (): kotlin.collections.MutableList<<root>.IrType> declared in <root>.IrTypeParameter' type=kotlin.collections.MutableList<<root>.IrType> origin=GET_PROPERTY
$this: GET_VAR 'val thisTypeParameter: <root>.IrTypeParameter declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>' type=<root>.IrTypeParameter origin=null
transform: FUN_EXPR type=kotlin.Function1<<root>.IrType, <root>.IrType> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:<root>.IrType) returnType:<root>.IrType
VALUE_PARAMETER name:it index:0 type:<root>.IrType
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: <root>.IrType): <root>.IrType declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>'
CALL 'public abstract fun remapType (type: <root>.IrType): <root>.IrType declared in <root>.TypeRemapper' type=<root>.IrType origin=null
$this: CALL 'private final fun <get-typeRemapper> (): <root>.TypeRemapper declared in <root>.DeepCopyIrTreeWithSymbols' type=<root>.TypeRemapper origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.DeepCopyIrTreeWithSymbols declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom' type=<root>.DeepCopyIrTreeWithSymbols origin=null
type: GET_VAR 'it: <root>.IrType declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>.<anonymous>' type=<root>.IrType origin=null
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.collections.MutableList<<root>.IrType> origin=null
CALL 'public final fun mapTo <T, R, C> (destination: C of kotlin.collections.mapTo, transform: kotlin.Function1<T of kotlin.collections.mapTo, R of kotlin.collections.mapTo>): C of kotlin.collections.mapTo declared in kotlin.collections' type=kotlin.collections.MutableList<<root>.IrType> origin=null
<T>: <root>.IrType
<R>: <root>.IrType
<C>: kotlin.collections.MutableList<<root>.IrType>
$receiver: CALL 'public abstract fun <get-superTypes> (): kotlin.collections.MutableList<<root>.IrType> declared in <root>.IrTypeParameter' type=kotlin.collections.MutableList<<root>.IrType> origin=GET_PROPERTY
$this: GET_VAR 'val otherTypeParameter: <root>.IrTypeParameter declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>' type=<root>.IrTypeParameter origin=null
destination: CALL 'public abstract fun <get-superTypes> (): kotlin.collections.MutableList<<root>.IrType> declared in <root>.IrTypeParameter' type=kotlin.collections.MutableList<<root>.IrType> origin=GET_PROPERTY
$this: GET_VAR 'val thisTypeParameter: <root>.IrTypeParameter declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>' type=<root>.IrTypeParameter origin=null
transform: FUN_EXPR type=kotlin.Function1<<root>.IrType, <root>.IrType> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:<root>.IrType) returnType:<root>.IrType
VALUE_PARAMETER name:it index:0 type:<root>.IrType
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: <root>.IrType): <root>.IrType declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>'
CALL 'public abstract fun remapType (type: <root>.IrType): <root>.IrType declared in <root>.TypeRemapper' type=<root>.IrType origin=null
$this: CALL 'private final fun <get-typeRemapper> (): <root>.TypeRemapper declared in <root>.DeepCopyIrTreeWithSymbols' type=<root>.TypeRemapper origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.DeepCopyIrTreeWithSymbols declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom' type=<root>.DeepCopyIrTreeWithSymbols origin=null
type: GET_VAR 'it: <root>.IrType declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>.<anonymous>' type=<root>.IrType origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
@@ -64,7 +64,7 @@ class DeepCopyIrTreeWithSymbols {
return <this>.<get-typeRemapper>().remapType(type = it)
}
)
}
} /*~> Unit */
}
}
}
@@ -26,12 +26,13 @@ FILE fqName:<root> fileName:/coercionInLoop.kt
STRING_CONCATENATION type=kotlin.String
CONST String type=kotlin.String value="Fail "
GET_VAR 'var i: kotlin.Int declared in <root>.box' type=kotlin.Int origin=null
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
GET_VAR 'var i: kotlin.Int declared in <root>.box' type=kotlin.Int origin=null
SET_VAR 'var i: kotlin.Int declared in <root>.box' type=kotlin.Unit origin=POSTFIX_INCR
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_0: kotlin.Int declared in <root>.box' type=kotlin.Int origin=null
GET_VAR 'val tmp_0: kotlin.Int declared in <root>.box' type=kotlin.Int origin=null
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
GET_VAR 'var i: kotlin.Int declared in <root>.box' type=kotlin.Int origin=null
SET_VAR 'var i: kotlin.Int declared in <root>.box' type=kotlin.Unit origin=POSTFIX_INCR
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_0: kotlin.Int declared in <root>.box' type=kotlin.Int origin=null
GET_VAR 'val tmp_0: kotlin.Int declared in <root>.box' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CONST String type=kotlin.String value="OK"
@@ -10,7 +10,7 @@ fun box(): String {
val tmp_0: Int = i
i = tmp_0.inc()
tmp_0
}
} /*~> Unit */
}
return "OK"
}