diff --git a/compiler/testData/codegen/box/fir/listAssignmentInWhen.fir.ir.txt b/compiler/testData/codegen/box/fir/listAssignmentInWhen.fir.ir.txt new file mode 100644 index 00000000000..e97dcac46b3 --- /dev/null +++ b/compiler/testData/codegen/box/fir/listAssignmentInWhen.fir.ir.txt @@ -0,0 +1,35 @@ +FILE fqName: fileName:/listAssignmentInWhen.kt + FUN name:foo visibility:public modality:FINAL <> (list:kotlin.collections.MutableList, condition:kotlin.Boolean) returnType:kotlin.Unit + VALUE_PARAMETER name:list index:0 type:kotlin.collections.MutableList + VALUE_PARAMETER name:condition index:1 type:kotlin.Boolean + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun foo (list: kotlin.collections.MutableList, condition: kotlin.Boolean): kotlin.Unit declared in ' + WHEN type=kotlin.Unit origin=WHEN + BRANCH + if: GET_VAR 'condition: kotlin.Boolean declared in .foo' type=kotlin.Boolean origin=null + then: BLOCK type=kotlin.Unit origin=null + CALL 'public abstract fun set (index: kotlin.Int, element: E of kotlin.collections.MutableList): E of kotlin.collections.MutableList declared in kotlin.collections.MutableList' type=kotlin.Any? origin=null + $this: GET_VAR 'list: kotlin.collections.MutableList declared in .foo' type=kotlin.collections.MutableList origin=null + index: CONST Int type=kotlin.Int value=0 + element: CONST String type=kotlin.String value="OK" + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + VAR name:list type:kotlin.collections.MutableList [val] + CALL 'public final fun mutableListOf (vararg elements: T of kotlin.collections.mutableListOf): kotlin.collections.MutableList declared in kotlin.collections' type=kotlin.collections.MutableList origin=null + : kotlin.Any? + elements: VARARG type=kotlin.Array varargElementType=kotlin.Any? + CONST String type=kotlin.String value="FAIL" + CALL 'public final fun foo (list: kotlin.collections.MutableList, condition: kotlin.Boolean): kotlin.Unit declared in ' type=kotlin.Unit origin=null + list: GET_VAR 'val list: kotlin.collections.MutableList declared in .box' type=kotlin.collections.MutableList origin=null + condition: CONST Boolean type=kotlin.Boolean value=true + CALL 'public final fun foo (list: kotlin.collections.MutableList, condition: kotlin.Boolean): kotlin.Unit declared in ' type=kotlin.Unit origin=null + list: GET_VAR 'val list: kotlin.collections.MutableList declared in .box' type=kotlin.collections.MutableList origin=null + condition: CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + TYPE_OP type=kotlin.String origin=CAST typeOperand=kotlin.String + CALL 'public abstract fun get (index: kotlin.Int): E of kotlin.collections.MutableList declared in kotlin.collections.MutableList' type=kotlin.Any? origin=GET_ARRAY_ELEMENT + $this: GET_VAR 'val list: kotlin.collections.MutableList declared in .box' type=kotlin.collections.MutableList origin=null + index: CONST Int type=kotlin.Int value=0 diff --git a/compiler/testData/codegen/box/fir/listAssignmentInWhen.ir.txt b/compiler/testData/codegen/box/fir/listAssignmentInWhen.ir.txt new file mode 100644 index 00000000000..71825085e4e --- /dev/null +++ b/compiler/testData/codegen/box/fir/listAssignmentInWhen.ir.txt @@ -0,0 +1,35 @@ +FILE fqName: fileName:/listAssignmentInWhen.kt + FUN name:foo visibility:public modality:FINAL <> (list:kotlin.collections.MutableList, condition:kotlin.Boolean) returnType:kotlin.Unit + VALUE_PARAMETER name:list index:0 type:kotlin.collections.MutableList + VALUE_PARAMETER name:condition index:1 type:kotlin.Boolean + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun foo (list: kotlin.collections.MutableList, condition: kotlin.Boolean): kotlin.Unit declared in ' + WHEN type=kotlin.Unit origin=WHEN + BRANCH + if: GET_VAR 'condition: kotlin.Boolean declared in .foo' type=kotlin.Boolean origin=null + then: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public abstract fun set (index: kotlin.Int, element: E of kotlin.collections.MutableList): E of kotlin.collections.MutableList declared in kotlin.collections.MutableList' type=kotlin.Any? origin=EQ + $this: GET_VAR 'list: kotlin.collections.MutableList declared in .foo' type=kotlin.collections.MutableList origin=null + index: CONST Int type=kotlin.Int value=0 + element: CONST String type=kotlin.String value="OK" + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + VAR name:list type:kotlin.collections.MutableList [val] + CALL 'public final fun mutableListOf (vararg elements: T of kotlin.collections.mutableListOf): kotlin.collections.MutableList declared in kotlin.collections' type=kotlin.collections.MutableList origin=null + : kotlin.Any? + elements: VARARG type=kotlin.Array varargElementType=kotlin.Any? + CONST String type=kotlin.String value="FAIL" + CALL 'public final fun foo (list: kotlin.collections.MutableList, condition: kotlin.Boolean): kotlin.Unit declared in ' type=kotlin.Unit origin=null + list: GET_VAR 'val list: kotlin.collections.MutableList declared in .box' type=kotlin.collections.MutableList origin=null + condition: CONST Boolean type=kotlin.Boolean value=true + CALL 'public final fun foo (list: kotlin.collections.MutableList, condition: kotlin.Boolean): kotlin.Unit declared in ' type=kotlin.Unit origin=null + list: GET_VAR 'val list: kotlin.collections.MutableList declared in .box' type=kotlin.collections.MutableList origin=null + condition: CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + TYPE_OP type=kotlin.String origin=CAST typeOperand=kotlin.String + CALL 'public abstract fun get (index: kotlin.Int): E of kotlin.collections.MutableList declared in kotlin.collections.MutableList' type=kotlin.Any? origin=GET_ARRAY_ELEMENT + $this: GET_VAR 'val list: kotlin.collections.MutableList declared in .box' type=kotlin.collections.MutableList origin=null + index: CONST Int type=kotlin.Int value=0 diff --git a/compiler/testData/codegen/box/fir/listAssignmentInWhen.kt b/compiler/testData/codegen/box/fir/listAssignmentInWhen.kt index 9605876063c..1b309cd6a13 100644 --- a/compiler/testData/codegen/box/fir/listAssignmentInWhen.kt +++ b/compiler/testData/codegen/box/fir/listAssignmentInWhen.kt @@ -1,5 +1,6 @@ // ISSUE: KT-59748 // WITH_STDLIB +// DUMP_IR fun foo(list: MutableList, condition: Boolean): Unit = when { condition -> list[0] = "OK"