From 2bfce4f127ef3952d286e186baddaa737d783095 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 11 Feb 2020 16:28:29 +0300 Subject: [PATCH] FIR2IR: provide correct origins for 'for' loops --- .../fir/backend/Fir2IrDeclarationStorage.kt | 10 ++- .../kotlin/fir/backend/Fir2IrVisitor.kt | 47 ++++++++---- .../kotlin/fir/resolve/ResolveUtils.kt | 10 ++- .../expressions/badBreakContinue.fir.txt | 8 +- .../irText/expressions/breakContinue.fir.txt | 12 +-- .../breakContinueInLoopHeader.fir.txt | 38 +++++----- .../expressions/breakContinueInWhen.fir.txt | 20 ++--- .../withVarargViewedAsArray.fir.txt | 10 +-- .../ir/irText/expressions/for.fir.txt | 54 +++++++------- .../expressions/forWithBreakContinue.fir.txt | 72 +++++++++--------- .../forWithImplicitReceivers.fir.txt | 4 +- .../irText/expressions/whileDoWhile.fir.txt | 6 +- .../irText/regressions/coercionInLoop.fir.txt | 2 +- .../enhancedNullabilityInForLoop.fir.txt | 74 +++++++++---------- 14 files changed, 198 insertions(+), 169 deletions(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt index bc6a8279447..34e236c15e4 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt @@ -779,11 +779,15 @@ class Fir2IrDeclarationStorage( } } - fun createAndSaveIrVariable(variable: FirVariable<*>): IrVariable { + fun createAndSaveIrVariable(variable: FirVariable<*>, givenOrigin: IrDeclarationOrigin? = null): IrVariable { val type = variable.returnTypeRef.toIrType(session, this) // Some temporary variables are produced in RawFirBuilder, but we consistently use special names for them. - val origin = - if (variable.name.isSpecial) IrDeclarationOrigin.IR_TEMPORARY_VARIABLE else IrDeclarationOrigin.DEFINED + val origin = when { + givenOrigin != null -> givenOrigin + variable.name == Name.special("") -> IrDeclarationOrigin.FOR_LOOP_ITERATOR + variable.name.isSpecial -> IrDeclarationOrigin.IR_TEMPORARY_VARIABLE + else -> IrDeclarationOrigin.DEFINED + } val irVariable = variable.convertWithOffsets { startOffset, endOffset -> declareIrVariable( startOffset, endOffset, origin, 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 7841ccb4718..15d20ed6aeb 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 @@ -469,9 +469,14 @@ class Fir2IrVisitor( private fun visitLocalVariable(variable: FirProperty): IrElement { assert(variable.isLocal) - val irVariable = declarationStorage.createAndSaveIrVariable(variable) + val initializer = variable.initializer + val isNextVariable = initializer is FirFunctionCall && + initializer.resolvedNamedFunctionSymbol()?.callableId?.isIteratorNext() == true && + variable.source.psi?.parent is KtForExpression + val irVariable = declarationStorage.createAndSaveIrVariable( + variable, if (isNextVariable) IrDeclarationOrigin.FOR_LOOP_VARIABLE else null + ) return irVariable.setParentByParentStack().apply { - val initializer = variable.initializer if (initializer != null) { this.initializer = initializer.toIrExpression() } @@ -671,7 +676,13 @@ class Fir2IrVisitor( is FirPropertyFromParameterResolvedNamedReference -> IrStatementOrigin.INITIALIZE_PROPERTY_FROM_PARAMETER is FirResolvedNamedReference -> when (resolvedSymbol) { is AccessorSymbol, is SyntheticPropertySymbol -> IrStatementOrigin.GET_PROPERTY - is FirNamedFunctionSymbol -> if (resolvedSymbol.callableId.isInvoke()) IrStatementOrigin.INVOKE else null + is FirNamedFunctionSymbol -> when { + resolvedSymbol.callableId.isInvoke() -> IrStatementOrigin.INVOKE + source.psi is KtForExpression && resolvedSymbol.callableId.isIteratorNext() -> IrStatementOrigin.FOR_LOOP_NEXT + source.psi is KtForExpression && resolvedSymbol.callableId.isIteratorHasNext() -> IrStatementOrigin.FOR_LOOP_HAS_NEXT + source.psi is KtForExpression && resolvedSymbol.callableId.isIterator() -> IrStatementOrigin.FOR_LOOP_ITERATOR + else -> null + } else -> null } else -> null @@ -857,16 +868,24 @@ class Fir2IrVisitor( val convertibleCall = if (functionCall.toResolvedCallableSymbol()?.fir is FirIntegerOperator) { functionCall.copy().transformSingle(integerApproximator, null) } else { - functionCall.replaceCalleeReferenceWithOverridden() + val resolvedSymbol = functionCall.resolvedNamedFunctionSymbol() + if (resolvedSymbol != null) { + functionCall.replaceCalleeReferenceWithOverridden(resolvedSymbol) + } else { + functionCall + } } return convertibleCall.toIrExpression(convertibleCall.typeRef) .applyCallArguments(convertibleCall).applyTypeArguments(convertibleCall).applyReceivers(convertibleCall) } + private fun FirFunctionCall.resolvedNamedFunctionSymbol(): FirNamedFunctionSymbol? { + val calleeReference = (calleeReference as? FirResolvedNamedReference) ?: return null + return calleeReference.resolvedSymbol as? FirNamedFunctionSymbol + } + // Use the generic invoke & next methods to match bridges generated by the backend. - private fun FirFunctionCall.replaceCalleeReferenceWithOverridden(): FirFunctionCall { - val calleeReference = (calleeReference as? FirResolvedNamedReference) ?: return this - val resolvedSymbol = (calleeReference.resolvedSymbol as? FirNamedFunctionSymbol) ?: return this + private fun FirFunctionCall.replaceCalleeReferenceWithOverridden(resolvedSymbol: FirNamedFunctionSymbol): FirFunctionCall { val overriddenSymbol = resolvedSymbol.overriddenSymbol ?: return this if (resolvedSymbol.callableId.isInvoke() || resolvedSymbol.callableId.isIteratorNext()) { return copy( @@ -1090,7 +1109,7 @@ class Fir2IrVisitor( } } - private fun FirBlock.convertToIrExpressionOrBlock(): IrExpression { + private fun FirBlock.convertToIrExpressionOrBlock(origin: IrStatementOrigin? = null): IrExpression { if (statements.size == 1) { val firStatement = statements.single() if (firStatement is FirExpression) { @@ -1101,7 +1120,7 @@ class Fir2IrVisitor( (statements.lastOrNull() as? FirExpression)?.typeRef?.toIrType(this@Fir2IrVisitor.session, declarationStorage) ?: unitType return convertWithOffsets { startOffset, endOffset -> IrBlockImpl( - startOffset, endOffset, type, null, + startOffset, endOffset, type, origin, statements.mapNotNull { it.toIrStatement() } ) } @@ -1204,15 +1223,13 @@ class Fir2IrVisitor( override fun visitWhileLoop(whileLoop: FirWhileLoop, data: Any?): IrElement { return whileLoop.convertWithOffsets { startOffset, endOffset -> - IrWhileLoopImpl( - startOffset, endOffset, unitType, - if (whileLoop.psi is KtForExpression) IrStatementOrigin.FOR_LOOP_INNER_WHILE - else IrStatementOrigin.WHILE_LOOP - ).apply { + val origin = if (whileLoop.psi is KtForExpression) IrStatementOrigin.FOR_LOOP_INNER_WHILE + else IrStatementOrigin.WHILE_LOOP + IrWhileLoopImpl(startOffset, endOffset, unitType, origin).apply { loopMap[whileLoop] = this label = whileLoop.label?.name condition = whileLoop.condition.toIrExpression() - body = whileLoop.block.convertToIrExpressionOrBlock() + body = whileLoop.block.convertToIrExpressionOrBlock(origin) loopMap.remove(whileLoop) } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt index e9b0a438789..8ce06ec6c4e 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt @@ -483,4 +483,12 @@ fun CallableId.isKFunctionInvoke() = && packageName.asString() == "kotlin.reflect" fun CallableId.isIteratorNext() = - callableName.asString() == "next" && className?.asString()?.equals("Iterator") == true && packageName.asString() == "kotlin.collections" + callableName.asString() == "next" && className?.asString()?.endsWith("Iterator") == true + && packageName.asString() == "kotlin.collections" + +fun CallableId.isIteratorHasNext() = + callableName.asString() == "hasNext" && className?.asString()?.endsWith("Iterator") == true + && packageName.asString() == "kotlin.collections" + +fun CallableId.isIterator() = + callableName.asString() == "iterator" && packageName.asString() == "kotlin.collections" diff --git a/compiler/testData/ir/irText/expressions/badBreakContinue.fir.txt b/compiler/testData/ir/irText/expressions/badBreakContinue.fir.txt index 4861247b5ec..6646171c5e2 100644 --- a/compiler/testData/ir/irText/expressions/badBreakContinue.fir.txt +++ b/compiler/testData/ir/irText/expressions/badBreakContinue.fir.txt @@ -7,14 +7,14 @@ FILE fqName: fileName:/badBreakContinue.kt BLOCK_BODY WHILE label=L1 origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true - body: BLOCK type=kotlin.Nothing origin=null + body: BLOCK type=kotlin.Nothing origin=WHILE_LOOP ERROR_EXPR 'Unbound loop: break@@@[ERROR_EXPR(Cannot bind label ERROR to a loop)] ' type=kotlin.Nothing ERROR_EXPR 'Unbound loop: continue@@@[ERROR_EXPR(Cannot bind label ERROR to a loop)] ' type=kotlin.Nothing FUN name:test3 visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY WHILE label=L1 origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true - body: BLOCK type=kotlin.Unit origin=null + body: BLOCK type=kotlin.Unit origin=WHILE_LOOP VAR name:lambda type:kotlin.Function0 [val] FUN_EXPR type=kotlin.Function0 origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Nothing @@ -25,7 +25,7 @@ FILE fqName: fileName:/badBreakContinue.kt BLOCK_BODY WHILE label=null origin=WHILE_LOOP condition: ERROR_EXPR 'Unbound loop: break@@@[ERROR_EXPR(Cannot bind unlabeled jump to a loop)] ' type=kotlin.Nothing - body: BLOCK type=kotlin.Unit origin=null + body: BLOCK type=kotlin.Unit origin=WHILE_LOOP WHILE label=null origin=WHILE_LOOP condition: ERROR_EXPR 'Unbound loop: continue@@@[ERROR_EXPR(Cannot bind unlabeled jump to a loop)] ' type=kotlin.Nothing - body: BLOCK type=kotlin.Unit origin=null + body: BLOCK type=kotlin.Unit origin=WHILE_LOOP diff --git a/compiler/testData/ir/irText/expressions/breakContinue.fir.txt b/compiler/testData/ir/irText/expressions/breakContinue.fir.txt index dfd2a27515b..52bbb3be4fe 100644 --- a/compiler/testData/ir/irText/expressions/breakContinue.fir.txt +++ b/compiler/testData/ir/irText/expressions/breakContinue.fir.txt @@ -17,19 +17,19 @@ FILE fqName: fileName:/breakContinue.kt BLOCK_BODY WHILE label=OUTER origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true - body: BLOCK type=kotlin.Nothing origin=null + body: BLOCK type=kotlin.Nothing origin=WHILE_LOOP WHILE label=INNER origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true - body: BLOCK type=kotlin.Nothing origin=null + body: BLOCK type=kotlin.Nothing origin=WHILE_LOOP BREAK label=INNER loop.label=INNER BREAK label=OUTER loop.label=OUTER BREAK label=OUTER loop.label=OUTER WHILE label=OUTER origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true - body: BLOCK type=kotlin.Nothing origin=null + body: BLOCK type=kotlin.Nothing origin=WHILE_LOOP WHILE label=INNER origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true - body: BLOCK type=kotlin.Nothing origin=null + body: BLOCK type=kotlin.Nothing origin=WHILE_LOOP CONTINUE label=INNER loop.label=INNER CONTINUE label=OUTER loop.label=OUTER CONTINUE label=OUTER loop.label=OUTER @@ -37,14 +37,14 @@ FILE fqName: fileName:/breakContinue.kt BLOCK_BODY WHILE label=L origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true - body: BLOCK type=kotlin.Nothing origin=null + body: BLOCK type=kotlin.Nothing origin=WHILE_LOOP WHILE label=L origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true body: BREAK label=L loop.label=L BREAK label=L loop.label=L WHILE label=L origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true - body: BLOCK type=kotlin.Nothing origin=null + body: BLOCK type=kotlin.Nothing origin=WHILE_LOOP WHILE label=L origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true body: CONTINUE label=L loop.label=L diff --git a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt index 5c7459bbe9f..ae02a836b6f 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt @@ -4,7 +4,7 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt BLOCK_BODY WHILE label=L origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true - body: BLOCK type=kotlin.Unit origin=null + body: BLOCK type=kotlin.Unit origin=WHILE_LOOP WHILE label=L2 origin=WHILE_LOOP condition: BLOCK type=kotlin.Boolean origin=ELVIS VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Boolean? [val] @@ -19,13 +19,13 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt if: CONST Boolean type=kotlin.Boolean value=true then: TYPE_OP type=kotlin.Boolean origin=IMPLICIT_CAST typeOperand=kotlin.Boolean GET_VAR 'val tmp_0: kotlin.Boolean? [val] declared in .test1' type=kotlin.Boolean? origin=null - body: BLOCK type=kotlin.Unit origin=null + body: BLOCK type=kotlin.Unit origin=WHILE_LOOP FUN name:test2 visibility:public modality:FINAL <> (c:kotlin.Boolean?) returnType:kotlin.Unit VALUE_PARAMETER name:c index:0 type:kotlin.Boolean? BLOCK_BODY WHILE label=L origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true - body: BLOCK type=kotlin.Unit origin=null + body: BLOCK type=kotlin.Unit origin=WHILE_LOOP WHILE label=L2 origin=WHILE_LOOP condition: BLOCK type=kotlin.Boolean origin=ELVIS VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Boolean? [val] @@ -40,15 +40,15 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt if: CONST Boolean type=kotlin.Boolean value=true then: TYPE_OP type=kotlin.Boolean origin=IMPLICIT_CAST typeOperand=kotlin.Boolean GET_VAR 'val tmp_1: kotlin.Boolean? [val] declared in .test2' type=kotlin.Boolean? origin=null - body: BLOCK type=kotlin.Unit origin=null + body: BLOCK type=kotlin.Unit origin=WHILE_LOOP FUN name:test3 visibility:public modality:FINAL <> (ss:kotlin.collections.List?) returnType:kotlin.Unit VALUE_PARAMETER name:ss index:0 type:kotlin.collections.List? BLOCK_BODY WHILE label=L origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true - body: BLOCK type=kotlin.Unit origin=null - VAR IR_TEMPORARY_VARIABLE 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=null + body: BLOCK type=kotlin.Unit origin=WHILE_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: BLOCK type=kotlin.collections.List origin=ELVIS VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.collections.List? [val] GET_VAR 'ss: kotlin.collections.List? declared in .test3' type=kotlin.collections.List? origin=null @@ -63,20 +63,20 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt then: TYPE_OP type=kotlin.collections.List origin=IMPLICIT_CAST typeOperand=kotlin.collections.List GET_VAR 'val tmp_3: kotlin.collections.List? [val] declared in .test3' type=kotlin.collections.List? origin=null WHILE label=L2 origin=FOR_LOOP_INNER_WHILE - condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=null + 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 .test3' type=kotlin.collections.Iterator origin=null - body: BLOCK type=kotlin.Unit origin=null - VAR 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=null + 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_2: kotlin.collections.Iterator [val] declared in .test3' type=kotlin.collections.Iterator origin=null FUN name:test4 visibility:public modality:FINAL <> (ss:kotlin.collections.List?) returnType:kotlin.Unit VALUE_PARAMETER name:ss index:0 type:kotlin.collections.List? BLOCK_BODY WHILE label=L origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true - body: BLOCK type=kotlin.Unit origin=null - VAR IR_TEMPORARY_VARIABLE name:tmp_4 type:kotlin.collections.Iterator [val] - CALL 'public abstract fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.collections.List' type=kotlin.collections.Iterator origin=null + body: BLOCK type=kotlin.Unit origin=WHILE_LOOP + VAR FOR_LOOP_ITERATOR name:tmp_4 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: BLOCK type=kotlin.collections.List origin=ELVIS VAR IR_TEMPORARY_VARIABLE name:tmp_5 type:kotlin.collections.List? [val] GET_VAR 'ss: kotlin.collections.List? declared in .test4' type=kotlin.collections.List? origin=null @@ -91,11 +91,11 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt then: TYPE_OP type=kotlin.collections.List origin=IMPLICIT_CAST typeOperand=kotlin.collections.List GET_VAR 'val tmp_5: kotlin.collections.List? [val] declared in .test4' type=kotlin.collections.List? origin=null WHILE label=L2 origin=FOR_LOOP_INNER_WHILE - condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=null + 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 .test4' type=kotlin.collections.Iterator origin=null - body: BLOCK type=kotlin.Unit origin=null - VAR 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=null + 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_4: kotlin.collections.Iterator [val] declared in .test4' type=kotlin.collections.Iterator origin=null FUN name:test5 visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY @@ -103,7 +103,7 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt CONST Int type=kotlin.Int value=0 WHILE label=Outer origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true - body: BLOCK type=kotlin.Unit origin=null + body: BLOCK type=kotlin.Unit origin=WHILE_LOOP VAR IR_TEMPORARY_VARIABLE name:tmp_6 type:kotlin.Int [val] GET_VAR 'var i: kotlin.Int [var] declared in .test5' type=kotlin.Int origin=null SET_VAR 'var i: kotlin.Int [var] declared in .test5' type=kotlin.Unit origin=null diff --git a/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.txt b/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.txt index efc823eb4b2..3f64cf210c9 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.txt @@ -12,15 +12,15 @@ FILE fqName: fileName:/breakContinueInWhen.kt GET_VAR 'i: kotlin.Int declared in .testBreakFor.' type=kotlin.Int origin=null VAR name:k type:kotlin.Int [var] CONST Int type=kotlin.Int value=0 - VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.collections.IntIterator [val] + VAR FOR_LOOP_ITERATOR name:tmp_0 type:kotlin.collections.IntIterator [val] CALL 'public final fun iterator (): kotlin.collections.IntIterator [operator] declared in kotlin.IntArray' type=kotlin.collections.IntIterator origin=null $this: GET_VAR 'val xs: kotlin.IntArray [val] declared in .testBreakFor' type=kotlin.IntArray 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=null + 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.IntIterator [val] declared in .testBreakFor' type=kotlin.collections.IntIterator origin=null - body: BLOCK type=kotlin.Unit origin=null - VAR name:x type:kotlin.Int [val] - CALL 'public final fun next (): kotlin.Int [operator] declared in kotlin.collections.IntIterator' type=kotlin.Int origin=null + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE + VAR FOR_LOOP_VARIABLE name:x 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 .testBreakFor' type=kotlin.collections.IntIterator origin=null WHEN type=kotlin.Unit origin=WHEN BRANCH @@ -69,15 +69,15 @@ FILE fqName: fileName:/breakContinueInWhen.kt GET_VAR 'i: kotlin.Int declared in .testContinueFor.' type=kotlin.Int origin=null VAR name:k type:kotlin.Int [var] CONST Int type=kotlin.Int value=0 - VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.collections.IntIterator [val] + VAR FOR_LOOP_ITERATOR name:tmp_1 type:kotlin.collections.IntIterator [val] CALL 'public final fun iterator (): kotlin.collections.IntIterator [operator] declared in kotlin.IntArray' type=kotlin.collections.IntIterator origin=null $this: GET_VAR 'val xs: kotlin.IntArray [val] declared in .testContinueFor' type=kotlin.IntArray 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=null + 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 .testContinueFor' type=kotlin.collections.IntIterator origin=null - body: BLOCK type=kotlin.Unit origin=null - VAR name:x type:kotlin.Int [val] - CALL 'public final fun next (): kotlin.Int [operator] declared in kotlin.collections.IntIterator' type=kotlin.Int origin=null + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE + VAR FOR_LOOP_VARIABLE name:x 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 .testContinueFor' type=kotlin.collections.IntIterator origin=null WHEN type=kotlin.Unit origin=WHEN BRANCH diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.fir.txt b/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.fir.txt index c7f311e91fa..a3fff390b7f 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.fir.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.fir.txt @@ -4,15 +4,15 @@ FILE fqName: fileName:/withVarargViewedAsArray.kt BLOCK_BODY VAR name:result type:kotlin.Int [var] CONST Int type=kotlin.Int value=0 - VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.collections.IntIterator [val] + VAR FOR_LOOP_ITERATOR name:tmp_0 type:kotlin.collections.IntIterator [val] CALL 'public final fun iterator (): kotlin.collections.IntIterator [operator] declared in kotlin.IntArray' type=kotlin.collections.IntIterator origin=null $this: GET_VAR 'args: kotlin.IntArray [vararg] declared in .sum' type=kotlin.IntArray 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=null + 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.IntIterator [val] declared in .sum' type=kotlin.collections.IntIterator origin=null - body: BLOCK type=kotlin.Unit origin=null - VAR name:arg type:kotlin.Int [val] - CALL 'public final fun next (): kotlin.Int [operator] declared in kotlin.collections.IntIterator' type=kotlin.Int origin=null + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE + 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=null CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/for.fir.txt b/compiler/testData/ir/irText/expressions/for.fir.txt index 4a4836f4a72..a091c3c19fb 100644 --- a/compiler/testData/ir/irText/expressions/for.fir.txt +++ b/compiler/testData/ir/irText/expressions/for.fir.txt @@ -2,65 +2,65 @@ FILE fqName: fileName:/for.kt FUN name:testEmpty visibility:public modality:FINAL <> (ss:kotlin.collections.List) returnType:kotlin.Unit VALUE_PARAMETER name:ss index:0 type:kotlin.collections.List BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.collections.Iterator [val] - CALL 'public abstract fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.collections.List' type=kotlin.collections.Iterator origin=null + VAR FOR_LOOP_ITERATOR name:tmp_0 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 .testEmpty' type=kotlin.collections.List 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=null + 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 .testEmpty' type=kotlin.collections.Iterator origin=null - body: BLOCK type=kotlin.Unit origin=null - VAR 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=null + 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 .testEmpty' type=kotlin.collections.Iterator origin=null FUN name:testIterable visibility:public modality:FINAL <> (ss:kotlin.collections.List) returnType:kotlin.Unit VALUE_PARAMETER name:ss index:0 type:kotlin.collections.List BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.collections.Iterator [val] - CALL 'public abstract fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.collections.List' type=kotlin.collections.Iterator origin=null + VAR FOR_LOOP_ITERATOR name:tmp_1 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 .testIterable' type=kotlin.collections.List 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=null + 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 .testIterable' type=kotlin.collections.Iterator origin=null - body: BLOCK type=kotlin.Unit origin=null - VAR 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=null + 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_1: kotlin.collections.Iterator [val] declared in .testIterable' type=kotlin.collections.Iterator origin=null CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit [inline] declared in kotlin.io' type=kotlin.Unit origin=null message: GET_VAR 'val s: kotlin.String [val] declared in .testIterable' type=kotlin.String origin=null FUN name:testDestructuring visibility:public modality:FINAL <> (pp:kotlin.collections.List>) returnType:kotlin.Unit VALUE_PARAMETER name:pp index:0 type:kotlin.collections.List> BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE 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=null + 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 'pp: kotlin.collections.List> declared in .testDestructuring' type=kotlin.collections.List> 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=null + 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 .testDestructuring' type=kotlin.collections.Iterator> origin=null - body: BLOCK type=kotlin.Unit origin=null - VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.Pair [val] - CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=kotlin.Pair origin=null + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE + 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 (): kotlin.Int [operator] declared in kotlin.Pair' type=kotlin.Int origin=null - $this: GET_VAR 'val tmp_3: kotlin.Pair [val] declared in .testDestructuring' type=kotlin.Pair 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 (): kotlin.String [operator] declared in kotlin.Pair' type=kotlin.String origin=null - $this: GET_VAR 'val tmp_3: kotlin.Pair [val] declared in .testDestructuring' type=kotlin.Pair 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' 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' 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 - VAR IR_TEMPORARY_VARIABLE name:tmp_4 type:kotlin.collections.IntIterator [val] + VAR FOR_LOOP_ITERATOR name:tmp_3 type:kotlin.collections.IntIterator [val] CALL 'public open fun iterator (): kotlin.collections.IntIterator [operator] declared in kotlin.ranges.IntProgression' type=kotlin.collections.IntIterator origin=null $this: CALL 'public final fun rangeTo (other: kotlin.Int): kotlin.ranges.IntRange [operator] declared in kotlin.Int' type=kotlin.ranges.IntRange origin=null $this: CONST Int type=kotlin.Int value=1 other: CONST Int type=kotlin.Int value=10 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=null - $this: GET_VAR 'val tmp_4: kotlin.collections.IntIterator [val] declared in .testRange' type=kotlin.collections.IntIterator origin=null - body: BLOCK type=kotlin.Unit origin=null - VAR name:i type:kotlin.Int [val] - CALL 'public final fun next (): kotlin.Int [operator] declared in kotlin.collections.IntIterator' type=kotlin.Int origin=null - $this: GET_VAR 'val tmp_4: kotlin.collections.IntIterator [val] declared in .testRange' type=kotlin.collections.IntIterator origin=null + 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.IntIterator [val] declared in .testRange' 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_3: kotlin.collections.IntIterator [val] declared in .testRange' type=kotlin.collections.IntIterator origin=null diff --git a/compiler/testData/ir/irText/expressions/forWithBreakContinue.fir.txt b/compiler/testData/ir/irText/expressions/forWithBreakContinue.fir.txt index 581900ed60e..4ae10d31bdb 100644 --- a/compiler/testData/ir/irText/expressions/forWithBreakContinue.fir.txt +++ b/compiler/testData/ir/irText/expressions/forWithBreakContinue.fir.txt @@ -2,39 +2,39 @@ FILE fqName: fileName:/forWithBreakContinue.kt FUN name:testForBreak1 visibility:public modality:FINAL <> (ss:kotlin.collections.List) returnType:kotlin.Unit VALUE_PARAMETER name:ss index:0 type:kotlin.collections.List BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.collections.Iterator [val] - CALL 'public abstract fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.collections.List' type=kotlin.collections.Iterator origin=null + VAR FOR_LOOP_ITERATOR name:tmp_0 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 .testForBreak1' type=kotlin.collections.List 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=null + 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=null - VAR 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=null + body: BLOCK type=kotlin.Nothing 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 BREAK label=null loop.label=null FUN name:testForBreak2 visibility:public modality:FINAL <> (ss:kotlin.collections.List) returnType:kotlin.Unit VALUE_PARAMETER name:ss index:0 type:kotlin.collections.List BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.collections.Iterator [val] - CALL 'public abstract fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.collections.List' type=kotlin.collections.Iterator origin=null + VAR FOR_LOOP_ITERATOR name:tmp_1 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=OUTER origin=FOR_LOOP_INNER_WHILE - condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=null + 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=null - VAR 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=null + body: BLOCK type=kotlin.Nothing 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 - VAR IR_TEMPORARY_VARIABLE 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=null + 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=null + 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=null - VAR 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=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 @@ -43,39 +43,39 @@ FILE fqName: fileName:/forWithBreakContinue.kt 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 - VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.collections.Iterator [val] - CALL 'public abstract fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.collections.List' type=kotlin.collections.Iterator origin=null + VAR FOR_LOOP_ITERATOR name:tmp_3 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 .testForContinue1' type=kotlin.collections.List 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=null + 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=null - VAR 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=null + body: BLOCK type=kotlin.Nothing 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 CONTINUE label=null loop.label=null FUN name:testForContinue2 visibility:public modality:FINAL <> (ss:kotlin.collections.List) returnType:kotlin.Unit VALUE_PARAMETER name:ss index:0 type:kotlin.collections.List BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_4 type:kotlin.collections.Iterator [val] - CALL 'public abstract fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.collections.List' type=kotlin.collections.Iterator origin=null + VAR FOR_LOOP_ITERATOR name:tmp_4 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=OUTER origin=FOR_LOOP_INNER_WHILE - condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=null + 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=null - VAR 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=null + body: BLOCK type=kotlin.Nothing 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 - VAR IR_TEMPORARY_VARIABLE 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=null + 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=null + 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=null - VAR 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=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 diff --git a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.fir.txt b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.fir.txt index 9eb3400bc04..972850c5c84 100644 --- a/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.fir.txt +++ b/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.fir.txt @@ -105,13 +105,13 @@ FILE fqName: fileName:/forWithImplicitReceivers.kt FUN name:test visibility:public modality:FINAL <> ($receiver:.IReceiver) returnType:kotlin.Unit $receiver: VALUE_PARAMETER name: type:.IReceiver BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:.IntCell [val] + VAR FOR_LOOP_ITERATOR name:tmp_1 type:.IntCell [val] CALL 'public open fun iterator (): .IntCell [operator] declared in .IReceiver' type=.IntCell origin=null $this: GET_VAR ': .IReceiver declared in .test' type=.IReceiver origin=null WHILE label=null origin=FOR_LOOP_INNER_WHILE condition: CALL 'public open fun hasNext (): kotlin.Boolean [operator] declared in .IReceiver' type=kotlin.Boolean origin=null $this: GET_VAR ': .IReceiver declared in .test' type=.IReceiver origin=null - body: BLOCK type=kotlin.Unit origin=null + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE VAR name:i type:kotlin.Int [val] CALL 'public open fun next (): kotlin.Int [operator] declared in .IReceiver' type=kotlin.Int origin=null $this: GET_VAR ': .IReceiver declared in .test' type=.IReceiver origin=null diff --git a/compiler/testData/ir/irText/expressions/whileDoWhile.fir.txt b/compiler/testData/ir/irText/expressions/whileDoWhile.fir.txt index 3079a7b4312..27c9df623cd 100644 --- a/compiler/testData/ir/irText/expressions/whileDoWhile.fir.txt +++ b/compiler/testData/ir/irText/expressions/whileDoWhile.fir.txt @@ -7,7 +7,7 @@ FILE fqName: fileName:/whileDoWhile.kt condition: 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 'var x: kotlin.Int [var] declared in .test' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=0 - body: BLOCK type=kotlin.Unit origin=null + body: BLOCK type=kotlin.Unit origin=WHILE_LOOP WHILE label=null origin=WHILE_LOOP condition: 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 'var x: kotlin.Int [var] declared in .test' type=kotlin.Int origin=null @@ -23,7 +23,7 @@ FILE fqName: fileName:/whileDoWhile.kt condition: 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 'var x: kotlin.Int [var] declared in .test' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=10 - body: BLOCK type=kotlin.Int origin=null + body: BLOCK type=kotlin.Int origin=WHILE_LOOP VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val] GET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Int origin=null SET_VAR 'var x: kotlin.Int [var] declared in .test' type=kotlin.Unit origin=null @@ -69,7 +69,7 @@ FILE fqName: fileName:/whileDoWhile.kt WHILE label=null origin=WHILE_LOOP condition: TYPE_OP type=kotlin.Boolean origin=IMPLICIT_CAST typeOperand=kotlin.Boolean GET_VAR 'val a: kotlin.Any? [val] declared in .testSmartcastInCondition' type=kotlin.Any? origin=null - body: BLOCK type=kotlin.Unit origin=null + body: BLOCK type=kotlin.Unit origin=WHILE_LOOP DO_WHILE label=null origin=DO_WHILE_LOOP body: BLOCK type=kotlin.Unit origin=null condition: TYPE_OP type=kotlin.Boolean origin=IMPLICIT_CAST typeOperand=kotlin.Boolean diff --git a/compiler/testData/ir/irText/regressions/coercionInLoop.fir.txt b/compiler/testData/ir/irText/regressions/coercionInLoop.fir.txt index 7d02f6bb97b..07f4212b537 100644 --- a/compiler/testData/ir/irText/regressions/coercionInLoop.fir.txt +++ b/compiler/testData/ir/irText/regressions/coercionInLoop.fir.txt @@ -12,7 +12,7 @@ FILE fqName: fileName:/coercionInLoop.kt WHILE label=null origin=WHILE_LOOP condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=null $this: GET_VAR 'val x: kotlin.collections.DoubleIterator [val] declared in .box' type=kotlin.collections.DoubleIterator origin=null - body: BLOCK type=kotlin.Int origin=null + body: BLOCK type=kotlin.Int origin=WHILE_LOOP WHEN type=kotlin.Unit origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.txt index 199a540b8a6..a04beaea2a4 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.txt @@ -4,34 +4,34 @@ FILE fqName: fileName:/enhancedNullabilityInForLoop.kt BLOCK_BODY FUN name:testForInListUnused visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.collections.MutableIterator<.P> [val] - CALL 'public abstract fun iterator (): kotlin.collections.MutableIterator<.P> [operator] declared in kotlin.collections.MutableCollection' type=kotlin.collections.MutableIterator<.P> origin=null + VAR FOR_LOOP_ITERATOR name:tmp_0 type:kotlin.collections.MutableIterator<.P> [val] + CALL 'public abstract fun iterator (): kotlin.collections.MutableIterator<.P> [operator] declared in kotlin.collections.MutableCollection' type=kotlin.collections.MutableIterator<.P> origin=FOR_LOOP_ITERATOR $this: CALL 'public open fun listOfNotNull (): kotlin.collections.List<.P>? [operator] declared in .J' type=kotlin.collections.List<.P>? 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=null + 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.MutableIterator<.P> [val] declared in .testForInListUnused' type=kotlin.collections.MutableIterator<.P> origin=null - body: BLOCK type=kotlin.Unit origin=null - VAR name:x type:.P [val] - CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [operator] declared in kotlin.collections.Iterator' type=.P origin=null + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE + VAR FOR_LOOP_VARIABLE name:x type:.P [val] + CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [operator] declared in kotlin.collections.Iterator' type=.P origin=FOR_LOOP_NEXT $this: GET_VAR 'val tmp_0: kotlin.collections.MutableIterator<.P> [val] declared in .testForInListUnused' type=kotlin.collections.MutableIterator<.P> origin=null FUN name:testForInListDestructured visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.collections.MutableIterator<.P> [val] - CALL 'public abstract fun iterator (): kotlin.collections.MutableIterator<.P> [operator] declared in kotlin.collections.MutableCollection' type=kotlin.collections.MutableIterator<.P> origin=null + VAR FOR_LOOP_ITERATOR name:tmp_1 type:kotlin.collections.MutableIterator<.P> [val] + CALL 'public abstract fun iterator (): kotlin.collections.MutableIterator<.P> [operator] declared in kotlin.collections.MutableCollection' type=kotlin.collections.MutableIterator<.P> origin=FOR_LOOP_ITERATOR $this: CALL 'public open fun listOfNotNull (): kotlin.collections.List<.P>? [operator] declared in .J' type=kotlin.collections.List<.P>? 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=null + 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.MutableIterator<.P> [val] declared in .testForInListDestructured' type=kotlin.collections.MutableIterator<.P> origin=null - body: BLOCK type=kotlin.Unit origin=null - VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:.P [val] - CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [operator] declared in kotlin.collections.Iterator' type=.P origin=null + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE + VAR FOR_LOOP_VARIABLE name: type:.P [val] + CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [operator] declared in kotlin.collections.Iterator' type=.P origin=FOR_LOOP_NEXT $this: GET_VAR 'val tmp_1: kotlin.collections.MutableIterator<.P> [val] declared in .testForInListDestructured' type=kotlin.collections.MutableIterator<.P> origin=null VAR name:x type:kotlin.Int [val] CALL 'public final fun component1 (): kotlin.Int declared in .P' type=kotlin.Int origin=null - $this: GET_VAR 'val tmp_2: .P [val] declared in .testForInListDestructured' type=.P origin=null + $this: GET_VAR 'val : .P [val] declared in .testForInListDestructured' type=.P origin=null VAR name:y type:kotlin.Int [val] CALL 'public final fun component2 (): kotlin.Int declared in .P' type=kotlin.Int origin=null - $this: GET_VAR 'val tmp_2: .P [val] declared in .testForInListDestructured' type=.P origin=null + $this: GET_VAR 'val : .P [val] declared in .testForInListDestructured' type=.P origin=null FUN name:testDesugaredForInList visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY VAR name:iterator type:kotlin.collections.MutableIterator<.P> [val] @@ -40,36 +40,36 @@ FILE fqName: fileName:/enhancedNullabilityInForLoop.kt WHILE label=null origin=WHILE_LOOP condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=null $this: GET_VAR 'val iterator: kotlin.collections.MutableIterator<.P> [val] declared in .testDesugaredForInList' type=kotlin.collections.MutableIterator<.P> origin=null - body: BLOCK type=kotlin.Unit origin=null + body: BLOCK type=kotlin.Unit origin=WHILE_LOOP VAR name:x type:.P [val] CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [operator] declared in kotlin.collections.Iterator' type=.P origin=null $this: GET_VAR 'val iterator: kotlin.collections.MutableIterator<.P> [val] declared in .testDesugaredForInList' type=kotlin.collections.MutableIterator<.P> origin=null FUN name:testForInArrayUnused visibility:public modality:FINAL <> (j:.J) returnType:kotlin.Unit VALUE_PARAMETER name:j index:0 type:.J BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.collections.Iterator<.P?> [val] + VAR FOR_LOOP_ITERATOR name:tmp_2 type:kotlin.collections.Iterator<.P?> [val] CALL 'public final fun iterator (): kotlin.collections.Iterator<.P?> [operator] declared in kotlin.Array' type=kotlin.collections.Iterator<.P?> origin=null $this: CALL 'public open fun arrayOfNotNull (): kotlin.Array.P?>? [operator] declared in .J' type=kotlin.Array.P?>? origin=null $this: GET_VAR 'j: .J declared in .testForInArrayUnused' type=.J 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=null - $this: GET_VAR 'val tmp_3: kotlin.collections.Iterator<.P?> [val] declared in .testForInArrayUnused' type=kotlin.collections.Iterator<.P?> origin=null - body: BLOCK type=kotlin.Unit origin=null - VAR name:x type:.P? [val] - CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=.P? origin=null - $this: GET_VAR 'val tmp_3: kotlin.collections.Iterator<.P?> [val] declared in .testForInArrayUnused' type=kotlin.collections.Iterator<.P?> origin=null + 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<.P?> [val] declared in .testForInArrayUnused' type=kotlin.collections.Iterator<.P?> origin=null + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE + VAR FOR_LOOP_VARIABLE name:x type:.P? [val] + CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=.P? origin=FOR_LOOP_NEXT + $this: GET_VAR 'val tmp_2: kotlin.collections.Iterator<.P?> [val] declared in .testForInArrayUnused' type=kotlin.collections.Iterator<.P?> origin=null FUN name:testForInListUse visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_4 type:kotlin.collections.MutableIterator<.P> [val] - CALL 'public abstract fun iterator (): kotlin.collections.MutableIterator<.P> [operator] declared in kotlin.collections.MutableCollection' type=kotlin.collections.MutableIterator<.P> origin=null + VAR FOR_LOOP_ITERATOR name:tmp_3 type:kotlin.collections.MutableIterator<.P> [val] + CALL 'public abstract fun iterator (): kotlin.collections.MutableIterator<.P> [operator] declared in kotlin.collections.MutableCollection' type=kotlin.collections.MutableIterator<.P> origin=FOR_LOOP_ITERATOR $this: CALL 'public open fun listOfNotNull (): kotlin.collections.List<.P>? [operator] declared in .J' type=kotlin.collections.List<.P>? 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=null - $this: GET_VAR 'val tmp_4: kotlin.collections.MutableIterator<.P> [val] declared in .testForInListUse' type=kotlin.collections.MutableIterator<.P> origin=null - body: BLOCK type=kotlin.Unit origin=null - VAR name:x type:.P [val] - CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [operator] declared in kotlin.collections.Iterator' type=.P origin=null - $this: GET_VAR 'val tmp_4: kotlin.collections.MutableIterator<.P> [val] declared in .testForInListUse' type=kotlin.collections.MutableIterator<.P> origin=null + 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.MutableIterator<.P> [val] declared in .testForInListUse' type=kotlin.collections.MutableIterator<.P> origin=null + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE + VAR FOR_LOOP_VARIABLE name:x type:.P [val] + CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [operator] declared in kotlin.collections.Iterator' type=.P origin=FOR_LOOP_NEXT + $this: GET_VAR 'val tmp_3: kotlin.collections.MutableIterator<.P> [val] declared in .testForInListUse' type=kotlin.collections.MutableIterator<.P> origin=null CALL 'public final fun use (s: .P): kotlin.Unit declared in ' type=kotlin.Unit origin=null s: GET_VAR 'val x: .P [val] declared in .testForInListUse' type=.P origin=null CALL 'public open fun use (s: .P): kotlin.Unit [operator] declared in .J' type=kotlin.Unit origin=null @@ -77,17 +77,17 @@ FILE fqName: fileName:/enhancedNullabilityInForLoop.kt FUN name:testForInArrayUse visibility:public modality:FINAL <> (j:.J) returnType:kotlin.Unit VALUE_PARAMETER name:j index:0 type:.J BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_5 type:kotlin.collections.Iterator<.P?> [val] + VAR FOR_LOOP_ITERATOR name:tmp_4 type:kotlin.collections.Iterator<.P?> [val] CALL 'public final fun iterator (): kotlin.collections.Iterator<.P?> [operator] declared in kotlin.Array' type=kotlin.collections.Iterator<.P?> origin=null $this: CALL 'public open fun arrayOfNotNull (): kotlin.Array.P?>? [operator] declared in .J' type=kotlin.Array.P?>? origin=null $this: GET_VAR 'j: .J declared in .testForInArrayUse' type=.J 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=null - $this: GET_VAR 'val tmp_5: kotlin.collections.Iterator<.P?> [val] declared in .testForInArrayUse' type=kotlin.collections.Iterator<.P?> origin=null - body: BLOCK type=kotlin.Unit origin=null - VAR name:x type:.P? [val] - CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=.P? origin=null - $this: GET_VAR 'val tmp_5: kotlin.collections.Iterator<.P?> [val] declared in .testForInArrayUse' type=kotlin.collections.Iterator<.P?> origin=null + 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<.P?> [val] declared in .testForInArrayUse' type=kotlin.collections.Iterator<.P?> origin=null + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE + VAR FOR_LOOP_VARIABLE name:x type:.P? [val] + CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=.P? origin=FOR_LOOP_NEXT + $this: GET_VAR 'val tmp_4: kotlin.collections.Iterator<.P?> [val] declared in .testForInArrayUse' type=kotlin.collections.Iterator<.P?> origin=null CALL 'public final fun use (s: .P): kotlin.Unit declared in ' type=kotlin.Unit origin=null s: GET_VAR 'val x: .P? [val] declared in .testForInArrayUse' type=.P? origin=null CALL 'public open fun use (s: .P): kotlin.Unit [operator] declared in .J' type=kotlin.Unit origin=null