[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:
committed by
Space Team
parent
5df8ac4d1a
commit
9b9ddb760a
+3
-3
@@ -157,7 +157,7 @@ class Fir2IrImplicitCastInserter(
|
|||||||
override fun visitDoWhileLoop(doWhileLoop: FirDoWhileLoop, data: IrElement): IrElement {
|
override fun visitDoWhileLoop(doWhileLoop: FirDoWhileLoop, data: IrElement): IrElement {
|
||||||
val loop = data as IrDoWhileLoop
|
val loop = data as IrDoWhileLoop
|
||||||
(loop.body as? IrContainerExpression)?.let {
|
(loop.body as? IrContainerExpression)?.let {
|
||||||
loop.body = it.insertImplicitCasts()
|
loop.body = it.insertImplicitCasts(coerceLastExpressionToUnit = true)
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
@@ -165,7 +165,7 @@ class Fir2IrImplicitCastInserter(
|
|||||||
override fun visitWhileLoop(whileLoop: FirWhileLoop, data: IrElement): IrElement {
|
override fun visitWhileLoop(whileLoop: FirWhileLoop, data: IrElement): IrElement {
|
||||||
val loop = data as IrWhileLoop
|
val loop = data as IrWhileLoop
|
||||||
(loop.body as? IrContainerExpression)?.let {
|
(loop.body as? IrContainerExpression)?.let {
|
||||||
loop.body = it.insertImplicitCasts()
|
loop.body = it.insertImplicitCasts(coerceLastExpressionToUnit = true)
|
||||||
}
|
}
|
||||||
return data
|
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
|
val valueType = original.type
|
||||||
return if (valueType.isUnit() || valueType.isNothing())
|
return if (valueType.isUnit() || valueType.isNothing())
|
||||||
original
|
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.*
|
||||||
import org.jetbrains.kotlin.ir.types.impl.IrErrorClassImpl
|
import org.jetbrains.kotlin.ir.types.impl.IrErrorClassImpl
|
||||||
import org.jetbrains.kotlin.ir.types.impl.IrErrorTypeImpl
|
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.constructors
|
||||||
import org.jetbrains.kotlin.ir.util.defaultConstructor
|
import org.jetbrains.kotlin.ir.util.defaultConstructor
|
||||||
import org.jetbrains.kotlin.lexer.KtTokens
|
import org.jetbrains.kotlin.lexer.KtTokens
|
||||||
@@ -1295,7 +1296,10 @@ class Fir2IrVisitor(
|
|||||||
loopMap[doWhileLoop] = this
|
loopMap[doWhileLoop] = this
|
||||||
label = doWhileLoop.label?.name
|
label = doWhileLoop.label?.name
|
||||||
body = runUnless(doWhileLoop.block is FirEmptyExpressionBlock) {
|
body = runUnless(doWhileLoop.block is FirEmptyExpressionBlock) {
|
||||||
doWhileLoop.block.convertToIrExpressionOrBlock(origin)
|
Fir2IrImplicitCastInserter.coerceToUnitIfNeeded(
|
||||||
|
doWhileLoop.block.convertToIrExpressionOrBlock(origin),
|
||||||
|
irBuiltIns
|
||||||
|
)
|
||||||
}
|
}
|
||||||
condition = convertToIrExpression(doWhileLoop.condition)
|
condition = convertToIrExpression(doWhileLoop.condition)
|
||||||
loopMap.remove(doWhileLoop)
|
loopMap.remove(doWhileLoop)
|
||||||
@@ -1360,7 +1364,10 @@ class Fir2IrVisitor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
firLoopBody.convertToIrExpressionOrBlock(origin)
|
Fir2IrImplicitCastInserter.coerceToUnitIfNeeded(
|
||||||
|
firLoopBody.convertToIrExpressionOrBlock(origin),
|
||||||
|
irBuiltIns
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loopMap.remove(whileLoop)
|
loopMap.remove(whileLoop)
|
||||||
|
|||||||
@@ -84,13 +84,14 @@ FILE fqName:<root> fileName:/noSymbolForIntRangeIterator.kt
|
|||||||
VAR FOR_LOOP_VARIABLE name:j type:kotlin.Int [val]
|
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
|
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
|
$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
|
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
CALL 'public final fun appendLine (value: kotlin.String?): java.lang.StringBuilder declared in kotlin.text' type=java.lang.StringBuilder origin=null
|
BLOCK 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
|
CALL 'public final fun appendLine (value: kotlin.String?): java.lang.StringBuilder declared in kotlin.text' type=java.lang.StringBuilder origin=null
|
||||||
value: STRING_CONCATENATION type=kotlin.String
|
$receiver: GET_VAR '$this$buildString: java.lang.StringBuilder declared in <root>.test.localFunc.<anonymous>' type=java.lang.StringBuilder origin=null
|
||||||
CALL 'public final fun times (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=MUL
|
value: STRING_CONCATENATION type=kotlin.String
|
||||||
$this: GET_VAR 'val i: kotlin.Int declared in <root>.test.localFunc' type=kotlin.Int origin=null
|
CALL 'public final fun times (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=MUL
|
||||||
other: GET_VAR 'val j: kotlin.Int declared in <root>.test.localFunc.<anonymous>' type=kotlin.Int origin=null
|
$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
|
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
|
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
|
CALL 'local final fun localFunc (): kotlin.Unit declared in <root>.test' type=kotlin.Unit origin=null
|
||||||
|
|||||||
+6
-5
@@ -111,11 +111,12 @@ FILE fqName:<root> fileName:/breakContinueInLoopHeader.kt
|
|||||||
BLOCK type=kotlin.Unit origin=null
|
BLOCK type=kotlin.Unit origin=null
|
||||||
DO_WHILE label=Inner origin=DO_WHILE_LOOP
|
DO_WHILE label=Inner origin=DO_WHILE_LOOP
|
||||||
body: COMPOSITE type=kotlin.Unit origin=null
|
body: COMPOSITE type=kotlin.Unit origin=null
|
||||||
BLOCK type=kotlin.Int origin=null
|
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
SET_VAR 'var j: kotlin.Int declared in <root>.test5' type=kotlin.Unit origin=PREFIX_INCR
|
BLOCK type=kotlin.Int origin=null
|
||||||
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
|
SET_VAR 'var j: kotlin.Int declared in <root>.test5' type=kotlin.Unit origin=PREFIX_INCR
|
||||||
$this: GET_VAR 'var j: kotlin.Int declared in <root>.test5' type=kotlin.Int origin=null
|
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
|
||||||
GET_VAR 'var j: kotlin.Int declared in <root>.test5' 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
|
condition: WHEN type=kotlin.Boolean origin=IF
|
||||||
BRANCH
|
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
|
if: CALL 'public final fun greaterOrEqual (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GTEQ
|
||||||
|
|||||||
+1
-1
@@ -69,7 +69,7 @@ fun test5() {
|
|||||||
{ // BLOCK
|
{ // BLOCK
|
||||||
j = j.inc()
|
j = j.inc()
|
||||||
j
|
j
|
||||||
}
|
} /*~> Unit */
|
||||||
// } while (when {
|
// } while (when {
|
||||||
greaterOrEqual(arg0 = j, arg1 = 3) -> false
|
greaterOrEqual(arg0 = j, arg1 = 3) -> false
|
||||||
else -> break@Inner
|
else -> break@Inner
|
||||||
|
|||||||
+32
-28
@@ -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
|
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
|
arg0: GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
|
||||||
arg1: CONST Int type=kotlin.Int value=5
|
arg1: CONST Int type=kotlin.Int value=5
|
||||||
body: BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
body: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
|
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
|
||||||
SET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Unit origin=POSTFIX_INCR
|
GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
|
||||||
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
|
SET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Unit origin=POSTFIX_INCR
|
||||||
$this: GET_VAR 'val tmp_0: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
|
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
|
||||||
GET_VAR 'val tmp_0: kotlin.Int declared in <root>.test' 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
|
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
|
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
|
arg0: GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
|
||||||
arg1: CONST Int type=kotlin.Int value=10
|
arg1: CONST Int type=kotlin.Int value=10
|
||||||
body: BLOCK type=kotlin.Unit origin=null
|
body: BLOCK type=kotlin.Unit origin=null
|
||||||
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val]
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
|
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val]
|
||||||
SET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Unit origin=POSTFIX_INCR
|
GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
|
||||||
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
|
SET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Unit origin=POSTFIX_INCR
|
||||||
$this: GET_VAR 'val tmp_1: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
|
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
|
||||||
GET_VAR 'val tmp_1: kotlin.Int declared in <root>.test' 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
|
BLOCK type=kotlin.Unit origin=null
|
||||||
DO_WHILE label=null origin=DO_WHILE_LOOP
|
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
|
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
|
arg1: CONST Int type=kotlin.Int value=7
|
||||||
BLOCK type=kotlin.Unit origin=null
|
BLOCK type=kotlin.Unit origin=null
|
||||||
DO_WHILE label=null origin=DO_WHILE_LOOP
|
DO_WHILE label=null origin=DO_WHILE_LOOP
|
||||||
body: BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
body: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:kotlin.Int [val]
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
|
VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:kotlin.Int [val]
|
||||||
SET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Unit origin=POSTFIX_INCR
|
GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
|
||||||
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
|
SET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Unit origin=POSTFIX_INCR
|
||||||
$this: GET_VAR 'val tmp_2: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
|
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
|
||||||
GET_VAR 'val tmp_2: kotlin.Int declared in <root>.test' 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
|
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
|
arg0: GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
|
||||||
arg1: CONST Int type=kotlin.Int value=15
|
arg1: CONST Int type=kotlin.Int value=15
|
||||||
BLOCK type=kotlin.Unit origin=null
|
BLOCK type=kotlin.Unit origin=null
|
||||||
DO_WHILE label=null origin=DO_WHILE_LOOP
|
DO_WHILE label=null origin=DO_WHILE_LOOP
|
||||||
body: COMPOSITE type=kotlin.Unit origin=null
|
body: COMPOSITE type=kotlin.Unit origin=null
|
||||||
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.Int [val]
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
|
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.Int [val]
|
||||||
SET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Unit origin=POSTFIX_INCR
|
GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
|
||||||
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
|
SET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Unit origin=POSTFIX_INCR
|
||||||
$this: GET_VAR 'val tmp_3: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
|
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
|
||||||
GET_VAR 'val tmp_3: kotlin.Int declared in <root>.test' 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
|
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
|
arg0: GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
|
||||||
arg1: CONST Int type=kotlin.Int value=20
|
arg1: CONST Int type=kotlin.Int value=20
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ fun test() {
|
|||||||
val tmp_0: Int = x
|
val tmp_0: Int = x
|
||||||
x = tmp_0.inc()
|
x = tmp_0.inc()
|
||||||
tmp_0
|
tmp_0
|
||||||
}
|
} /*~> Unit */
|
||||||
while (less(arg0 = x, arg1 = 10)) { // BLOCK
|
while (less(arg0 = x, arg1 = 10)) { // BLOCK
|
||||||
{ // BLOCK
|
{ // BLOCK
|
||||||
val tmp_1: Int = x
|
val tmp_1: Int = x
|
||||||
x = tmp_1.inc()
|
x = tmp_1.inc()
|
||||||
tmp_1
|
tmp_1
|
||||||
}
|
} /*~> Unit */
|
||||||
}
|
}
|
||||||
{ // BLOCK
|
{ // BLOCK
|
||||||
do while (less(arg0 = x, arg1 = 0))
|
do while (less(arg0 = x, arg1 = 0))
|
||||||
@@ -25,7 +25,7 @@ fun test() {
|
|||||||
val tmp_2: Int = x
|
val tmp_2: Int = x
|
||||||
x = tmp_2.inc()
|
x = tmp_2.inc()
|
||||||
tmp_2
|
tmp_2
|
||||||
} while (less(arg0 = x, arg1 = 15))
|
} /*~> Unit */ while (less(arg0 = x, arg1 = 15))
|
||||||
}
|
}
|
||||||
{ // BLOCK
|
{ // BLOCK
|
||||||
do// COMPOSITE {
|
do// COMPOSITE {
|
||||||
@@ -33,7 +33,7 @@ fun test() {
|
|||||||
val tmp_3: Int = x
|
val tmp_3: Int = x
|
||||||
x = tmp_3.inc()
|
x = tmp_3.inc()
|
||||||
tmp_3
|
tmp_3
|
||||||
}
|
} /*~> Unit */
|
||||||
// } while (less(arg0 = x, arg1 = 20))
|
// } while (less(arg0 = x, arg1 = 20))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -545,15 +545,16 @@ FILE fqName:<root> fileName:/ArrayMap.kt
|
|||||||
BLOCK type=kotlin.Unit origin=null
|
BLOCK type=kotlin.Unit origin=null
|
||||||
DO_WHILE label=null origin=DO_WHILE_LOOP
|
DO_WHILE label=null origin=DO_WHILE_LOOP
|
||||||
body: COMPOSITE type=kotlin.Unit origin=null
|
body: COMPOSITE type=kotlin.Unit origin=null
|
||||||
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val]
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
CALL 'private final fun <get-index> (): kotlin.Int declared in <root>.ArrayMapImpl.iterator.<no name provided>' type=kotlin.Int origin=GET_PROPERTY
|
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
|
$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
|
<set-?>: CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
|
||||||
$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
|
$this: 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
|
GET_VAR 'val tmp_1: kotlin.Int declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' 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
|
condition: WHEN type=kotlin.Boolean origin=ANDAND
|
||||||
BRANCH
|
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
|
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>()
|
val tmp_1: Int = <this>.<get-index>()
|
||||||
<this>.<set-index>(<set-?> = tmp_1.inc())
|
<this>.<set-index>(<set-?> = tmp_1.inc())
|
||||||
tmp_1
|
tmp_1
|
||||||
}
|
} /*~> Unit */
|
||||||
// } while (when {
|
// } 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)
|
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
|
else -> false
|
||||||
|
|||||||
@@ -187,24 +187,25 @@ FILE fqName:<root> fileName:/DeepCopyIrTree.kt
|
|||||||
VAR name:otherTypeParameter type:<root>.IrTypeParameter [val]
|
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)
|
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
|
$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
|
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
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
|
BLOCK type=kotlin.collections.MutableList<<root>.IrType> origin=null
|
||||||
<T>: <root>.IrType
|
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
|
||||||
<R>: <root>.IrType
|
<T>: <root>.IrType
|
||||||
<C>: kotlin.collections.MutableList<<root>.IrType>
|
<R>: <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
|
<C>: kotlin.collections.MutableList<<root>.IrType>
|
||||||
$this: GET_VAR 'val otherTypeParameter: <root>.IrTypeParameter declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>' type=<root>.IrTypeParameter origin=null
|
$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
|
||||||
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 otherTypeParameter: <root>.IrTypeParameter declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>' type=<root>.IrTypeParameter origin=null
|
||||||
$this: GET_VAR 'val thisTypeParameter: <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
|
||||||
transform: FUN_EXPR type=kotlin.Function1<<root>.IrType, <root>.IrType> origin=LAMBDA
|
$this: GET_VAR 'val thisTypeParameter: <root>.IrTypeParameter declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>' type=<root>.IrTypeParameter origin=null
|
||||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:<root>.IrType) returnType:<root>.IrType
|
transform: FUN_EXPR type=kotlin.Function1<<root>.IrType, <root>.IrType> origin=LAMBDA
|
||||||
VALUE_PARAMETER name:it index:0 type:<root>.IrType
|
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:<root>.IrType) returnType:<root>.IrType
|
||||||
BLOCK_BODY
|
VALUE_PARAMETER name:it index:0 type:<root>.IrType
|
||||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: <root>.IrType): <root>.IrType declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>'
|
BLOCK_BODY
|
||||||
CALL 'public abstract fun remapType (type: <root>.IrType): <root>.IrType declared in <root>.TypeRemapper' type=<root>.IrType origin=null
|
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: <root>.IrType): <root>.IrType declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>'
|
||||||
$this: CALL 'private final fun <get-typeRemapper> (): <root>.TypeRemapper declared in <root>.DeepCopyIrTreeWithSymbols' type=<root>.TypeRemapper origin=GET_PROPERTY
|
CALL 'public abstract fun remapType (type: <root>.IrType): <root>.IrType declared in <root>.TypeRemapper' type=<root>.IrType origin=null
|
||||||
$this: GET_VAR '<this>: <root>.DeepCopyIrTreeWithSymbols declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom' type=<root>.DeepCopyIrTreeWithSymbols origin=null
|
$this: CALL 'private final fun <get-typeRemapper> (): <root>.TypeRemapper declared in <root>.DeepCopyIrTreeWithSymbols' type=<root>.TypeRemapper origin=GET_PROPERTY
|
||||||
type: GET_VAR 'it: <root>.IrType declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>.<anonymous>' type=<root>.IrType origin=null
|
$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]
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||||
overridden:
|
overridden:
|
||||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
|
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)
|
return <this>.<get-typeRemapper>().remapType(type = it)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
} /*~> Unit */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,12 +26,13 @@ FILE fqName:<root> fileName:/coercionInLoop.kt
|
|||||||
STRING_CONCATENATION type=kotlin.String
|
STRING_CONCATENATION type=kotlin.String
|
||||||
CONST String type=kotlin.String value="Fail "
|
CONST String type=kotlin.String value="Fail "
|
||||||
GET_VAR 'var i: kotlin.Int declared in <root>.box' type=kotlin.Int origin=null
|
GET_VAR 'var i: kotlin.Int declared in <root>.box' type=kotlin.Int origin=null
|
||||||
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
GET_VAR 'var i: kotlin.Int declared in <root>.box' type=kotlin.Int origin=null
|
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
|
||||||
SET_VAR 'var i: kotlin.Int declared in <root>.box' type=kotlin.Unit origin=POSTFIX_INCR
|
GET_VAR 'var i: kotlin.Int declared in <root>.box' type=kotlin.Int origin=null
|
||||||
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
|
SET_VAR 'var i: kotlin.Int declared in <root>.box' type=kotlin.Unit origin=POSTFIX_INCR
|
||||||
$this: GET_VAR 'val tmp_0: kotlin.Int declared in <root>.box' type=kotlin.Int origin=null
|
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
|
||||||
GET_VAR 'val tmp_0: kotlin.Int declared in <root>.box' 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>'
|
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
|
||||||
CONST String type=kotlin.String value="OK"
|
CONST String type=kotlin.String value="OK"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ fun box(): String {
|
|||||||
val tmp_0: Int = i
|
val tmp_0: Int = i
|
||||||
i = tmp_0.inc()
|
i = tmp_0.inc()
|
||||||
tmp_0
|
tmp_0
|
||||||
}
|
} /*~> Unit */
|
||||||
}
|
}
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user