79fa2b6db0
Before this change, it could happen that `when` of type Unit has a branch whose type is not Unit. This can lead to problems in IR lowerings, for example PolymorphicSignatureLowering which is very reliant on the correct types of expressions and placement of coercions to Unit (KT-59218).
66 lines
3.8 KiB
Plaintext
Vendored
66 lines
3.8 KiB
Plaintext
Vendored
FILE fqName:<root> fileName:/ifElseIf.kt
|
|
FUN name:test visibility:public modality:FINAL <> (i:kotlin.Int) returnType:kotlin.Int
|
|
VALUE_PARAMETER name:i index:0 type:kotlin.Int
|
|
BLOCK_BODY
|
|
RETURN type=kotlin.Nothing from='public final fun test (i: kotlin.Int): kotlin.Int declared in <root>'
|
|
WHEN type=kotlin.Int origin=IF
|
|
BRANCH
|
|
if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
|
|
arg0: GET_VAR 'i: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
|
|
arg1: CONST Int type=kotlin.Int value=0
|
|
then: CONST Int type=kotlin.Int value=1
|
|
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
|
|
arg0: GET_VAR 'i: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
|
|
arg1: CONST Int type=kotlin.Int value=0
|
|
then: CONST Int type=kotlin.Int value=-1
|
|
BRANCH
|
|
if: CONST Boolean type=kotlin.Boolean value=true
|
|
then: CONST Int type=kotlin.Int value=0
|
|
FUN name:testEmptyBranches1 visibility:public modality:FINAL <> (flag:kotlin.Boolean) returnType:kotlin.Unit
|
|
VALUE_PARAMETER name:flag index:0 type:kotlin.Boolean
|
|
BLOCK_BODY
|
|
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
|
WHEN type=kotlin.Any origin=IF
|
|
BRANCH
|
|
if: GET_VAR 'flag: kotlin.Boolean declared in <root>.testEmptyBranches1' type=kotlin.Boolean origin=null
|
|
then: BLOCK type=kotlin.Unit origin=null
|
|
BRANCH
|
|
if: CONST Boolean type=kotlin.Boolean value=true
|
|
then: CONST Boolean type=kotlin.Boolean value=true
|
|
WHEN type=kotlin.Unit origin=IF
|
|
BRANCH
|
|
if: GET_VAR 'flag: kotlin.Boolean declared in <root>.testEmptyBranches1' type=kotlin.Boolean origin=null
|
|
then: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
|
CONST Boolean type=kotlin.Boolean value=true
|
|
FUN name:testEmptyBranches2 visibility:public modality:FINAL <> (flag:kotlin.Boolean) returnType:kotlin.Unit
|
|
VALUE_PARAMETER name:flag index:0 type:kotlin.Boolean
|
|
BLOCK_BODY
|
|
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
|
WHEN type=kotlin.Any origin=IF
|
|
BRANCH
|
|
if: GET_VAR 'flag: kotlin.Boolean declared in <root>.testEmptyBranches2' type=kotlin.Boolean origin=null
|
|
then: BLOCK type=kotlin.Unit origin=null
|
|
BRANCH
|
|
if: CONST Boolean type=kotlin.Boolean value=true
|
|
then: CONST Boolean type=kotlin.Boolean value=true
|
|
WHEN type=kotlin.Unit origin=IF
|
|
BRANCH
|
|
if: GET_VAR 'flag: kotlin.Boolean declared in <root>.testEmptyBranches2' type=kotlin.Boolean origin=null
|
|
then: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
|
CONST Boolean type=kotlin.Boolean value=true
|
|
BRANCH
|
|
if: CONST Boolean type=kotlin.Boolean value=true
|
|
then: BLOCK type=kotlin.Unit origin=null
|
|
FUN name:testEmptyBranches3 visibility:public modality:FINAL <> (flag:kotlin.Boolean) returnType:kotlin.Unit
|
|
VALUE_PARAMETER name:flag index:0 type:kotlin.Boolean
|
|
BLOCK_BODY
|
|
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
|
WHEN type=kotlin.Any origin=IF
|
|
BRANCH
|
|
if: GET_VAR 'flag: kotlin.Boolean declared in <root>.testEmptyBranches3' type=kotlin.Boolean origin=null
|
|
then: BLOCK type=kotlin.Unit origin=null
|
|
BRANCH
|
|
if: CONST Boolean type=kotlin.Boolean value=true
|
|
then: CONST Boolean type=kotlin.Boolean value=true
|