diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt index cdfe7d65cfa..590213d9a9a 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt @@ -466,6 +466,8 @@ internal fun FirReference.statementOrigin(): IrStatementOrigin? { IrStatementOrigin.FOR_LOOP_ITERATOR source?.elementType == KtNodeTypes.OPERATION_REFERENCE -> nameToOperationConventionOrigin[symbol.callableId.callableName] + source?.kind is FirFakeSourceElementKind.DesugaredComponentFunctionCall -> + IrStatementOrigin.COMPONENT_N.withIndex(name.asString().removePrefix("component").toInt()) else -> null } 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 a102e982db7..939b115b0ea 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 @@ -20,6 +20,7 @@ import org.jetbrains.kotlin.fir.declarations.utils.* import org.jetbrains.kotlin.fir.descriptors.FirBuiltInsPackageFragment import org.jetbrains.kotlin.fir.descriptors.FirModuleDescriptor import org.jetbrains.kotlin.fir.descriptors.FirPackageFragmentDescriptor +import org.jetbrains.kotlin.fir.expressions.FirComponentCall import org.jetbrains.kotlin.fir.expressions.FirConstExpression import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccess @@ -986,7 +987,7 @@ class Fir2IrDeclarationStorage( irParent: IrDeclarationParent, givenOrigin: IrDeclarationOrigin? = null ): IrVariable = convertCatching(variable) { - val type = variable.returnTypeRef.toIrType() + val type = ((variable.initializer as? FirComponentCall)?.typeRef ?: variable.returnTypeRef).toIrType() // Some temporary variables are produced in RawFirBuilder, but we consistently use special names for them. val origin = when { givenOrigin != null -> givenOrigin 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 1f2229b4a1c..a044dce0781 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 @@ -275,7 +275,16 @@ class Fir2IrVisitor( initializer.resolvedNamedFunctionSymbol()?.callableId?.isIteratorNext() == true && variable.source.psi?.parent is KtForExpression val irVariable = declarationStorage.createIrVariable( - variable, conversionScope.parentFromStack(), if (isNextVariable) IrDeclarationOrigin.FOR_LOOP_VARIABLE else null + variable, conversionScope.parentFromStack(), + if (isNextVariable) { + if (variable.name.isSpecial && variable.name == SpecialNames.DESTRUCT) { + IrDeclarationOrigin.IR_TEMPORARY_VARIABLE + } else { + IrDeclarationOrigin.FOR_LOOP_VARIABLE + } + } else { + null + } ) if (initializer != null) { irVariable.initializer = @@ -817,14 +826,27 @@ class Fir2IrVisitor( */ firLoopBody.convertWithOffsets { innerStartOffset, innerEndOffset -> val loopBodyStatements = firLoopBody.statements - val firstStatement = loopBodyStatements.first().toIrStatement() - ?: error("Unexpected shape of body of for loop") + if (loopBodyStatements.isEmpty()) { + error("Unexpected shape of body of for loop") + } + val loopVariables = mutableListOf() + var loopVariableIndex = 0 + for (loopBodyStatement in loopBodyStatements) { + if (loopVariableIndex > 0) { + if (loopBodyStatement !is FirProperty || loopBodyStatement.initializer !is FirComponentCall) { + break + } + } + loopBodyStatement.toIrStatement()?.let { loopVariables.add(it) } + loopVariableIndex++ + } + IrBlockImpl( innerStartOffset, innerEndOffset, irBuiltIns.unitType, origin, - listOf(firstStatement) + loopBodyStatements.drop(1).convertToIrExpressionOrBlock(firLoopBody.source) + loopVariables + loopBodyStatements.drop(loopVariableIndex).convertToIrExpressionOrBlock(firLoopBody.source) ) } } else { diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoElementVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoElementVar.kt index f140ecd92f5..7c2619062fe 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoElementVar.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoElementVar.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoIndexVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoIndexVar.kt index 1d91c2aa375..3bcbe24ee3a 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoIndexVar.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoIndexVar.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInEmptyArrayWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInEmptyArrayWithIndex.kt index 91c51a2eb24..49b5a96d296 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInEmptyArrayWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInEmptyArrayWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInIntArrayWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInIntArrayWithIndex.kt index 695f993240b..8b54b0a5b38 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInIntArrayWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInIntArrayWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInObjectArrayWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInObjectArrayWithIndex.kt index 28d1226777e..64f21763c62 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInObjectArrayWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInObjectArrayWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInCharSequenceWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInCharSequenceWithIndex.kt index a2271b5f593..0751c62562c 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInCharSequenceWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInCharSequenceWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInEmptyStringWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInEmptyStringWithIndex.kt index fbac7c4979b..81292cc73c3 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInEmptyStringWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInEmptyStringWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndex.kt index 0a42b93ec21..7c9f29c7f11 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoElementVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoElementVar.kt index 672578f9453..9d8e0c20276 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoElementVar.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoElementVar.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoIndexVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoIndexVar.kt index ce551be73d3..5cba3d407f1 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoIndexVar.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoIndexVar.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexWithExplicitlyTypedIndexVariable.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexWithExplicitlyTypedIndexVariable.kt index 087edffe952..59ace54c912 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexWithExplicitlyTypedIndexVariable.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexWithExplicitlyTypedIndexVariable.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInEmptyListWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInEmptyListWithIndex.kt index dcd5cbceec0..272a3c1a2b4 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInEmptyListWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInEmptyListWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInIterableTypeParameterWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInIterableTypeParameterWithIndex.kt index 084b7b386e0..391705d9f55 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInIterableTypeParameterWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInIterableTypeParameterWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndex.kt index 40fd587bcbb..bde4246403b 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoElementVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoElementVar.kt index a47fbf8c185..a386519ad1d 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoElementVar.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoElementVar.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoIndexVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoIndexVar.kt index 5ad138cce4f..b7e189d387e 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoIndexVar.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoIndexVar.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexWithExplicitlyTypedIndexVariable.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexWithExplicitlyTypedIndexVariable.kt index f800b6d5436..72fd4e570d3 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexWithExplicitlyTypedIndexVariable.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexWithExplicitlyTypedIndexVariable.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInDownToWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInDownToWithIndex.kt index 7fb258e0290..17ebbb33da3 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInDownToWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInDownToWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInIndicesWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInIndicesWithIndex.kt index b6347ea68aa..283d3d738c6 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInIndicesWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInIndicesWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInRangeToWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInRangeToWithIndex.kt index 7b252865b27..c74f87da23f 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInRangeToWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInRangeToWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedStepWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedStepWithIndex.kt index f472c68875c..4054de5bb07 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedStepWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedStepWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedWithIndex.kt index 03cdc230f7c..791f897cb5a 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepReversedWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepReversedWithIndex.kt index 602b91dc9ac..2f2051f0aa3 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepReversedWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepReversedWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepWithIndex.kt index e16f847a6fd..e169eca2c4c 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInUntilWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInUntilWithIndex.kt index 5dd632425ce..967133cf17e 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInUntilWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInUntilWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexNoIndexOrElementVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexNoIndexOrElementVar.kt index 37b1492118e..8c5fe228712 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexNoIndexOrElementVar.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexNoIndexOrElementVar.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexWithIndex.kt index deff5d27948..ea6fd0a0121 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInEmptySequenceWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInEmptySequenceWithIndex.kt index 77b7e2091bc..11d31b5e7d9 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInEmptySequenceWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInEmptySequenceWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceTypeParameterWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceTypeParameterWithIndex.kt index 38fbb23a4fe..2e8ee033af3 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceTypeParameterWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceTypeParameterWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndex.kt index 184f9008fef..8300e86e141 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndex.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoElementVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoElementVar.kt index d37a64308a6..84bc382278d 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoElementVar.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoElementVar.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoIndexVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoIndexVar.kt index f449ebaeacc..bfaedd81057 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoIndexVar.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoIndexVar.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexThrowsCME.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexThrowsCME.kt index 90431bda4c4..65ae207ae52 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexThrowsCME.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexThrowsCME.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // FULL_JDK // IMPORTANT! diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexWithExplicitlyTypedIndexVariable.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexWithExplicitlyTypedIndexVariable.kt index 3020c0d6074..17985e6e5ea 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexWithExplicitlyTypedIndexVariable.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexWithExplicitlyTypedIndexVariable.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUnsignedArrayWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUnsignedArrayWithIndex.kt index 26efca20b56..6bdf164f96c 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUnsignedArrayWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUnsignedArrayWithIndex.kt @@ -1,5 +1,4 @@ // WITH_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, diff --git a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.ir.txt b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.ir.txt index c2d5e03e8ea..1ea8b40ef6e 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.ir.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.ir.txt @@ -67,6 +67,7 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt 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 + BLOCK type=kotlin.Unit 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 @@ -95,6 +96,7 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt 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 + BLOCK type=kotlin.Unit origin=null FUN name:test5 visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY VAR name:i type:kotlin.Int [var] diff --git a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.kt.txt b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.kt.txt index ba5302e1e1f..b885405db64 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.kt.txt @@ -36,6 +36,8 @@ fun test3(ss: List?) { }.iterator() L2@ while (.hasNext()) { // BLOCK val s: String = .next() + { // BLOCK + } } } } @@ -53,6 +55,8 @@ fun test4(ss: List?) { }.iterator() L2@ while (.hasNext()) { // BLOCK val s: String = .next() + { // BLOCK + } } } } @@ -78,3 +82,4 @@ fun test5() { } } } + diff --git a/compiler/testData/ir/irText/expressions/destructuring1.fir.ir.txt b/compiler/testData/ir/irText/expressions/destructuring1.fir.ir.txt index 7b8bc3f610b..03cbb4573f8 100644 --- a/compiler/testData/ir/irText/expressions/destructuring1.fir.ir.txt +++ b/compiler/testData/ir/irText/expressions/destructuring1.fir.ir.txt @@ -55,10 +55,10 @@ FILE fqName: fileName:/destructuring1.kt VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.A [val] GET_OBJECT 'CLASS OBJECT name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=.A VAR name:x type:kotlin.Int [val] - CALL 'public final fun component1 (): kotlin.Int [operator] declared in .B' type=kotlin.Int origin=null + CALL 'public final fun component1 (): kotlin.Int [operator] declared in .B' type=kotlin.Int origin=COMPONENT_N(index=1) $this: GET_VAR ': .B declared in .test' type=.B origin=null $receiver: GET_VAR 'val tmp_0: .A [val] declared in .test' type=.A origin=null VAR name:y type:kotlin.Int [val] - CALL 'public final fun component2 (): kotlin.Int [operator] declared in .B' type=kotlin.Int origin=null + CALL 'public final fun component2 (): kotlin.Int [operator] declared in .B' type=kotlin.Int origin=COMPONENT_N(index=2) $this: GET_VAR ': .B declared in .test' type=.B origin=null $receiver: GET_VAR 'val tmp_0: .A [val] declared in .test' type=.A origin=null diff --git a/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.fir.ir.txt b/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.fir.ir.txt index efb3de95417..6858b385696 100644 --- a/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.fir.ir.txt +++ b/compiler/testData/ir/irText/expressions/destructuringWithUnderscore.fir.ir.txt @@ -61,10 +61,10 @@ FILE fqName: fileName:/destructuringWithUnderscore.kt VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.A [val] GET_OBJECT 'CLASS OBJECT name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=.A VAR name:x type:kotlin.Int [val] - CALL 'public final fun component1 (): kotlin.Int [operator] declared in .B' type=kotlin.Int origin=null + CALL 'public final fun component1 (): kotlin.Int [operator] declared in .B' type=kotlin.Int origin=COMPONENT_N(index=1) $this: GET_VAR ': .B declared in .test' type=.B origin=null $receiver: GET_VAR 'val tmp_0: .A [val] declared in .test' type=.A origin=null VAR name:z type:kotlin.Int [val] - CALL 'public final fun component3 (): kotlin.Int [operator] declared in .B' type=kotlin.Int origin=null + CALL 'public final fun component3 (): kotlin.Int [operator] declared in .B' type=kotlin.Int origin=COMPONENT_N(index=3) $this: GET_VAR ': .B declared in .test' type=.B origin=null $receiver: GET_VAR 'val tmp_0: .A [val] declared in .test' type=.A origin=null diff --git a/compiler/testData/ir/irText/expressions/for.fir.ir.txt b/compiler/testData/ir/irText/expressions/for.fir.ir.txt index 41b21b29fc7..7e2a2ff67d7 100644 --- a/compiler/testData/ir/irText/expressions/for.fir.ir.txt +++ b/compiler/testData/ir/irText/expressions/for.fir.ir.txt @@ -13,6 +13,7 @@ FILE fqName: fileName:/for.kt 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 + BLOCK type=kotlin.Unit 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 @@ -40,16 +41,16 @@ FILE fqName: fileName:/for.kt 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=FOR_LOOP_INNER_WHILE - VAR FOR_LOOP_VARIABLE name: type:kotlin.Pair [val] + 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=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=COMPONENT_N(index=1) + $this: GET_VAR 'val tmp_3: 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=COMPONENT_N(index=2) + $this: GET_VAR 'val tmp_3: kotlin.Pair [val] declared in .testDestructuring' type=kotlin.Pair 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 @@ -57,15 +58,16 @@ FILE fqName: fileName:/for.kt FUN name:testRange visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY BLOCK type=kotlin.Unit origin=FOR_LOOP - VAR FOR_LOOP_ITERATOR name:tmp_3 type:kotlin.collections.IntIterator [val] + VAR FOR_LOOP_ITERATOR name:tmp_4 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=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 [fake_override,operator] declared in kotlin.collections.IntIterator' 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 + $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=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 + $this: GET_VAR 'val tmp_4: kotlin.collections.IntIterator [val] declared in .testRange' type=kotlin.collections.IntIterator origin=null + BLOCK type=kotlin.Unit origin=null diff --git a/compiler/testData/ir/irText/expressions/for.fir.kt.txt b/compiler/testData/ir/irText/expressions/for.fir.kt.txt index 9c840b541e0..f0869efd75f 100644 --- a/compiler/testData/ir/irText/expressions/for.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/for.fir.kt.txt @@ -3,6 +3,8 @@ fun testEmpty(ss: List) { val : Iterator = ss.iterator() while (.hasNext()) { // BLOCK val s: String = .next() + { // BLOCK + } } } } @@ -22,9 +24,9 @@ fun testDestructuring(pp: List>) { val : Iterator> = pp.iterator() while (.hasNext()) { // BLOCK val : Pair = .next() + val i: Int = .component1() + val s: String = .component2() { // BLOCK - val i: Int = .component1() - val s: String = .component2() println(message = i) println(message = s) } @@ -37,6 +39,9 @@ fun testRange() { val : IntIterator = 1.rangeTo(other = 10).iterator() while (.hasNext()) { // BLOCK val i: Int = .next() + { // BLOCK + } } } } + diff --git a/compiler/testData/ir/irText/expressions/implicitNotNullInDestructuringAssignment.fir.ir.txt b/compiler/testData/ir/irText/expressions/implicitNotNullInDestructuringAssignment.fir.ir.txt index 4c51344a5c3..53d49328bdc 100644 --- a/compiler/testData/ir/irText/expressions/implicitNotNullInDestructuringAssignment.fir.ir.txt +++ b/compiler/testData/ir/irText/expressions/implicitNotNullInDestructuringAssignment.fir.ir.txt @@ -14,9 +14,9 @@ FILE fqName: fileName:/implicitNotNullInDestructuringAssignment.kt VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:@[FlexibleNullability] .J? [val] CALL 'public open fun j (): @[FlexibleNullability] .J? declared in .J' type=@[FlexibleNullability] .J? origin=null VAR name:a type:kotlin.Int [val] - CALL 'public final fun component1 (): kotlin.Int [operator] declared in ' type=kotlin.Int origin=null + CALL 'public final fun component1 (): kotlin.Int [operator] declared in ' type=kotlin.Int origin=COMPONENT_N(index=1) $receiver: GET_VAR 'val tmp_0: @[FlexibleNullability] .J? [val] declared in .test' type=@[FlexibleNullability] .J? origin=null VAR name:b type:kotlin.Int [val] - CALL 'private final fun component2 (): kotlin.Int [operator] declared in ' type=kotlin.Int origin=null + CALL 'private final fun component2 (): kotlin.Int [operator] declared in ' type=kotlin.Int origin=COMPONENT_N(index=2) $receiver: TYPE_OP type=@[FlexibleNullability] .J origin=IMPLICIT_NOTNULL typeOperand=@[FlexibleNullability] .J GET_VAR 'val tmp_0: @[FlexibleNullability] .J? [val] declared in .test' type=@[FlexibleNullability] .J? origin=null diff --git a/compiler/testData/ir/irText/expressions/multipleSmartCasts.fir.ir.txt b/compiler/testData/ir/irText/expressions/multipleSmartCasts.fir.ir.txt index 1d8244a2161..22df0bef974 100644 --- a/compiler/testData/ir/irText/expressions/multipleSmartCasts.fir.ir.txt +++ b/compiler/testData/ir/irText/expressions/multipleSmartCasts.fir.ir.txt @@ -53,11 +53,11 @@ FILE fqName: fileName:/multipleSmartCasts.kt TYPE_OP type=.IC1 origin=IMPLICIT_CAST typeOperand=.IC1 GET_VAR 'x: kotlin.Any declared in .test' type=kotlin.Any origin=null VAR name:x1 type:kotlin.Int [val] - CALL 'public abstract fun component1 (): kotlin.Int [operator] declared in .IC1' type=kotlin.Int origin=null + CALL 'public abstract fun component1 (): kotlin.Int [operator] declared in .IC1' type=kotlin.Int origin=COMPONENT_N(index=1) $this: TYPE_OP type=.IC1 origin=IMPLICIT_CAST typeOperand=.IC1 GET_VAR 'val tmp_0: kotlin.Any [val] declared in .test' type=kotlin.Any origin=null VAR name:x2 type:kotlin.String [val] - CALL 'public abstract fun component2 (): kotlin.String [operator] declared in .IC2' type=kotlin.String origin=null + CALL 'public abstract fun component2 (): kotlin.String [operator] declared in .IC2' type=kotlin.String origin=COMPONENT_N(index=2) $this: TYPE_OP type=.IC2 origin=IMPLICIT_CAST typeOperand=.IC2 TYPE_OP type=.IC1 origin=IMPLICIT_CAST typeOperand=.IC1 GET_VAR 'val tmp_0: kotlin.Any [val] declared in .test' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.fir.ir.txt b/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.fir.ir.txt index fcb85af7862..a487304ede7 100644 --- a/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.fir.ir.txt +++ b/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.fir.ir.txt @@ -52,10 +52,10 @@ FILE fqName: fileName:/smartCastsWithDestructuring.kt TYPE_OP type=.I2 origin=IMPLICIT_CAST typeOperand=.I2 GET_VAR 'x: .I1 declared in .test' type=.I1 origin=null VAR name:c1 type:kotlin.Int [val] - CALL 'public final fun component1 (): kotlin.Int [operator] declared in ' type=kotlin.Int origin=null + CALL 'public final fun component1 (): kotlin.Int [operator] declared in ' type=kotlin.Int origin=COMPONENT_N(index=1) $receiver: TYPE_OP type=.I2 origin=IMPLICIT_CAST typeOperand=.I2 GET_VAR 'val tmp_0: .I1 [val] declared in .test' type=.I1 origin=null VAR name:c2 type:kotlin.String [val] - CALL 'public final fun component2 (): kotlin.String [operator] declared in ' type=kotlin.String origin=null + CALL 'public final fun component2 (): kotlin.String [operator] declared in ' type=kotlin.String origin=COMPONENT_N(index=2) $receiver: TYPE_OP type=.I2 origin=IMPLICIT_CAST typeOperand=.I2 GET_VAR 'val tmp_0: .I1 [val] declared in .test' type=.I1 origin=null diff --git a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.fir.ir.txt b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.fir.ir.txt index 53c0bd6e5bd..dfb54d44c50 100644 --- a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.fir.ir.txt +++ b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.fir.ir.txt @@ -178,33 +178,32 @@ FILE fqName: fileName:/DeepCopyIrTree.kt 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.Unit origin=FOR_LOOP_INNER_WHILE - VAR FOR_LOOP_VARIABLE name: type:kotlin.Pair<.IrTypeParameter, .IrTypeParameter> [val] + VAR IR_TEMPORARY_VARIABLE name:tmp_1 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 - 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 + VAR name:thisTypeParameter type:.IrTypeParameter [val] + CALL 'public final fun component1 (): A of kotlin.Pair [operator] declared in kotlin.Pair' type=.IrTypeParameter origin=COMPONENT_N(index=1) + $this: GET_VAR 'val tmp_1: 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=COMPONENT_N(index=2) + $this: GET_VAR 'val tmp_1: 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/firProblems/DeepCopyIrTree.fir.kt.txt b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.fir.kt.txt index d18aaacf871..9552e8e916b 100644 --- a/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.fir.kt.txt +++ b/compiler/testData/ir/irText/firProblems/DeepCopyIrTree.fir.kt.txt @@ -55,14 +55,12 @@ class DeepCopyIrTreeWithSymbols { val : Iterator> = .().zip(other = other.()).iterator() while (.hasNext()) { // BLOCK val : Pair = .next() - { // BLOCK - val thisTypeParameter: IrTypeParameter = .component1() - val otherTypeParameter: IrTypeParameter = .component2() - otherTypeParameter.().mapTo>(destination = thisTypeParameter.(), transform = local fun (it: IrType): IrType { - return .().remapType(type = it) - } -) + val thisTypeParameter: IrTypeParameter = .component1() + val otherTypeParameter: IrTypeParameter = .component2() + otherTypeParameter.().mapTo>(destination = thisTypeParameter.(), transform = local fun (it: IrType): IrType { + return .().remapType(type = it) } +) } } } @@ -77,3 +75,4 @@ inline fun TypeRemapper.withinScope(irTypeParametersContainer: IrType .leaveScope() return result } + diff --git a/compiler/testData/ir/irText/lambdas/destructuringInLambda.fir.ir.txt b/compiler/testData/ir/irText/lambdas/destructuringInLambda.fir.ir.txt index 4dfedbe9ffb..1f92d261a0c 100644 --- a/compiler/testData/ir/irText/lambdas/destructuringInLambda.fir.ir.txt +++ b/compiler/testData/ir/irText/lambdas/destructuringInLambda.fir.ir.txt @@ -143,7 +143,7 @@ FILE fqName: fileName:/destructuringInLambda.kt VALUE_PARAMETER name: index:0 type:.A BLOCK_BODY VAR name:y type:kotlin.Int [val] - CALL 'public final fun component2 (): kotlin.Int [operator] declared in .A' type=kotlin.Int origin=null + CALL 'public final fun component2 (): kotlin.Int [operator] declared in .A' type=kotlin.Int origin=COMPONENT_N(index=2) $this: GET_VAR ': .A declared in .fn.' type=.A origin=null RETURN type=kotlin.Nothing from='local final fun (: .A): kotlin.Int declared in .fn' CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.fir.ir.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.fir.ir.txt index b24bf638009..0ba2446cbdc 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.fir.ir.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.fir.ir.txt @@ -121,10 +121,10 @@ FILE fqName: fileName:/enhancedNullabilityInDestructuringAssignment.kt TYPE_OP type=.P origin=IMPLICIT_NOTNULL typeOperand=.P CALL 'public open fun notNullP (): @[EnhancedNullability] .P declared in .J' type=@[EnhancedNullability] .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 + CALL 'public final fun component1 (): kotlin.Int [operator] declared in .P' type=kotlin.Int origin=COMPONENT_N(index=1) $this: GET_VAR 'val tmp_0: .P [val] declared in .test1' type=.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 + CALL 'public final fun component2 (): kotlin.Int [operator] declared in .P' type=kotlin.Int origin=COMPONENT_N(index=2) $this: GET_VAR 'val tmp_0: .P [val] declared in .test1' type=.P origin=null CALL 'public final fun use (x: kotlin.Any, y: kotlin.Any): kotlin.Unit declared in ' type=kotlin.Unit origin=null x: GET_VAR 'val x: kotlin.Int [val] declared in .test1' type=kotlin.Int origin=null @@ -133,17 +133,17 @@ FILE fqName: fileName:/enhancedNullabilityInDestructuringAssignment.kt BLOCK_BODY VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:@[FlexibleNullability] .Q<@[EnhancedNullability] kotlin.String, @[EnhancedNullability] kotlin.String>? [val] CALL 'public open fun notNullComponents (): @[FlexibleNullability] .Q<@[EnhancedNullability] kotlin.String, @[EnhancedNullability] kotlin.String>? declared in .J' type=@[FlexibleNullability] .Q<@[EnhancedNullability] kotlin.String, @[EnhancedNullability] kotlin.String>? origin=null - VAR name:x type:kotlin.String [val] + VAR name:x type:@[EnhancedNullability] kotlin.String [val] TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - CALL 'public final fun component1 (): T1 of .Q [operator] declared in .Q' type=@[EnhancedNullability] kotlin.String origin=null + CALL 'public final fun component1 (): T1 of .Q [operator] declared in .Q' type=@[EnhancedNullability] kotlin.String origin=COMPONENT_N(index=1) $this: GET_VAR 'val tmp_1: @[FlexibleNullability] .Q<@[EnhancedNullability] kotlin.String, @[EnhancedNullability] kotlin.String>? [val] declared in .test2' type=@[FlexibleNullability] .Q<@[EnhancedNullability] kotlin.String, @[EnhancedNullability] kotlin.String>? origin=null - VAR name:y type:kotlin.String [val] + VAR name:y type:@[EnhancedNullability] kotlin.String [val] TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - CALL 'public final fun component2 (): T2 of .Q [operator] declared in .Q' type=@[EnhancedNullability] kotlin.String origin=null + CALL 'public final fun component2 (): T2 of .Q [operator] declared in .Q' type=@[EnhancedNullability] kotlin.String origin=COMPONENT_N(index=2) $this: GET_VAR 'val tmp_1: @[FlexibleNullability] .Q<@[EnhancedNullability] kotlin.String, @[EnhancedNullability] kotlin.String>? [val] declared in .test2' type=@[FlexibleNullability] .Q<@[EnhancedNullability] kotlin.String, @[EnhancedNullability] kotlin.String>? origin=null CALL 'public final fun use (x: kotlin.Any, y: kotlin.Any): kotlin.Unit declared in ' type=kotlin.Unit origin=null - x: GET_VAR 'val x: kotlin.String [val] declared in .test2' type=kotlin.String origin=null - y: GET_VAR 'val y: kotlin.String [val] declared in .test2' type=kotlin.String origin=null + x: GET_VAR 'val x: @[EnhancedNullability] kotlin.String [val] declared in .test2' type=kotlin.String origin=null + y: GET_VAR 'val y: @[EnhancedNullability] kotlin.String [val] declared in .test2' type=kotlin.String origin=null FUN name:test2Desugared visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY VAR name:tmp type:@[FlexibleNullability] .Q<@[EnhancedNullability] kotlin.String, @[EnhancedNullability] kotlin.String>? [val] @@ -164,17 +164,17 @@ FILE fqName: fileName:/enhancedNullabilityInDestructuringAssignment.kt VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:.Q<@[EnhancedNullability] kotlin.String, @[EnhancedNullability] kotlin.String> [val] TYPE_OP type=.Q<@[EnhancedNullability] kotlin.String, @[EnhancedNullability] kotlin.String> origin=IMPLICIT_NOTNULL typeOperand=.Q<@[EnhancedNullability] kotlin.String, @[EnhancedNullability] kotlin.String> CALL 'public open fun notNullQAndComponents (): @[EnhancedNullability] .Q<@[EnhancedNullability] kotlin.String, @[EnhancedNullability] kotlin.String> declared in .J' type=@[EnhancedNullability] .Q<@[EnhancedNullability] kotlin.String, @[EnhancedNullability] kotlin.String> origin=null - VAR name:x type:kotlin.String [val] + VAR name:x type:@[EnhancedNullability] kotlin.String [val] TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - CALL 'public final fun component1 (): T1 of .Q [operator] declared in .Q' type=@[EnhancedNullability] kotlin.String origin=null + CALL 'public final fun component1 (): T1 of .Q [operator] declared in .Q' type=@[EnhancedNullability] kotlin.String origin=COMPONENT_N(index=1) $this: GET_VAR 'val tmp_2: .Q<@[EnhancedNullability] kotlin.String, @[EnhancedNullability] kotlin.String> [val] declared in .test3' type=.Q<@[EnhancedNullability] kotlin.String, @[EnhancedNullability] kotlin.String> origin=null - VAR name:y type:kotlin.String [val] + VAR name:y type:@[EnhancedNullability] kotlin.String [val] TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - CALL 'public final fun component2 (): T2 of .Q [operator] declared in .Q' type=@[EnhancedNullability] kotlin.String origin=null + CALL 'public final fun component2 (): T2 of .Q [operator] declared in .Q' type=@[EnhancedNullability] kotlin.String origin=COMPONENT_N(index=2) $this: GET_VAR 'val tmp_2: .Q<@[EnhancedNullability] kotlin.String, @[EnhancedNullability] kotlin.String> [val] declared in .test3' type=.Q<@[EnhancedNullability] kotlin.String, @[EnhancedNullability] kotlin.String> origin=null CALL 'public final fun use (x: kotlin.Any, y: kotlin.Any): kotlin.Unit declared in ' type=kotlin.Unit origin=null - x: GET_VAR 'val x: kotlin.String [val] declared in .test3' type=kotlin.String origin=null - y: GET_VAR 'val y: kotlin.String [val] declared in .test3' type=kotlin.String origin=null + x: GET_VAR 'val x: @[EnhancedNullability] kotlin.String [val] declared in .test3' type=kotlin.String origin=null + y: GET_VAR 'val y: @[EnhancedNullability] kotlin.String [val] declared in .test3' type=kotlin.String origin=null FUN name:test4 visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.collections.IndexedValue<@[EnhancedNullability] .P> [val] @@ -185,12 +185,12 @@ FILE fqName: fileName:/enhancedNullabilityInDestructuringAssignment.kt $receiver: TYPE_OP type=@[FlexibleNullability] kotlin.collections.List<@[EnhancedNullability] .P> origin=IMPLICIT_NOTNULL typeOperand=@[FlexibleNullability] kotlin.collections.List<@[EnhancedNullability] .P> CALL 'public open fun listOfNotNull (): @[FlexibleNullability] kotlin.collections.List<@[EnhancedNullability] .P>? declared in .J' type=@[FlexibleNullability] kotlin.collections.List<@[EnhancedNullability] .P>? origin=null VAR name:x type:kotlin.Int [val] - CALL 'public final fun component1 (): kotlin.Int [operator] declared in kotlin.collections.IndexedValue' type=kotlin.Int origin=null + CALL 'public final fun component1 (): kotlin.Int [operator] declared in kotlin.collections.IndexedValue' type=kotlin.Int origin=COMPONENT_N(index=1) $this: GET_VAR 'val tmp_3: kotlin.collections.IndexedValue<@[EnhancedNullability] .P> [val] declared in .test4' type=kotlin.collections.IndexedValue<@[EnhancedNullability] .P> origin=null - VAR name:y type:.P [val] + VAR name:y type:@[EnhancedNullability] .P [val] TYPE_OP type=.P origin=IMPLICIT_NOTNULL typeOperand=.P - CALL 'public final fun component2 (): T of kotlin.collections.IndexedValue [operator] declared in kotlin.collections.IndexedValue' type=@[EnhancedNullability] .P origin=null + CALL 'public final fun component2 (): T of kotlin.collections.IndexedValue [operator] declared in kotlin.collections.IndexedValue' type=@[EnhancedNullability] .P origin=COMPONENT_N(index=2) $this: GET_VAR 'val tmp_3: kotlin.collections.IndexedValue<@[EnhancedNullability] .P> [val] declared in .test4' type=kotlin.collections.IndexedValue<@[EnhancedNullability] .P> origin=null CALL 'public final fun use (x: kotlin.Any, y: kotlin.Any): kotlin.Unit declared in ' type=kotlin.Unit origin=null x: GET_VAR 'val x: kotlin.Int [val] declared in .test4' type=kotlin.Int origin=null - y: GET_VAR 'val y: .P [val] declared in .test4' type=.P origin=null + y: GET_VAR 'val y: @[EnhancedNullability] .P [val] declared in .test4' type=.P origin=null diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.fir.kt.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.fir.kt.txt index 0766698280b..7180281e9f4 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.fir.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInDestructuringAssignment.fir.kt.txt @@ -60,8 +60,8 @@ fun test1() { fun test2() { val : @FlexibleNullability Q<@EnhancedNullability String, @EnhancedNullability String>? = notNullComponents() - val x: String = .component1() /*!! String */ - val y: String = .component2() /*!! String */ + val x: @EnhancedNullability String = .component1() /*!! String */ + val y: @EnhancedNullability String = .component2() /*!! String */ use(x = x, y = y) } @@ -74,14 +74,15 @@ fun test2Desugared() { fun test3() { val : Q<@EnhancedNullability String, @EnhancedNullability String> = notNullQAndComponents() /*!! Q<@EnhancedNullability String, @EnhancedNullability String> */ - val x: String = .component1() /*!! String */ - val y: String = .component2() /*!! String */ + val x: @EnhancedNullability String = .component1() /*!! String */ + val y: @EnhancedNullability String = .component2() /*!! String */ use(x = x, y = y) } fun test4() { val : IndexedValue<@EnhancedNullability P> = listOfNotNull() /*!! @FlexibleNullability List<@EnhancedNullability P> */.withIndex<@EnhancedNullability P>().first>() val x: Int = .component1() - val y: P = .component2() /*!! P */ + val y: @EnhancedNullability P = .component2() /*!! P */ use(x = x, y = y) } + diff --git a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.ir.txt b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.ir.txt index 09e5fd3be62..e2865e16564 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.ir.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.ir.txt @@ -16,6 +16,7 @@ FILE fqName: fileName:/enhancedNullabilityInForLoop.kt TYPE_OP type=.P origin=IMPLICIT_NOTNULL typeOperand=.P CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableIterator' type=@[EnhancedNullability] .P origin=FOR_LOOP_NEXT $this: GET_VAR 'val tmp_0: kotlin.collections.MutableIterator<@[EnhancedNullability] .P> [val] declared in .testForInListUnused' type=kotlin.collections.MutableIterator<@[EnhancedNullability] .P> origin=null + BLOCK type=kotlin.Unit origin=null FUN name:testForInListDestructured visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY BLOCK type=kotlin.Unit origin=FOR_LOOP @@ -26,17 +27,17 @@ FILE fqName: fileName:/enhancedNullabilityInForLoop.kt condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.MutableIterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT $this: GET_VAR 'val tmp_1: kotlin.collections.MutableIterator<@[EnhancedNullability] .P> [val] declared in .testForInListDestructured' type=kotlin.collections.MutableIterator<@[EnhancedNullability] .P> origin=null body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE - VAR FOR_LOOP_VARIABLE name: type:.P [val] + VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:.P [val] TYPE_OP type=.P origin=IMPLICIT_NOTNULL typeOperand=.P CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableIterator' type=@[EnhancedNullability] .P origin=FOR_LOOP_NEXT $this: GET_VAR 'val tmp_1: kotlin.collections.MutableIterator<@[EnhancedNullability] .P> [val] declared in .testForInListDestructured' type=kotlin.collections.MutableIterator<@[EnhancedNullability] .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=COMPONENT_N(index=1) + $this: GET_VAR 'val tmp_2: .P [val] declared in .testForInListDestructured' type=.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=COMPONENT_N(index=2) + $this: GET_VAR 'val tmp_2: .P [val] declared in .testForInListDestructured' type=.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 : .P [val] declared in .testForInListDestructured' type=.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 : .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<@[EnhancedNullability] .P> [val] @@ -54,32 +55,33 @@ FILE fqName: fileName:/enhancedNullabilityInForLoop.kt VALUE_PARAMETER name:j index:0 type:.J BLOCK_BODY BLOCK type=kotlin.Unit origin=FOR_LOOP - VAR FOR_LOOP_ITERATOR name:tmp_2 type:kotlin.collections.Iterator<@[EnhancedNullability] .P> [val] + VAR FOR_LOOP_ITERATOR name:tmp_3 type:kotlin.collections.Iterator<@[EnhancedNullability] .P> [val] CALL 'public final fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.Array' type=kotlin.collections.Iterator<@[EnhancedNullability] .P> origin=null $this: CALL 'public open fun arrayOfNotNull (): @[EnhancedNullability] kotlin.Array.P> declared in .J' type=@[EnhancedNullability] 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=FOR_LOOP_HAS_NEXT - $this: GET_VAR 'val tmp_2: kotlin.collections.Iterator<@[EnhancedNullability] .P> [val] declared in .testForInArrayUnused' type=kotlin.collections.Iterator<@[EnhancedNullability] .P> origin=null + $this: GET_VAR 'val tmp_3: kotlin.collections.Iterator<@[EnhancedNullability] .P> [val] declared in .testForInArrayUnused' type=kotlin.collections.Iterator<@[EnhancedNullability] .P> origin=null body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE VAR FOR_LOOP_VARIABLE name:x type:.P [val] TYPE_OP type=.P origin=IMPLICIT_NOTNULL typeOperand=.P CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=@[EnhancedNullability] .P origin=FOR_LOOP_NEXT - $this: GET_VAR 'val tmp_2: kotlin.collections.Iterator<@[EnhancedNullability] .P> [val] declared in .testForInArrayUnused' type=kotlin.collections.Iterator<@[EnhancedNullability] .P> origin=null + $this: GET_VAR 'val tmp_3: kotlin.collections.Iterator<@[EnhancedNullability] .P> [val] declared in .testForInArrayUnused' type=kotlin.collections.Iterator<@[EnhancedNullability] .P> origin=null + BLOCK type=kotlin.Unit origin=null FUN name:testForInListUse visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY BLOCK type=kotlin.Unit origin=FOR_LOOP - VAR FOR_LOOP_ITERATOR name:tmp_3 type:kotlin.collections.MutableIterator<@[EnhancedNullability] .P> [val] + VAR FOR_LOOP_ITERATOR name:tmp_4 type:kotlin.collections.MutableIterator<@[EnhancedNullability] .P> [val] CALL 'public abstract fun iterator (): kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableList' type=kotlin.collections.MutableIterator<@[EnhancedNullability] .P> origin=FOR_LOOP_ITERATOR $this: CALL 'public open fun listOfNotNull (): @[FlexibleNullability] kotlin.collections.List<@[EnhancedNullability] .P>? declared in .J' type=@[FlexibleNullability] kotlin.collections.List<@[EnhancedNullability] .P>? 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.MutableIterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT - $this: GET_VAR 'val tmp_3: kotlin.collections.MutableIterator<@[EnhancedNullability] .P> [val] declared in .testForInListUse' type=kotlin.collections.MutableIterator<@[EnhancedNullability] .P> origin=null + $this: GET_VAR 'val tmp_4: kotlin.collections.MutableIterator<@[EnhancedNullability] .P> [val] declared in .testForInListUse' type=kotlin.collections.MutableIterator<@[EnhancedNullability] .P> origin=null body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE VAR FOR_LOOP_VARIABLE name:x type:.P [val] TYPE_OP type=.P origin=IMPLICIT_NOTNULL typeOperand=.P CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableIterator' type=@[EnhancedNullability] .P origin=FOR_LOOP_NEXT - $this: GET_VAR 'val tmp_3: kotlin.collections.MutableIterator<@[EnhancedNullability] .P> [val] declared in .testForInListUse' type=kotlin.collections.MutableIterator<@[EnhancedNullability] .P> origin=null + $this: GET_VAR 'val tmp_4: kotlin.collections.MutableIterator<@[EnhancedNullability] .P> [val] declared in .testForInListUse' type=kotlin.collections.MutableIterator<@[EnhancedNullability] .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: GET_VAR 'val x: .P [val] declared in .testForInListUse' type=.P origin=null @@ -89,18 +91,18 @@ FILE fqName: fileName:/enhancedNullabilityInForLoop.kt VALUE_PARAMETER name:j index:0 type:.J BLOCK_BODY BLOCK type=kotlin.Unit origin=FOR_LOOP - VAR FOR_LOOP_ITERATOR name:tmp_4 type:kotlin.collections.Iterator<@[EnhancedNullability] .P> [val] + VAR FOR_LOOP_ITERATOR name:tmp_5 type:kotlin.collections.Iterator<@[EnhancedNullability] .P> [val] CALL 'public final fun iterator (): kotlin.collections.Iterator [operator] declared in kotlin.Array' type=kotlin.collections.Iterator<@[EnhancedNullability] .P> origin=null $this: CALL 'public open fun arrayOfNotNull (): @[EnhancedNullability] kotlin.Array.P> declared in .J' type=@[EnhancedNullability] 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=FOR_LOOP_HAS_NEXT - $this: GET_VAR 'val tmp_4: kotlin.collections.Iterator<@[EnhancedNullability] .P> [val] declared in .testForInArrayUse' type=kotlin.collections.Iterator<@[EnhancedNullability] .P> origin=null + $this: GET_VAR 'val tmp_5: kotlin.collections.Iterator<@[EnhancedNullability] .P> [val] declared in .testForInArrayUse' type=kotlin.collections.Iterator<@[EnhancedNullability] .P> origin=null body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE VAR FOR_LOOP_VARIABLE name:x type:.P [val] TYPE_OP type=.P origin=IMPLICIT_NOTNULL typeOperand=.P CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=@[EnhancedNullability] .P origin=FOR_LOOP_NEXT - $this: GET_VAR 'val tmp_4: kotlin.collections.Iterator<@[EnhancedNullability] .P> [val] declared in .testForInArrayUse' type=kotlin.collections.Iterator<@[EnhancedNullability] .P> origin=null + $this: GET_VAR 'val tmp_5: kotlin.collections.Iterator<@[EnhancedNullability] .P> [val] declared in .testForInArrayUse' type=kotlin.collections.Iterator<@[EnhancedNullability] .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: GET_VAR 'val x: .P [val] declared in .testForInArrayUse' type=.P origin=null @@ -199,7 +201,7 @@ FILE fqName: fileName:/enhancedNullabilityInForLoop.kt GET_VAR 'other: kotlin.Any? declared in .P.equals' type=kotlin.Any? origin=null then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .P' CONST Boolean type=kotlin.Boolean value=false - VAR IR_TEMPORARY_VARIABLE name:tmp_5 type:.P [val] + VAR IR_TEMPORARY_VARIABLE name:tmp_6 type:.P [val] TYPE_OP type=.P origin=CAST typeOperand=.P GET_VAR 'other: kotlin.Any? declared in .P.equals' type=kotlin.Any? origin=null WHEN type=kotlin.Unit origin=null @@ -209,7 +211,7 @@ FILE fqName: fileName:/enhancedNullabilityInForLoop.kt arg0: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null receiver: GET_VAR ': .P declared in .P.equals' type=.P origin=null arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - receiver: GET_VAR 'val tmp_5: .P [val] declared in .P.equals' type=.P origin=null + receiver: GET_VAR 'val tmp_6: .P [val] declared in .P.equals' type=.P origin=null then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .P' CONST Boolean type=kotlin.Boolean value=false WHEN type=kotlin.Unit origin=null @@ -219,7 +221,7 @@ FILE fqName: fileName:/enhancedNullabilityInForLoop.kt arg0: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null receiver: GET_VAR ': .P declared in .P.equals' type=.P origin=null arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - receiver: GET_VAR 'val tmp_5: .P [val] declared in .P.equals' type=.P origin=null + receiver: GET_VAR 'val tmp_6: .P [val] declared in .P.equals' type=.P origin=null then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .P' CONST Boolean type=kotlin.Boolean value=false RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .P' 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 d4874918110..96779c1935a 100644 --- a/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.kt.txt +++ b/compiler/testData/ir/irText/types/nullChecks/enhancedNullabilityInForLoop.fir.kt.txt @@ -6,6 +6,8 @@ fun testForInListUnused() { val : MutableIterator<@EnhancedNullability P> = listOfNotNull().iterator() while (.hasNext()) { // BLOCK val x: P = .next() /*!! P */ + { // BLOCK + } } } } @@ -15,9 +17,9 @@ fun testForInListDestructured() { val : MutableIterator<@EnhancedNullability P> = listOfNotNull().iterator() while (.hasNext()) { // BLOCK val : P = .next() /*!! P */ + val x: Int = .component1() + val y: Int = .component2() { // BLOCK - val x: Int = .component1() - val y: Int = .component2() } } } @@ -35,6 +37,8 @@ fun testForInArrayUnused(j: J) { val : Iterator<@EnhancedNullability P> = j.arrayOfNotNull().iterator() while (.hasNext()) { // BLOCK val x: P = .next() /*!! P */ + { // BLOCK + } } } } @@ -125,3 +129,4 @@ data class P { } } +