[FIR2IR] Don't generate excess IR block from FirSingleExpressionBlock

This is needed to unify K1 and K2 behavior.

#KT-65064
#KT-63781 Fixed
This commit is contained in:
Ivan Kylchik
2023-12-25 13:59:16 +01:00
committed by Space Team
parent a56bebe44e
commit 86e6912447
35 changed files with 2394 additions and 35 deletions
@@ -15,11 +15,10 @@ FILE fqName:<root> fileName:/withVarargViewedAsArray.kt
VAR FOR_LOOP_VARIABLE name:arg 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_0: kotlin.collections.IntIterator declared in <root>.sum' type=kotlin.collections.IntIterator origin=null
BLOCK type=kotlin.Unit origin=null
SET_VAR 'var result: kotlin.Int declared in <root>.sum' type=kotlin.Unit origin=PLUSEQ
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'var result: kotlin.Int declared in <root>.sum' type=kotlin.Int origin=null
other: GET_VAR 'val arg: kotlin.Int declared in <root>.sum' type=kotlin.Int origin=null
SET_VAR 'var result: kotlin.Int declared in <root>.sum' type=kotlin.Unit origin=PLUSEQ
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'var result: kotlin.Int declared in <root>.sum' type=kotlin.Int origin=null
other: GET_VAR 'val arg: kotlin.Int declared in <root>.sum' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='public final fun sum (vararg args: kotlin.Int): kotlin.Int declared in <root>'
GET_VAR 'var result: kotlin.Int declared in <root>.sum' type=kotlin.Int origin=null
FUN name:nsum visibility:public modality:FINAL <> (args:kotlin.Array<out kotlin.Number>) returnType:kotlin.Int
@@ -4,9 +4,7 @@ fun sum(vararg args: Int): Int {
val tmp_0: IntIterator = args.iterator()
while (tmp_0.hasNext()) { // BLOCK
val arg: Int = tmp_0.next()
{ // BLOCK
result = result.plus(other = arg)
}
result = result.plus(other = arg)
}
}
return result