[FIR2IR] Don't replace while loop and when branch body blocks with single expression. Skip some empty blocks.
https://youtrack.jetbrains.com/issue/KT-60264/K2-while-loop-body-block-sometimes-replaced-with-single-expression Merge-request: KT-MR-12035 Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
f4df4f8007
commit
9a2eff6487
@@ -82,59 +82,61 @@ FILE fqName:<root> fileName:/whenSmartCastToEnum.kt
|
||||
BRANCH
|
||||
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.En
|
||||
GET_VAR 'val x: kotlin.Any? declared in <root>.test' type=kotlin.Any? origin=null
|
||||
then: BLOCK type=kotlin.Unit origin=WHEN
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.En [val]
|
||||
TYPE_OP type=<root>.En origin=IMPLICIT_CAST typeOperand=<root>.En
|
||||
GET_VAR 'val x: kotlin.Any? declared in <root>.test' type=kotlin.Any? origin=null
|
||||
WHEN type=kotlin.Unit origin=WHEN
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_0: <root>.En declared in <root>.test' type=<root>.En origin=null
|
||||
arg1: GET_ENUM 'ENUM_ENTRY name:A' type=<root>.En
|
||||
then: BLOCK type=kotlin.Unit origin=null
|
||||
SET_VAR 'var r: kotlin.String declared in <root>.test' type=kotlin.Unit origin=EQ
|
||||
CONST String type=kotlin.String value="when1"
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_0: <root>.En declared in <root>.test' type=<root>.En origin=null
|
||||
arg1: GET_ENUM 'ENUM_ENTRY name:B' type=<root>.En
|
||||
then: BLOCK type=kotlin.Unit origin=null
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_0: <root>.En declared in <root>.test' type=<root>.En origin=null
|
||||
arg1: GET_ENUM 'ENUM_ENTRY name:C' type=<root>.En
|
||||
then: BLOCK type=kotlin.Unit origin=null
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: CALL 'public final fun noWhenBranchMatchedException (): kotlin.Nothing declared in kotlin.internal.ir' type=kotlin.Nothing origin=null
|
||||
then: BLOCK type=kotlin.Unit origin=null
|
||||
BLOCK type=kotlin.Unit origin=WHEN
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.En [val]
|
||||
TYPE_OP type=<root>.En origin=IMPLICIT_CAST typeOperand=<root>.En
|
||||
GET_VAR 'val x: kotlin.Any? declared in <root>.test' type=kotlin.Any? origin=null
|
||||
WHEN type=kotlin.Unit origin=WHEN
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_0: <root>.En declared in <root>.test' type=<root>.En origin=null
|
||||
arg1: GET_ENUM 'ENUM_ENTRY name:A' type=<root>.En
|
||||
then: BLOCK type=kotlin.Unit origin=null
|
||||
SET_VAR 'var r: kotlin.String declared in <root>.test' type=kotlin.Unit origin=EQ
|
||||
CONST String type=kotlin.String value="when1"
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_0: <root>.En declared in <root>.test' type=<root>.En origin=null
|
||||
arg1: GET_ENUM 'ENUM_ENTRY name:B' type=<root>.En
|
||||
then: BLOCK type=kotlin.Unit origin=null
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_0: <root>.En declared in <root>.test' type=<root>.En origin=null
|
||||
arg1: GET_ENUM 'ENUM_ENTRY name:C' type=<root>.En
|
||||
then: BLOCK type=kotlin.Unit origin=null
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: CALL 'public final fun noWhenBranchMatchedException (): kotlin.Nothing declared in kotlin.internal.ir' type=kotlin.Nothing origin=null
|
||||
VAR name:y type:kotlin.Any [val]
|
||||
GET_ENUM 'ENUM_ENTRY name:A' type=<root>.En
|
||||
WHEN type=kotlin.Unit origin=IF
|
||||
BRANCH
|
||||
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.En
|
||||
GET_VAR 'val y: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
|
||||
then: BLOCK type=kotlin.Unit origin=WHEN
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:<root>.En [val]
|
||||
TYPE_OP type=<root>.En origin=IMPLICIT_CAST typeOperand=<root>.En
|
||||
GET_VAR 'val y: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
|
||||
WHEN type=kotlin.Unit origin=WHEN
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_1: <root>.En declared in <root>.test' type=<root>.En origin=null
|
||||
arg1: GET_ENUM 'ENUM_ENTRY name:A' type=<root>.En
|
||||
then: BLOCK type=kotlin.Unit origin=null
|
||||
SET_VAR 'var r: kotlin.String declared in <root>.test' type=kotlin.Unit origin=EQ
|
||||
CONST String type=kotlin.String value="when2"
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_1: <root>.En declared in <root>.test' type=<root>.En origin=null
|
||||
arg1: GET_ENUM 'ENUM_ENTRY name:B' type=<root>.En
|
||||
then: BLOCK type=kotlin.Unit origin=null
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_1: <root>.En declared in <root>.test' type=<root>.En origin=null
|
||||
arg1: GET_ENUM 'ENUM_ENTRY name:C' type=<root>.En
|
||||
then: BLOCK type=kotlin.Unit origin=null
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: CALL 'public final fun noWhenBranchMatchedException (): kotlin.Nothing declared in kotlin.internal.ir' type=kotlin.Nothing origin=null
|
||||
then: BLOCK type=kotlin.Unit origin=null
|
||||
BLOCK type=kotlin.Unit origin=WHEN
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:<root>.En [val]
|
||||
TYPE_OP type=<root>.En origin=IMPLICIT_CAST typeOperand=<root>.En
|
||||
GET_VAR 'val y: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
|
||||
WHEN type=kotlin.Unit origin=WHEN
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_1: <root>.En declared in <root>.test' type=<root>.En origin=null
|
||||
arg1: GET_ENUM 'ENUM_ENTRY name:A' type=<root>.En
|
||||
then: BLOCK type=kotlin.Unit origin=null
|
||||
SET_VAR 'var r: kotlin.String declared in <root>.test' type=kotlin.Unit origin=EQ
|
||||
CONST String type=kotlin.String value="when2"
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_1: <root>.En declared in <root>.test' type=<root>.En origin=null
|
||||
arg1: GET_ENUM 'ENUM_ENTRY name:B' type=<root>.En
|
||||
then: BLOCK type=kotlin.Unit origin=null
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_1: <root>.En declared in <root>.test' type=<root>.En origin=null
|
||||
arg1: GET_ENUM 'ENUM_ENTRY name:C' type=<root>.En
|
||||
then: BLOCK type=kotlin.Unit origin=null
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: CALL 'public final fun noWhenBranchMatchedException (): kotlin.Nothing declared in kotlin.internal.ir' type=kotlin.Nothing origin=null
|
||||
|
||||
Reference in New Issue
Block a user