From d0a148074f2fa5f9ff308d1a45dcd135113b5e8a Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Mon, 29 Mar 2021 14:12:22 +0300 Subject: [PATCH] [FIR2IR] Fix generating body for for-loop --- .../kotlin/fir/backend/Fir2IrVisitor.kt | 39 +++++- .../FirBlackBoxCodegenTestGenerated.java | 6 + .../testData/codegen/box/arrays/kt45410.kt | 1 - .../fir/noSymbolForIntRangeIterator.fir.txt | 112 +++++++++++++++++ .../box/fir/noSymbolForIntRangeIterator.kt | 34 ++++++ .../box/fir/noSymbolForIntRangeIterator.txt | 113 ++++++++++++++++++ .../withVarargViewedAsArray.fir.kt.txt | 5 +- .../withVarargViewedAsArray.fir.txt | 9 +- .../ir/irText/expressions/for.fir.kt.txt | 11 +- .../ir/irText/expressions/for.fir.txt | 21 ++-- .../forWithBreakContinue.fir.kt.txt | 37 +++--- .../expressions/forWithBreakContinue.fir.txt | 72 +++++------ .../ClashResolutionDescriptor.fir.kt.txt | 15 ++- .../ClashResolutionDescriptor.fir.txt | 51 ++++---- .../firProblems/DeepCopyIrTree.fir.kt.txt | 13 +- .../irText/firProblems/DeepCopyIrTree.fir.txt | 49 ++++---- .../enhancedNullabilityInForLoop.fir.kt.txt | 18 ++- .../enhancedNullabilityInForLoop.fir.txt | 35 +++--- .../IrBlackBoxCodegenTestGenerated.java | 6 + 19 files changed, 493 insertions(+), 154 deletions(-) create mode 100644 compiler/testData/codegen/box/fir/noSymbolForIntRangeIterator.fir.txt create mode 100644 compiler/testData/codegen/box/fir/noSymbolForIntRangeIterator.kt create mode 100644 compiler/testData/codegen/box/fir/noSymbolForIntRangeIterator.txt diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt index d642fc9175c..1a5daaba533 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt @@ -16,6 +16,7 @@ import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.builder.buildProperty import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl import org.jetbrains.kotlin.fir.expressions.* +import org.jetbrains.kotlin.fir.expressions.builder.buildBlock import org.jetbrains.kotlin.fir.expressions.impl.FirElseIfTrueCondition import org.jetbrains.kotlin.fir.expressions.impl.FirStubStatement import org.jetbrains.kotlin.fir.expressions.impl.FirUnitExpression @@ -745,14 +746,44 @@ class Fir2IrVisitor( override fun visitWhileLoop(whileLoop: FirWhileLoop, data: Any?): IrElement { return whileLoop.convertWithOffsets { startOffset, endOffset -> - val origin = if (whileLoop.source?.elementType == KtNodeTypes.FOR) IrStatementOrigin.FOR_LOOP_INNER_WHILE - else IrStatementOrigin.WHILE_LOOP + val isForLoop = whileLoop.source?.elementType == KtNodeTypes.FOR + val origin = if (isForLoop) IrStatementOrigin.FOR_LOOP_INNER_WHILE else IrStatementOrigin.WHILE_LOOP + val firLoopBody = whileLoop.block IrWhileLoopImpl(startOffset, endOffset, irBuiltIns.unitType, origin).apply { loopMap[whileLoop] = this label = whileLoop.label?.name condition = convertToIrExpression(whileLoop.condition) - // NB: here we have strange origin logic, made to be compatible with FE 1.0 - body = whileLoop.block.convertToIrExpressionOrBlock(origin.takeIf { it != IrStatementOrigin.WHILE_LOOP }) + body = if (isForLoop) { + /* + * for loops in IR should have specific for of their body, because some of lowerings (e.g. `ForLoopLowering`) expects + * exactly that shape: + * + * for (x in list) { ...body...} + * + * IR (loop body): + * IrBlock: + * x = .next() + * IrBlock: + * ...body... + */ + firLoopBody.convertWithOffsets { innerStartOffset, innerEndOffset -> + val irInnerBody = IrBlockImpl(innerStartOffset, innerEndOffset, irBuiltIns.unitType, origin) + irInnerBody.statements += firLoopBody.statements.first().toIrStatement() + ?: error("Unexpected shape of body of for loop") + if (firLoopBody.statements.size > 1) { + val tmpBlock = buildBlock { + source = firLoopBody.source + for (i in 1 until firLoopBody.statements.size) { + statements += firLoopBody.statements[i] + } + } + irInnerBody.statements += tmpBlock.convertToIrExpressionOrBlock() + } + irInnerBody + } + } else { + firLoopBody.convertToIrExpressionOrBlock() + } loopMap.remove(whileLoop) } }.also { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 5d70c0457a9..841a5f02872 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -15182,6 +15182,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/fir/NameHighlighter.kt"); } + @Test + @TestMetadata("noSymbolForIntRangeIterator.kt") + public void testNoSymbolForIntRangeIterator() throws Exception { + runTest("compiler/testData/codegen/box/fir/noSymbolForIntRangeIterator.kt"); + } + @Test @TestMetadata("SuspendExtension.kt") public void testSuspendExtension() throws Exception { diff --git a/compiler/testData/codegen/box/arrays/kt45410.kt b/compiler/testData/codegen/box/arrays/kt45410.kt index f4606b8d1b1..aab1ab2a3e7 100644 --- a/compiler/testData/codegen/box/arrays/kt45410.kt +++ b/compiler/testData/codegen/box/arrays/kt45410.kt @@ -1,5 +1,4 @@ // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM private const val MOD = 998244353 diff --git a/compiler/testData/codegen/box/fir/noSymbolForIntRangeIterator.fir.txt b/compiler/testData/codegen/box/fir/noSymbolForIntRangeIterator.fir.txt new file mode 100644 index 00000000000..24ec9cededa --- /dev/null +++ b/compiler/testData/codegen/box/fir/noSymbolForIntRangeIterator.fir.txt @@ -0,0 +1,112 @@ +FILE fqName: fileName:/noSymbolForIntRangeIterator.kt + PROPERTY name:result visibility:public modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:result type:kotlin.Int visibility:private [static] + EXPRESSION_BODY + CONST Int type=kotlin.Int value=0 + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int + correspondingProperty: PROPERTY name:result visibility:public modality:FINAL [var] + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in ' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:result type:kotlin.Int visibility:private [static]' type=kotlin.Int origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> (:kotlin.Int) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:result visibility:public modality:FINAL [var] + VALUE_PARAMETER name: index:0 type:kotlin.Int + BLOCK_BODY + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:result type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=null + value: GET_VAR ': kotlin.Int declared in .' type=kotlin.Int origin=null + FUN name:takeString visibility:public modality:FINAL <> (s:kotlin.String) returnType:kotlin.Unit + VALUE_PARAMETER name:s index:0 type:kotlin.String + BLOCK_BODY + CALL 'public final fun forEach (action: kotlin.Function1): kotlin.Unit [inline] declared in kotlin.collections.CollectionsKt' type=kotlin.Unit origin=null + : kotlin.String + $receiver: CALL 'public final fun split (vararg delimiters: kotlin.String, ignoreCase: kotlin.Boolean, limit: kotlin.Int): kotlin.collections.List declared in kotlin.text.StringsKt' type=kotlin.collections.List origin=null + $receiver: GET_VAR 's: kotlin.String declared in .takeString' type=kotlin.String origin=null + delimiters: VARARG type=kotlin.Array varargElementType=kotlin.String + CONST String type=kotlin.String value="\n" + action: FUN_EXPR type=kotlin.Function1 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.String) returnType:kotlin.Unit + VALUE_PARAMETER name:it index:0 type:kotlin.String + BLOCK_BODY + CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.Unit origin=EQ + : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=GET_PROPERTY + other: BLOCK type=kotlin.Int origin=ELVIS + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int? [val] + CALL 'public final fun toIntOrNull (): kotlin.Int? declared in kotlin.text.StringsKt' type=kotlin.Int? origin=null + $receiver: GET_VAR 'it: kotlin.String declared in .takeString.' type=kotlin.String origin=null + WHEN type=kotlin.Int origin=ELVIS + 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: kotlin.Int? [val] declared in .takeString.' type=kotlin.Int? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Int type=kotlin.Int value=0 + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: GET_VAR 'val tmp_0: kotlin.Int? [val] declared in .takeString.' type=kotlin.Int? origin=null + FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + VAR name:x type:kotlin.Int [val] + CONST Int type=kotlin.Int value=10 + VAR name:y type:kotlin.Int [val] + CONST Int type=kotlin.Int value=10 + FUN name:localFunc visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + BLOCK type=kotlin.Unit origin=FOR_LOOP + VAR FOR_LOOP_ITERATOR name:tmp_1 type:kotlin.collections.IntIterator [val] + CALL 'public open fun iterator (): kotlin.collections.IntIterator [operator] declared in kotlin.ranges.IntProgression' type=kotlin.collections.IntIterator origin=FOR_LOOP_ITERATOR + $this: CALL 'public final fun rangeTo (other: kotlin.Int): kotlin.ranges.IntRange [operator] declared in kotlin.Int' type=kotlin.ranges.IntRange origin=RANGE + $this: CONST Int type=kotlin.Int value=0 + other: GET_VAR 'val x: kotlin.Int [val] declared in .test' type=kotlin.Int origin=null + WHILE label=null origin=FOR_LOOP_INNER_WHILE + condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT + $this: GET_VAR 'val tmp_1: kotlin.collections.IntIterator [val] declared in .test.localFunc' type=kotlin.collections.IntIterator origin=null + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE + VAR FOR_LOOP_VARIABLE name:i type:kotlin.Int [val] + CALL 'public final fun next (): kotlin.Int [operator] declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT + $this: GET_VAR 'val tmp_1: kotlin.collections.IntIterator [val] declared in .test.localFunc' type=kotlin.collections.IntIterator origin=null + BLOCK type=kotlin.Unit origin=null + VAR name:s type:kotlin.String [val] + CALL 'public final fun buildString (builderAction: @[ExtensionFunctionType] kotlin.Function1): kotlin.String [inline] declared in kotlin.text.StringsKt' type=kotlin.String origin=null + builderAction: FUN_EXPR type=kotlin.Function1 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:java.lang.StringBuilder) returnType:kotlin.Unit + $receiver: VALUE_PARAMETER name: type:java.lang.StringBuilder + BLOCK_BODY + BLOCK type=kotlin.Unit origin=FOR_LOOP + VAR FOR_LOOP_ITERATOR name:tmp_2 type:kotlin.collections.IntIterator [val] + CALL 'public open fun iterator (): kotlin.collections.IntIterator [operator] declared in kotlin.ranges.IntProgression' type=kotlin.collections.IntIterator origin=FOR_LOOP_ITERATOR + $this: CALL 'public final fun rangeTo (other: kotlin.Int): kotlin.ranges.IntRange [operator] declared in kotlin.Int' type=kotlin.ranges.IntRange origin=RANGE + $this: CONST Int type=kotlin.Int value=0 + other: GET_VAR 'val y: kotlin.Int [val] declared in .test' type=kotlin.Int origin=null + WHILE label=null origin=FOR_LOOP_INNER_WHILE + condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT + $this: GET_VAR 'val tmp_2: kotlin.collections.IntIterator [val] declared in .test.localFunc.' type=kotlin.collections.IntIterator origin=null + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE + VAR FOR_LOOP_VARIABLE name:j type:kotlin.Int [val] + CALL 'public final fun next (): kotlin.Int [operator] declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT + $this: GET_VAR 'val tmp_2: kotlin.collections.IntIterator [val] declared in .test.localFunc.' type=kotlin.collections.IntIterator origin=null + CALL 'public final fun appendLine (value: kotlin.String?): java.lang.StringBuilder [inline] declared in kotlin.text.StringsKt' type=java.lang.StringBuilder origin=null + $receiver: GET_VAR ': java.lang.StringBuilder declared in .test.localFunc.' type=java.lang.StringBuilder origin=null + value: STRING_CONCATENATION type=kotlin.String + CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MUL + $this: GET_VAR 'val i: kotlin.Int [val] declared in .test.localFunc' type=kotlin.Int origin=null + other: GET_VAR 'val j: kotlin.Int [val] declared in .test.localFunc.' type=kotlin.Int origin=null + CALL 'public final fun takeString (s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + s: GET_VAR 'val s: kotlin.String [val] declared in .test.localFunc' type=kotlin.String origin=null + CALL 'local final fun localFunc (): kotlin.Unit declared in .test' type=kotlin.Unit origin=null + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + CALL 'public final fun test (): kotlin.Unit declared in ' type=kotlin.Unit origin=null + RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + WHEN type=kotlin.String origin=IF + 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: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=GET_PROPERTY + arg1: CONST Int type=kotlin.Int value=3025 + then: CONST String type=kotlin.String value="OK" + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Fail: " + CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null + $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=GET_PROPERTY diff --git a/compiler/testData/codegen/box/fir/noSymbolForIntRangeIterator.kt b/compiler/testData/codegen/box/fir/noSymbolForIntRangeIterator.kt new file mode 100644 index 00000000000..5e9e18e52e3 --- /dev/null +++ b/compiler/testData/codegen/box/fir/noSymbolForIntRangeIterator.kt @@ -0,0 +1,34 @@ +// TARGET_BACKEND: JVM_IR +// DUMP_IR +// WITH_STDLIB + +var result = 0 + +fun takeString(s: String) { + s.split("\n").forEach { + result += it.toIntOrNull() ?: 0 + } +} + +fun test() { + val x = 10 + val y = 10 + + fun localFunc() { + for (i in 0..x) { + val s = buildString { + for (j in 0..y) { + appendLine("${i * j}") + } + } + takeString(s) + } + } + + localFunc() +} + +fun box(): String { + test() + return if (result == 3025) "OK" else "Fail: $result" +} diff --git a/compiler/testData/codegen/box/fir/noSymbolForIntRangeIterator.txt b/compiler/testData/codegen/box/fir/noSymbolForIntRangeIterator.txt new file mode 100644 index 00000000000..80a01e2f9df --- /dev/null +++ b/compiler/testData/codegen/box/fir/noSymbolForIntRangeIterator.txt @@ -0,0 +1,113 @@ +FILE fqName: fileName:/noSymbolForIntRangeIterator.kt + PROPERTY name:result visibility:public modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:result type:kotlin.Int visibility:private [static] + EXPRESSION_BODY + CONST Int type=kotlin.Int value=0 + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int + correspondingProperty: PROPERTY name:result visibility:public modality:FINAL [var] + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in ' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:result type:kotlin.Int visibility:private [static]' type=kotlin.Int origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> (:kotlin.Int) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:result visibility:public modality:FINAL [var] + VALUE_PARAMETER name: index:0 type:kotlin.Int + BLOCK_BODY + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:result type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=null + value: GET_VAR ': kotlin.Int declared in .' type=kotlin.Int origin=null + FUN name:takeString visibility:public modality:FINAL <> (s:kotlin.String) returnType:kotlin.Unit + VALUE_PARAMETER name:s index:0 type:kotlin.String + BLOCK_BODY + CALL 'public final fun forEach (action: kotlin.Function1): kotlin.Unit [inline] declared in kotlin.collections.CollectionsKt' type=kotlin.Unit origin=null + : kotlin.String + $receiver: CALL 'public final fun split (vararg delimiters: kotlin.String, ignoreCase: kotlin.Boolean, limit: kotlin.Int): kotlin.collections.List declared in kotlin.text.StringsKt' type=kotlin.collections.List origin=null + $receiver: GET_VAR 's: kotlin.String declared in .takeString' type=kotlin.String origin=null + delimiters: VARARG type=kotlin.Array varargElementType=kotlin.String + CONST String type=kotlin.String value="\n" + action: FUN_EXPR type=kotlin.Function1 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.String) returnType:kotlin.Unit + VALUE_PARAMETER name:it index:0 type:kotlin.String + BLOCK_BODY + BLOCK type=kotlin.Unit origin=PLUSEQ + CALL 'public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.Unit origin=PLUSEQ + : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ + $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=PLUSEQ + other: BLOCK type=kotlin.Int origin=ELVIS + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int? [val] + CALL 'public final fun toIntOrNull (): kotlin.Int? declared in kotlin.text.StringsKt' type=kotlin.Int? origin=null + $receiver: GET_VAR 'it: kotlin.String declared in .takeString.' type=kotlin.String origin=null + WHEN type=kotlin.Int 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: kotlin.Int? [val] declared in .takeString.' type=kotlin.Int? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Int type=kotlin.Int value=0 + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: GET_VAR 'val tmp_0: kotlin.Int? [val] declared in .takeString.' type=kotlin.Int? origin=null + FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + VAR name:x type:kotlin.Int [val] + CONST Int type=kotlin.Int value=10 + VAR name:y type:kotlin.Int [val] + CONST Int type=kotlin.Int value=10 + FUN name:localFunc visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + BLOCK type=kotlin.Unit origin=FOR_LOOP + VAR FOR_LOOP_ITERATOR name:tmp_1 type:kotlin.collections.IntIterator [val] + CALL 'public open fun iterator (): kotlin.collections.IntIterator [fake_override,operator] declared in kotlin.ranges.IntRange' type=kotlin.collections.IntIterator origin=FOR_LOOP_ITERATOR + $this: CALL 'public final fun rangeTo (other: kotlin.Int): kotlin.ranges.IntRange [operator] declared in kotlin.Int' type=kotlin.ranges.IntRange origin=RANGE + $this: CONST Int type=kotlin.Int value=0 + other: GET_VAR 'val x: kotlin.Int [val] declared in .test' type=kotlin.Int origin=null + WHILE label=null origin=FOR_LOOP_INNER_WHILE + condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.IntIterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT + $this: GET_VAR 'val tmp_1: kotlin.collections.IntIterator [val] declared in .test.localFunc' type=kotlin.collections.IntIterator origin=null + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE + VAR FOR_LOOP_VARIABLE name:i type:kotlin.Int [val] + CALL 'public final fun next (): kotlin.Int [operator] declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT + $this: GET_VAR 'val tmp_1: kotlin.collections.IntIterator [val] declared in .test.localFunc' type=kotlin.collections.IntIterator origin=null + BLOCK type=kotlin.Unit origin=null + VAR name:s type:kotlin.String [val] + CALL 'public final fun buildString (builderAction: @[ExtensionFunctionType] kotlin.Function1): kotlin.String [inline] declared in kotlin.text.StringsKt' type=kotlin.String origin=null + builderAction: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:java.lang.StringBuilder{ kotlin.text.TypeAliasesKt.StringBuilder }) returnType:kotlin.Unit + $receiver: VALUE_PARAMETER name:$this$buildString type:java.lang.StringBuilder{ kotlin.text.TypeAliasesKt.StringBuilder } + BLOCK_BODY + BLOCK type=kotlin.Unit origin=FOR_LOOP + VAR FOR_LOOP_ITERATOR name:tmp_2 type:kotlin.collections.IntIterator [val] + CALL 'public open fun iterator (): kotlin.collections.IntIterator [fake_override,operator] declared in kotlin.ranges.IntRange' type=kotlin.collections.IntIterator origin=FOR_LOOP_ITERATOR + $this: CALL 'public final fun rangeTo (other: kotlin.Int): kotlin.ranges.IntRange [operator] declared in kotlin.Int' type=kotlin.ranges.IntRange origin=RANGE + $this: CONST Int type=kotlin.Int value=0 + other: GET_VAR 'val y: kotlin.Int [val] declared in .test' type=kotlin.Int origin=null + WHILE label=null origin=FOR_LOOP_INNER_WHILE + condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.IntIterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT + $this: GET_VAR 'val tmp_2: kotlin.collections.IntIterator [val] declared in .test.localFunc.' type=kotlin.collections.IntIterator origin=null + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE + VAR FOR_LOOP_VARIABLE name:j type:kotlin.Int [val] + CALL 'public final fun next (): kotlin.Int [operator] declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT + $this: GET_VAR 'val tmp_2: kotlin.collections.IntIterator [val] declared in .test.localFunc.' type=kotlin.collections.IntIterator origin=null + BLOCK type=kotlin.Unit 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{ kotlin.text.TypeAliasesKt.StringBuilder } [inline] declared in kotlin.text.StringsKt' type=java.lang.StringBuilder{ kotlin.text.TypeAliasesKt.StringBuilder } origin=null + $receiver: GET_VAR '$this$buildString: java.lang.StringBuilder{ kotlin.text.TypeAliasesKt.StringBuilder } declared in .test.localFunc.' type=java.lang.StringBuilder{ kotlin.text.TypeAliasesKt.StringBuilder } origin=null + value: STRING_CONCATENATION type=kotlin.String + CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MUL + $this: GET_VAR 'val i: kotlin.Int [val] declared in .test.localFunc' type=kotlin.Int origin=null + other: GET_VAR 'val j: kotlin.Int [val] declared in .test.localFunc.' type=kotlin.Int origin=null + CALL 'public final fun takeString (s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + s: GET_VAR 'val s: kotlin.String [val] declared in .test.localFunc' type=kotlin.String origin=null + CALL 'local final fun localFunc (): kotlin.Unit declared in .test' type=kotlin.Unit origin=null + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + CALL 'public final fun test (): kotlin.Unit declared in ' type=kotlin.Unit origin=null + RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + WHEN type=kotlin.String origin=IF + 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: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=GET_PROPERTY + arg1: CONST Int type=kotlin.Int value=3025 + then: CONST String type=kotlin.String value="OK" + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Fail: " + CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=GET_PROPERTY diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.fir.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.fir.kt.txt index 6d71b1eb0ad..00c6f8c1c12 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.fir.kt.txt @@ -4,7 +4,9 @@ fun sum(vararg args: Int): Int { val : IntIterator = args.iterator() while (.hasNext()) { // BLOCK val arg: Int = .next() - result = result.plus(other = arg) + { // BLOCK + result = result.plus(other = arg) + } } } return result @@ -53,3 +55,4 @@ fun testArrayAndDefaults() { } ) } + diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.fir.txt b/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.fir.txt index 02ca2409cea..8995a1da409 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.fir.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.fir.txt @@ -15,10 +15,11 @@ FILE fqName: fileName:/withVarargViewedAsArray.kt VAR FOR_LOOP_VARIABLE name:arg type:kotlin.Int [val] CALL 'public final fun next (): kotlin.Int [operator] declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT $this: GET_VAR 'val tmp_0: kotlin.collections.IntIterator [val] declared in .sum' type=kotlin.collections.IntIterator origin=null - SET_VAR 'var result: kotlin.Int [var] declared in .sum' type=kotlin.Unit origin=EQ - CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null - $this: GET_VAR 'var result: kotlin.Int [var] declared in .sum' type=kotlin.Int origin=null - other: GET_VAR 'val arg: kotlin.Int [val] declared in .sum' type=kotlin.Int origin=null + BLOCK type=kotlin.Unit origin=null + SET_VAR 'var result: kotlin.Int [var] declared in .sum' type=kotlin.Unit origin=EQ + CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'var result: kotlin.Int [var] declared in .sum' type=kotlin.Int origin=null + other: GET_VAR 'val arg: kotlin.Int [val] declared in .sum' type=kotlin.Int origin=null RETURN type=kotlin.Nothing from='public final fun sum (vararg args: kotlin.Int): kotlin.Int declared in ' GET_VAR 'var result: kotlin.Int [var] declared in .sum' type=kotlin.Int origin=null FUN name:nsum visibility:public modality:FINAL <> (args:kotlin.Array) returnType:kotlin.Int diff --git a/compiler/testData/ir/irText/expressions/for.fir.kt.txt b/compiler/testData/ir/irText/expressions/for.fir.kt.txt index d24d3e0c666..7f9665d76a4 100644 --- a/compiler/testData/ir/irText/expressions/for.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/for.fir.kt.txt @@ -22,10 +22,12 @@ fun testDestructuring(pp: List>) { val : Iterator> = pp.iterator() while (.hasNext()) { // BLOCK val : Pair = .next() - val i: Int = .component1() - val s: String = .component2() - println(message = i) - println(message = s) + { // BLOCK + val i: Int = .component1() + val s: String = .component2() + println(message = i) + println(message = s) + } } } } @@ -38,3 +40,4 @@ fun testRange() { } } } + diff --git a/compiler/testData/ir/irText/expressions/for.fir.txt b/compiler/testData/ir/irText/expressions/for.fir.txt index e7afe2a82dd..14a0e2807fe 100644 --- a/compiler/testData/ir/irText/expressions/for.fir.txt +++ b/compiler/testData/ir/irText/expressions/for.fir.txt @@ -43,16 +43,17 @@ FILE fqName: fileName:/for.kt VAR FOR_LOOP_VARIABLE name: type:kotlin.Pair [val] CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=kotlin.Pair origin=FOR_LOOP_NEXT $this: GET_VAR 'val tmp_2: kotlin.collections.Iterator> [val] declared in .testDestructuring' type=kotlin.collections.Iterator> origin=null - VAR name:i type:kotlin.Int [val] - CALL 'public final fun component1 (): A of kotlin.Pair [operator] declared in kotlin.Pair' type=kotlin.Int origin=null - $this: GET_VAR 'val : kotlin.Pair [val] declared in .testDestructuring' type=kotlin.Pair origin=null - VAR name:s type:kotlin.String [val] - CALL 'public final fun component2 (): B of kotlin.Pair [operator] declared in kotlin.Pair' type=kotlin.String origin=null - $this: GET_VAR 'val : kotlin.Pair [val] declared in .testDestructuring' type=kotlin.Pair origin=null - CALL 'public final fun println (message: kotlin.Int): kotlin.Unit [inline] declared in kotlin.io.ConsoleKt' type=kotlin.Unit origin=null - message: GET_VAR 'val i: kotlin.Int [val] declared in .testDestructuring' type=kotlin.Int origin=null - CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit [inline] declared in kotlin.io.ConsoleKt' type=kotlin.Unit origin=null - message: GET_VAR 'val s: kotlin.String [val] declared in .testDestructuring' type=kotlin.String origin=null + BLOCK type=kotlin.Unit origin=null + VAR name:i type:kotlin.Int [val] + CALL 'public final fun component1 (): A of kotlin.Pair [operator] declared in kotlin.Pair' type=kotlin.Int origin=null + $this: GET_VAR 'val : kotlin.Pair [val] declared in .testDestructuring' type=kotlin.Pair origin=null + VAR name:s type:kotlin.String [val] + CALL 'public final fun component2 (): B of kotlin.Pair [operator] declared in kotlin.Pair' type=kotlin.String origin=null + $this: GET_VAR 'val : kotlin.Pair [val] declared in .testDestructuring' type=kotlin.Pair origin=null + CALL 'public final fun println (message: kotlin.Int): kotlin.Unit [inline] declared in kotlin.io.ConsoleKt' type=kotlin.Unit origin=null + message: GET_VAR 'val i: kotlin.Int [val] declared in .testDestructuring' type=kotlin.Int origin=null + CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit [inline] declared in kotlin.io.ConsoleKt' type=kotlin.Unit origin=null + message: GET_VAR 'val s: kotlin.String [val] declared in .testDestructuring' type=kotlin.String origin=null FUN name:testRange visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY BLOCK type=kotlin.Unit origin=FOR_LOOP diff --git a/compiler/testData/ir/irText/expressions/forWithBreakContinue.fir.kt.txt b/compiler/testData/ir/irText/expressions/forWithBreakContinue.fir.kt.txt index 2a96bfab610..4fb24a9177e 100644 --- a/compiler/testData/ir/irText/expressions/forWithBreakContinue.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/forWithBreakContinue.fir.kt.txt @@ -14,15 +14,19 @@ fun testForBreak2(ss: List) { OUTER@ while (.hasNext()) { // BLOCK val s1: String = .next() { // BLOCK - val : Iterator = ss.iterator() - INNER@ while (.hasNext()) { // BLOCK - val s2: String = .next() - break@OUTER - break@INNER - break@INNER + { // BLOCK + val : Iterator = ss.iterator() + INNER@ while (.hasNext()) { // BLOCK + val s2: String = .next() + { // BLOCK + break@OUTER + break@INNER + break@INNER + } + } } + break@OUTER } - break@OUTER } } } @@ -43,15 +47,20 @@ fun testForContinue2(ss: List) { OUTER@ while (.hasNext()) { // BLOCK val s1: String = .next() { // BLOCK - val : Iterator = ss.iterator() - INNER@ while (.hasNext()) { // BLOCK - val s2: String = .next() - continue@OUTER - continue@INNER - continue@INNER + { // BLOCK + val : Iterator = ss.iterator() + INNER@ while (.hasNext()) { // BLOCK + val s2: String = .next() + { // BLOCK + continue@OUTER + continue@INNER + continue@INNER + } + } } + continue@OUTER } - continue@OUTER } } } + diff --git a/compiler/testData/ir/irText/expressions/forWithBreakContinue.fir.txt b/compiler/testData/ir/irText/expressions/forWithBreakContinue.fir.txt index 96a0e57be53..55e84fb1eee 100644 --- a/compiler/testData/ir/irText/expressions/forWithBreakContinue.fir.txt +++ b/compiler/testData/ir/irText/expressions/forWithBreakContinue.fir.txt @@ -9,7 +9,7 @@ FILE fqName: fileName:/forWithBreakContinue.kt WHILE label=null origin=FOR_LOOP_INNER_WHILE condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT $this: GET_VAR 'val tmp_0: kotlin.collections.Iterator [val] declared in .testForBreak1' type=kotlin.collections.Iterator origin=null - body: BLOCK type=kotlin.Nothing origin=FOR_LOOP_INNER_WHILE + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE VAR FOR_LOOP_VARIABLE name:s type:kotlin.String [val] CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT $this: GET_VAR 'val tmp_0: kotlin.collections.Iterator [val] declared in .testForBreak1' type=kotlin.collections.Iterator origin=null @@ -24,25 +24,27 @@ FILE fqName: fileName:/forWithBreakContinue.kt WHILE label=OUTER origin=FOR_LOOP_INNER_WHILE condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT $this: GET_VAR 'val tmp_1: kotlin.collections.Iterator [val] declared in .testForBreak2' type=kotlin.collections.Iterator origin=null - body: BLOCK type=kotlin.Nothing origin=FOR_LOOP_INNER_WHILE + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE VAR FOR_LOOP_VARIABLE name:s1 type:kotlin.String [val] CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT $this: GET_VAR 'val tmp_1: kotlin.collections.Iterator [val] declared in .testForBreak2' type=kotlin.collections.Iterator origin=null - BLOCK type=kotlin.Unit origin=FOR_LOOP - VAR FOR_LOOP_ITERATOR name:tmp_2 type:kotlin.collections.Iterator [val] - CALL 'public abstract fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.collections.List' type=kotlin.collections.Iterator origin=FOR_LOOP_ITERATOR - $this: GET_VAR 'ss: kotlin.collections.List declared in .testForBreak2' type=kotlin.collections.List origin=null - WHILE label=INNER origin=FOR_LOOP_INNER_WHILE - condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT - $this: GET_VAR 'val tmp_2: kotlin.collections.Iterator [val] declared in .testForBreak2' type=kotlin.collections.Iterator origin=null - body: BLOCK type=kotlin.Nothing origin=FOR_LOOP_INNER_WHILE - VAR FOR_LOOP_VARIABLE name:s2 type:kotlin.String [val] - CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT - $this: GET_VAR 'val tmp_2: kotlin.collections.Iterator [val] declared in .testForBreak2' type=kotlin.collections.Iterator origin=null - BREAK label=OUTER loop.label=OUTER - BREAK label=INNER loop.label=INNER - BREAK label=INNER loop.label=INNER - BREAK label=OUTER loop.label=OUTER + BLOCK type=kotlin.Nothing origin=null + BLOCK type=kotlin.Unit origin=FOR_LOOP + VAR FOR_LOOP_ITERATOR name:tmp_2 type:kotlin.collections.Iterator [val] + CALL 'public abstract fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.collections.List' type=kotlin.collections.Iterator origin=FOR_LOOP_ITERATOR + $this: GET_VAR 'ss: kotlin.collections.List declared in .testForBreak2' type=kotlin.collections.List origin=null + WHILE label=INNER origin=FOR_LOOP_INNER_WHILE + condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT + $this: GET_VAR 'val tmp_2: kotlin.collections.Iterator [val] declared in .testForBreak2' type=kotlin.collections.Iterator origin=null + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE + VAR FOR_LOOP_VARIABLE name:s2 type:kotlin.String [val] + CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT + $this: GET_VAR 'val tmp_2: kotlin.collections.Iterator [val] declared in .testForBreak2' type=kotlin.collections.Iterator origin=null + BLOCK type=kotlin.Nothing origin=null + BREAK label=OUTER loop.label=OUTER + BREAK label=INNER loop.label=INNER + BREAK label=INNER loop.label=INNER + BREAK label=OUTER loop.label=OUTER FUN name:testForContinue1 visibility:public modality:FINAL <> (ss:kotlin.collections.List) returnType:kotlin.Unit VALUE_PARAMETER name:ss index:0 type:kotlin.collections.List BLOCK_BODY @@ -53,7 +55,7 @@ FILE fqName: fileName:/forWithBreakContinue.kt WHILE label=null origin=FOR_LOOP_INNER_WHILE condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT $this: GET_VAR 'val tmp_3: kotlin.collections.Iterator [val] declared in .testForContinue1' type=kotlin.collections.Iterator origin=null - body: BLOCK type=kotlin.Nothing origin=FOR_LOOP_INNER_WHILE + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE VAR FOR_LOOP_VARIABLE name:s type:kotlin.String [val] CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT $this: GET_VAR 'val tmp_3: kotlin.collections.Iterator [val] declared in .testForContinue1' type=kotlin.collections.Iterator origin=null @@ -68,22 +70,24 @@ FILE fqName: fileName:/forWithBreakContinue.kt WHILE label=OUTER origin=FOR_LOOP_INNER_WHILE condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT $this: GET_VAR 'val tmp_4: kotlin.collections.Iterator [val] declared in .testForContinue2' type=kotlin.collections.Iterator origin=null - body: BLOCK type=kotlin.Nothing origin=FOR_LOOP_INNER_WHILE + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE VAR FOR_LOOP_VARIABLE name:s1 type:kotlin.String [val] CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT $this: GET_VAR 'val tmp_4: kotlin.collections.Iterator [val] declared in .testForContinue2' type=kotlin.collections.Iterator origin=null - BLOCK type=kotlin.Unit origin=FOR_LOOP - VAR FOR_LOOP_ITERATOR name:tmp_5 type:kotlin.collections.Iterator [val] - CALL 'public abstract fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.collections.List' type=kotlin.collections.Iterator origin=FOR_LOOP_ITERATOR - $this: GET_VAR 'ss: kotlin.collections.List declared in .testForContinue2' type=kotlin.collections.List origin=null - WHILE label=INNER origin=FOR_LOOP_INNER_WHILE - condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT - $this: GET_VAR 'val tmp_5: kotlin.collections.Iterator [val] declared in .testForContinue2' type=kotlin.collections.Iterator origin=null - body: BLOCK type=kotlin.Nothing origin=FOR_LOOP_INNER_WHILE - VAR FOR_LOOP_VARIABLE name:s2 type:kotlin.String [val] - CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT - $this: GET_VAR 'val tmp_5: kotlin.collections.Iterator [val] declared in .testForContinue2' type=kotlin.collections.Iterator origin=null - CONTINUE label=OUTER loop.label=OUTER - CONTINUE label=INNER loop.label=INNER - CONTINUE label=INNER loop.label=INNER - CONTINUE label=OUTER loop.label=OUTER + BLOCK type=kotlin.Nothing origin=null + BLOCK type=kotlin.Unit origin=FOR_LOOP + VAR FOR_LOOP_ITERATOR name:tmp_5 type:kotlin.collections.Iterator [val] + CALL 'public abstract fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.collections.List' type=kotlin.collections.Iterator origin=FOR_LOOP_ITERATOR + $this: GET_VAR 'ss: kotlin.collections.List declared in .testForContinue2' type=kotlin.collections.List origin=null + WHILE label=INNER origin=FOR_LOOP_INNER_WHILE + condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT + $this: GET_VAR 'val tmp_5: kotlin.collections.Iterator [val] declared in .testForContinue2' type=kotlin.collections.Iterator origin=null + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE + VAR FOR_LOOP_VARIABLE name:s2 type:kotlin.String [val] + CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT + $this: GET_VAR 'val tmp_5: kotlin.collections.Iterator [val] declared in .testForContinue2' type=kotlin.collections.Iterator origin=null + BLOCK type=kotlin.Nothing origin=null + CONTINUE label=OUTER loop.label=OUTER + CONTINUE label=INNER loop.label=INNER + CONTINUE label=INNER loop.label=INNER + CONTINUE label=OUTER loop.label=OUTER diff --git a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.fir.kt.txt b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.fir.kt.txt index c23e32d63c5..1265b40b4c7 100644 --- a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.fir.kt.txt +++ b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.fir.kt.txt @@ -49,14 +49,17 @@ fun resolveClashesIfAny(container: ComponentContainer, clashResolvers: List: Iterator> = clashResolvers.iterator() while (.hasNext()) { // BLOCK val resolver: PlatformExtensionsClashResolver<*> = .next() - val clashedComponents: Collection = { // BLOCK - val : Collection? = ().get(p0 = resolver.()) as? Collection - when { - EQEQ(arg0 = , arg1 = null) -> continue - else -> + { // BLOCK + val clashedComponents: Collection = { // BLOCK + val : Collection? = ().get(p0 = resolver.()) as? Collection + when { + EQEQ(arg0 = , arg1 = null) -> continue + else -> + } } + val substituteDescriptor: ClashResolutionDescriptor>>>>> = ClashResolutionDescriptor>>>>>(container = container, resolver = resolver, clashedComponents = clashedComponents.toList()) } - val substituteDescriptor: ClashResolutionDescriptor>>>>> = ClashResolutionDescriptor>>>>>(container = container, resolver = resolver, clashedComponents = clashedComponents.toList()) } } } + diff --git a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.fir.txt b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.fir.txt index 16ee7baa6f5..fa445d381f7 100644 --- a/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.fir.txt +++ b/compiler/testData/ir/irText/firProblems/ClashResolutionDescriptor.fir.txt @@ -148,28 +148,29 @@ FILE fqName: fileName:/ClashResolutionDescriptor.kt VAR FOR_LOOP_VARIABLE name:resolver type:.PlatformExtensionsClashResolver<*> [val] CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=.PlatformExtensionsClashResolver<*> origin=FOR_LOOP_NEXT $this: GET_VAR 'val tmp_0: kotlin.collections.Iterator<.PlatformExtensionsClashResolver<*>> [val] declared in .resolveClashesIfAny' type=kotlin.collections.Iterator<.PlatformExtensionsClashResolver<*>> origin=null - VAR name:clashedComponents type:kotlin.collections.Collection<.ComponentDescriptor> [val] - BLOCK type=kotlin.collections.Collection<.ComponentDescriptor> origin=ELVIS - VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.collections.Collection<.ComponentDescriptor>? [val] - TYPE_OP type=kotlin.collections.Collection<.ComponentDescriptor>? origin=SAFE_CAST typeOperand=kotlin.collections.Collection<.ComponentDescriptor> - CALL 'public open fun get (p0: @[FlexibleNullability] K of java.util.HashMap?): V of java.util.HashMap? [operator] declared in java.util.HashMap' type=kotlin.Any? origin=null - $this: CALL 'private final fun (): java.util.HashMap declared in ' type=java.util.HashMap origin=GET_PROPERTY - p0: CALL 'public final fun (): java.lang.Class.PlatformExtensionsClashResolver> declared in .PlatformExtensionsClashResolver' type=java.lang.Class.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension>>>>> origin=GET_PROPERTY - $this: GET_VAR 'val resolver: .PlatformExtensionsClashResolver<*> [val] declared in .resolveClashesIfAny' type=.PlatformExtensionsClashResolver<*> origin=null - WHEN type=kotlin.collections.Collection<.ComponentDescriptor> origin=ELVIS - 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: kotlin.collections.Collection<.ComponentDescriptor>? [val] declared in .resolveClashesIfAny' type=kotlin.collections.Collection<.ComponentDescriptor>? origin=null - arg1: CONST Null type=kotlin.Nothing? value=null - then: CONTINUE label=null loop.label=null - BRANCH - if: CONST Boolean type=kotlin.Boolean value=true - then: GET_VAR 'val tmp_1: kotlin.collections.Collection<.ComponentDescriptor>? [val] declared in .resolveClashesIfAny' type=kotlin.collections.Collection<.ComponentDescriptor>? origin=null - VAR name:substituteDescriptor type:.ClashResolutionDescriptor.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension>>>>> [val] - CONSTRUCTOR_CALL 'public constructor (container: .ComponentContainer, resolver: .PlatformExtensionsClashResolver.ClashResolutionDescriptor>, clashedComponents: kotlin.collections.List<.ComponentDescriptor>) [primary] declared in .ClashResolutionDescriptor' type=.ClashResolutionDescriptor.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension>>>>> origin=null - : .PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension>>>> - container: GET_VAR 'container: .ComponentContainer declared in .resolveClashesIfAny' type=.ComponentContainer origin=null - resolver: GET_VAR 'val resolver: .PlatformExtensionsClashResolver<*> [val] declared in .resolveClashesIfAny' type=.PlatformExtensionsClashResolver<*> origin=null - clashedComponents: CALL 'public final fun toList (): kotlin.collections.List declared in kotlin.collections.CollectionsKt' type=kotlin.collections.List<.ComponentDescriptor> origin=null - : .ComponentDescriptor - $receiver: GET_VAR 'val clashedComponents: kotlin.collections.Collection<.ComponentDescriptor> [val] declared in .resolveClashesIfAny' type=kotlin.collections.Collection<.ComponentDescriptor> origin=null + BLOCK type=kotlin.Unit origin=null + VAR name:clashedComponents type:kotlin.collections.Collection<.ComponentDescriptor> [val] + BLOCK type=kotlin.collections.Collection<.ComponentDescriptor> origin=ELVIS + VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.collections.Collection<.ComponentDescriptor>? [val] + TYPE_OP type=kotlin.collections.Collection<.ComponentDescriptor>? origin=SAFE_CAST typeOperand=kotlin.collections.Collection<.ComponentDescriptor> + CALL 'public open fun get (p0: @[FlexibleNullability] K of java.util.HashMap?): V of java.util.HashMap? [operator] declared in java.util.HashMap' type=kotlin.Any? origin=null + $this: CALL 'private final fun (): java.util.HashMap declared in ' type=java.util.HashMap origin=GET_PROPERTY + p0: CALL 'public final fun (): java.lang.Class.PlatformExtensionsClashResolver> declared in .PlatformExtensionsClashResolver' type=java.lang.Class.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension>>>>> origin=GET_PROPERTY + $this: GET_VAR 'val resolver: .PlatformExtensionsClashResolver<*> [val] declared in .resolveClashesIfAny' type=.PlatformExtensionsClashResolver<*> origin=null + WHEN type=kotlin.collections.Collection<.ComponentDescriptor> origin=ELVIS + 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: kotlin.collections.Collection<.ComponentDescriptor>? [val] declared in .resolveClashesIfAny' type=kotlin.collections.Collection<.ComponentDescriptor>? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONTINUE label=null loop.label=null + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: GET_VAR 'val tmp_1: kotlin.collections.Collection<.ComponentDescriptor>? [val] declared in .resolveClashesIfAny' type=kotlin.collections.Collection<.ComponentDescriptor>? origin=null + VAR name:substituteDescriptor type:.ClashResolutionDescriptor.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension>>>>> [val] + CONSTRUCTOR_CALL 'public constructor (container: .ComponentContainer, resolver: .PlatformExtensionsClashResolver.ClashResolutionDescriptor>, clashedComponents: kotlin.collections.List<.ComponentDescriptor>) [primary] declared in .ClashResolutionDescriptor' type=.ClashResolutionDescriptor.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension>>>>> origin=null + : .PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension.PlatformSpecificExtension>>>> + container: GET_VAR 'container: .ComponentContainer declared in .resolveClashesIfAny' type=.ComponentContainer origin=null + resolver: GET_VAR 'val resolver: .PlatformExtensionsClashResolver<*> [val] declared in .resolveClashesIfAny' type=.PlatformExtensionsClashResolver<*> origin=null + clashedComponents: CALL 'public final fun toList (): kotlin.collections.List declared in kotlin.collections.CollectionsKt' type=kotlin.collections.List<.ComponentDescriptor> origin=null + : .ComponentDescriptor + $receiver: GET_VAR 'val clashedComponents: kotlin.collections.Collection<.ComponentDescriptor> [val] declared in .resolveClashesIfAny' type=kotlin.collections.Collection<.ComponentDescriptor> origin=null diff --git a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.fir.kt.txt b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.fir.kt.txt index fcf25423542..fe24a4200fe 100644 --- a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.fir.kt.txt +++ b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.fir.kt.txt @@ -55,12 +55,14 @@ class DeepCopyIrTreeWithSymbols { val : Iterator> = .().zip(other = other.()).iterator() while (.hasNext()) { // BLOCK val : Pair = .next() - val thisTypeParameter: IrTypeParameter = .component1() - val otherTypeParameter: IrTypeParameter = .component2() - otherTypeParameter.().mapTo>(destination = thisTypeParameter.(), transform = local fun (it: IrType): IrType { - return .().remapType(type = it) - } + { // BLOCK + val thisTypeParameter: IrTypeParameter = .component1() + val otherTypeParameter: IrTypeParameter = .component2() + otherTypeParameter.().mapTo>(destination = thisTypeParameter.(), transform = local fun (it: IrType): IrType { + return .().remapType(type = it) + } ) + } } } } @@ -75,3 +77,4 @@ inline fun TypeRemapper.withinScope(irTypeParametersContainer: IrType .leaveScope() return result } + diff --git a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.fir.txt b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.fir.txt index 52315b38e74..53c0bd6e5bd 100644 --- a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.fir.txt +++ b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.fir.txt @@ -177,33 +177,34 @@ FILE fqName: fileName:/DeepCopyIrTree.kt WHILE label=null origin=FOR_LOOP_INNER_WHILE condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT $this: GET_VAR 'val tmp_0: kotlin.collections.Iterator.IrTypeParameter, .IrTypeParameter>> [val] declared in .DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.' type=kotlin.collections.Iterator.IrTypeParameter, .IrTypeParameter>> origin=null - body: BLOCK type=kotlin.collections.MutableList<.IrType> origin=FOR_LOOP_INNER_WHILE + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE VAR FOR_LOOP_VARIABLE name: type:kotlin.Pair<.IrTypeParameter, .IrTypeParameter> [val] CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=kotlin.Pair<.IrTypeParameter, .IrTypeParameter> origin=FOR_LOOP_NEXT $this: GET_VAR 'val tmp_0: kotlin.collections.Iterator.IrTypeParameter, .IrTypeParameter>> [val] declared in .DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.' type=kotlin.collections.Iterator.IrTypeParameter, .IrTypeParameter>> origin=null - VAR name:thisTypeParameter type:.IrTypeParameter [val] - CALL 'public final fun component1 (): A of kotlin.Pair [operator] declared in kotlin.Pair' type=.IrTypeParameter origin=null - $this: GET_VAR 'val : kotlin.Pair<.IrTypeParameter, .IrTypeParameter> [val] declared in .DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.' type=kotlin.Pair<.IrTypeParameter, .IrTypeParameter> origin=null - VAR name:otherTypeParameter type:.IrTypeParameter [val] - CALL 'public final fun component2 (): B of kotlin.Pair [operator] declared in kotlin.Pair' type=.IrTypeParameter origin=null - $this: GET_VAR 'val : kotlin.Pair<.IrTypeParameter, .IrTypeParameter> [val] declared in .DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.' type=kotlin.Pair<.IrTypeParameter, .IrTypeParameter> origin=null - CALL 'public final fun mapTo (destination: C of kotlin.collections.CollectionsKt.mapTo, transform: kotlin.Function1): C of kotlin.collections.CollectionsKt.mapTo [inline] declared in kotlin.collections.CollectionsKt' type=kotlin.collections.MutableList<.IrType> origin=null - : .IrType - : .IrType - : kotlin.collections.MutableList<.IrType> - $receiver: CALL 'public abstract fun (): kotlin.collections.MutableList<.IrType> declared in .IrTypeParameter' type=kotlin.collections.MutableList<.IrType> origin=GET_PROPERTY - $this: GET_VAR 'val otherTypeParameter: .IrTypeParameter [val] declared in .DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.' type=.IrTypeParameter origin=null - destination: CALL 'public abstract fun (): kotlin.collections.MutableList<.IrType> declared in .IrTypeParameter' type=kotlin.collections.MutableList<.IrType> origin=GET_PROPERTY - $this: GET_VAR 'val thisTypeParameter: .IrTypeParameter [val] declared in .DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.' type=.IrTypeParameter origin=null - transform: FUN_EXPR type=kotlin.Function1<.IrType, .IrType> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:.IrType) returnType:.IrType - VALUE_PARAMETER name:it index:0 type:.IrType - BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (it: .IrType): .IrType declared in .DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.' - CALL 'public abstract fun remapType (type: .IrType): .IrType declared in .TypeRemapper' type=.IrType origin=null - $this: CALL 'private final fun (): .TypeRemapper declared in .DeepCopyIrTreeWithSymbols' type=.TypeRemapper origin=GET_PROPERTY - $this: GET_VAR ': .DeepCopyIrTreeWithSymbols declared in .DeepCopyIrTreeWithSymbols.copyTypeParametersFrom' type=.DeepCopyIrTreeWithSymbols origin=null - type: GET_VAR 'it: .IrType declared in .DeepCopyIrTreeWithSymbols.copyTypeParametersFrom..' type=.IrType origin=null + BLOCK type=kotlin.collections.MutableList<.IrType> origin=null + VAR name:thisTypeParameter type:.IrTypeParameter [val] + CALL 'public final fun component1 (): A of kotlin.Pair [operator] declared in kotlin.Pair' type=.IrTypeParameter origin=null + $this: GET_VAR 'val : kotlin.Pair<.IrTypeParameter, .IrTypeParameter> [val] declared in .DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.' type=kotlin.Pair<.IrTypeParameter, .IrTypeParameter> origin=null + VAR name:otherTypeParameter type:.IrTypeParameter [val] + CALL 'public final fun component2 (): B of kotlin.Pair [operator] declared in kotlin.Pair' type=.IrTypeParameter origin=null + $this: GET_VAR 'val : kotlin.Pair<.IrTypeParameter, .IrTypeParameter> [val] declared in .DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.' type=kotlin.Pair<.IrTypeParameter, .IrTypeParameter> origin=null + CALL 'public final fun mapTo (destination: C of kotlin.collections.CollectionsKt.mapTo, transform: kotlin.Function1): C of kotlin.collections.CollectionsKt.mapTo [inline] declared in kotlin.collections.CollectionsKt' type=kotlin.collections.MutableList<.IrType> origin=null + : .IrType + : .IrType + : kotlin.collections.MutableList<.IrType> + $receiver: CALL 'public abstract fun (): kotlin.collections.MutableList<.IrType> declared in .IrTypeParameter' type=kotlin.collections.MutableList<.IrType> origin=GET_PROPERTY + $this: GET_VAR 'val otherTypeParameter: .IrTypeParameter [val] declared in .DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.' type=.IrTypeParameter origin=null + destination: CALL 'public abstract fun (): kotlin.collections.MutableList<.IrType> declared in .IrTypeParameter' type=kotlin.collections.MutableList<.IrType> origin=GET_PROPERTY + $this: GET_VAR 'val thisTypeParameter: .IrTypeParameter [val] declared in .DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.' type=.IrTypeParameter origin=null + transform: FUN_EXPR type=kotlin.Function1<.IrType, .IrType> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:.IrType) returnType:.IrType + VALUE_PARAMETER name:it index:0 type:.IrType + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (it: .IrType): .IrType declared in .DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.' + CALL 'public abstract fun remapType (type: .IrType): .IrType declared in .TypeRemapper' type=.IrType origin=null + $this: CALL 'private final fun (): .TypeRemapper declared in .DeepCopyIrTreeWithSymbols' type=.TypeRemapper origin=GET_PROPERTY + $this: GET_VAR ': .DeepCopyIrTreeWithSymbols declared in .DeepCopyIrTreeWithSymbols.copyTypeParametersFrom' type=.DeepCopyIrTreeWithSymbols origin=null + type: GET_VAR 'it: .IrType declared in .DeepCopyIrTreeWithSymbols.copyTypeParametersFrom..' type=.IrType origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.kt.txt index 3a80807ad5c..8ef78dace55 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.kt.txt @@ -15,8 +15,10 @@ fun testForInListDestructured() { val : MutableIterator<@FlexibleNullability P?> = listOfNotNull().iterator() while (.hasNext()) { // BLOCK val : @FlexibleNullability P? = .next() - val x: Int = .component1() - val y: Int = .component2() + { // BLOCK + val x: Int = .component1() + val y: Int = .component2() + } } } } @@ -42,8 +44,10 @@ fun testForInListUse() { val : MutableIterator<@FlexibleNullability P?> = listOfNotNull().iterator() while (.hasNext()) { // BLOCK val x: @FlexibleNullability P? = .next() - use(s = x /*!! @FlexibleNullability P */) - use(s = x) + { // BLOCK + use(s = x /*!! @FlexibleNullability P */) + use(s = x) + } } } } @@ -53,8 +57,10 @@ fun testForInArrayUse(j: J) { val : Iterator<@FlexibleNullability P?> = j.arrayOfNotNull().iterator() while (.hasNext()) { // BLOCK val x: @FlexibleNullability P? = .next() - use(s = x /*!! @FlexibleNullability P */) - use(s = x) + { // BLOCK + use(s = x /*!! @FlexibleNullability P */) + use(s = x) + } } } } diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.txt index 15af57bbe7b..bd7b8a609a1 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.txt @@ -28,12 +28,13 @@ FILE fqName: fileName:/enhancedNullabilityInForLoop.kt VAR FOR_LOOP_VARIABLE name: type:@[FlexibleNullability] .P? [val] CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableIterator' type=@[FlexibleNullability] .P? origin=FOR_LOOP_NEXT $this: GET_VAR 'val tmp_1: kotlin.collections.MutableIterator<@[FlexibleNullability] .P?> [val] declared in .testForInListDestructured' type=kotlin.collections.MutableIterator<@[FlexibleNullability] .P?> origin=null - VAR name:x type:kotlin.Int [val] - CALL 'public final fun component1 (): kotlin.Int [operator] declared in .P' type=kotlin.Int origin=null - $this: GET_VAR 'val : @[FlexibleNullability] .P? [val] declared in .testForInListDestructured' type=@[FlexibleNullability] .P? origin=null - VAR name:y type:kotlin.Int [val] - CALL 'public final fun component2 (): kotlin.Int [operator] declared in .P' type=kotlin.Int origin=null - $this: GET_VAR 'val : @[FlexibleNullability] .P? [val] declared in .testForInListDestructured' type=@[FlexibleNullability] .P? origin=null + BLOCK type=kotlin.Unit origin=null + VAR name:x type:kotlin.Int [val] + CALL 'public final fun component1 (): kotlin.Int [operator] declared in .P' type=kotlin.Int origin=null + $this: GET_VAR 'val : @[FlexibleNullability] .P? [val] declared in .testForInListDestructured' type=@[FlexibleNullability] .P? origin=null + VAR name:y type:kotlin.Int [val] + CALL 'public final fun component2 (): kotlin.Int [operator] declared in .P' type=kotlin.Int origin=null + $this: GET_VAR 'val : @[FlexibleNullability] .P? [val] declared in .testForInListDestructured' type=@[FlexibleNullability] .P? origin=null FUN name:testDesugaredForInList visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY VAR name:iterator type:kotlin.collections.MutableIterator<@[FlexibleNullability] .P?> [val] @@ -74,11 +75,12 @@ FILE fqName: fileName:/enhancedNullabilityInForLoop.kt VAR FOR_LOOP_VARIABLE name:x type:@[FlexibleNullability] .P? [val] CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableIterator' type=@[FlexibleNullability] .P? origin=FOR_LOOP_NEXT $this: GET_VAR 'val tmp_3: kotlin.collections.MutableIterator<@[FlexibleNullability] .P?> [val] declared in .testForInListUse' type=kotlin.collections.MutableIterator<@[FlexibleNullability] .P?> origin=null - CALL 'public final fun use (s: .P): kotlin.Unit declared in ' type=kotlin.Unit origin=null - s: TYPE_OP type=@[FlexibleNullability] .P origin=IMPLICIT_NOTNULL typeOperand=@[FlexibleNullability] .P - GET_VAR 'val x: @[FlexibleNullability] .P? [val] declared in .testForInListUse' type=@[FlexibleNullability] .P? origin=null - CALL 'public open fun use (s: @[EnhancedNullability] .P): kotlin.Unit declared in .J' type=kotlin.Unit origin=null - s: GET_VAR 'val x: @[FlexibleNullability] .P? [val] declared in .testForInListUse' type=@[FlexibleNullability] .P? origin=null + BLOCK type=kotlin.Unit origin=null + CALL 'public final fun use (s: .P): kotlin.Unit declared in ' type=kotlin.Unit origin=null + s: TYPE_OP type=@[FlexibleNullability] .P origin=IMPLICIT_NOTNULL typeOperand=@[FlexibleNullability] .P + GET_VAR 'val x: @[FlexibleNullability] .P? [val] declared in .testForInListUse' type=@[FlexibleNullability] .P? origin=null + CALL 'public open fun use (s: @[EnhancedNullability] .P): kotlin.Unit declared in .J' type=kotlin.Unit origin=null + s: GET_VAR 'val x: @[FlexibleNullability] .P? [val] declared in .testForInListUse' type=@[FlexibleNullability] .P? origin=null FUN name:testForInArrayUse visibility:public modality:FINAL <> (j:.J) returnType:kotlin.Unit VALUE_PARAMETER name:j index:0 type:.J BLOCK_BODY @@ -94,11 +96,12 @@ FILE fqName: fileName:/enhancedNullabilityInForLoop.kt VAR FOR_LOOP_VARIABLE name:x type:@[FlexibleNullability] .P? [val] CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=@[FlexibleNullability] .P? origin=FOR_LOOP_NEXT $this: GET_VAR 'val tmp_4: kotlin.collections.Iterator<@[FlexibleNullability] .P?> [val] declared in .testForInArrayUse' type=kotlin.collections.Iterator<@[FlexibleNullability] .P?> origin=null - CALL 'public final fun use (s: .P): kotlin.Unit declared in ' type=kotlin.Unit origin=null - s: TYPE_OP type=@[FlexibleNullability] .P origin=IMPLICIT_NOTNULL typeOperand=@[FlexibleNullability] .P - GET_VAR 'val x: @[FlexibleNullability] .P? [val] declared in .testForInArrayUse' type=@[FlexibleNullability] .P? origin=null - CALL 'public open fun use (s: @[EnhancedNullability] .P): kotlin.Unit declared in .J' type=kotlin.Unit origin=null - s: GET_VAR 'val x: @[FlexibleNullability] .P? [val] declared in .testForInArrayUse' type=@[FlexibleNullability] .P? origin=null + BLOCK type=kotlin.Unit origin=null + CALL 'public final fun use (s: .P): kotlin.Unit declared in ' type=kotlin.Unit origin=null + s: TYPE_OP type=@[FlexibleNullability] .P origin=IMPLICIT_NOTNULL typeOperand=@[FlexibleNullability] .P + GET_VAR 'val x: @[FlexibleNullability] .P? [val] declared in .testForInArrayUse' type=@[FlexibleNullability] .P? origin=null + CALL 'public open fun use (s: @[EnhancedNullability] .P): kotlin.Unit declared in .J' type=kotlin.Unit origin=null + s: GET_VAR 'val x: @[FlexibleNullability] .P? [val] declared in .testForInArrayUse' type=@[FlexibleNullability] .P? origin=null CLASS INTERFACE name:K modality:ABSTRACT visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.K FUN name:arrayOfNotNull visibility:public modality:ABSTRACT <> ($this:.K) returnType:kotlin.Array<.P> diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 5e71719233e..43a6f58deeb 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -15182,6 +15182,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/fir/NameHighlighter.kt"); } + @Test + @TestMetadata("noSymbolForIntRangeIterator.kt") + public void testNoSymbolForIntRangeIterator() throws Exception { + runTest("compiler/testData/codegen/box/fir/noSymbolForIntRangeIterator.kt"); + } + @Test @TestMetadata("SuspendExtension.kt") public void testSuspendExtension() throws Exception {