diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirSteppingTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirSteppingTestGenerated.java index 3f595d3223b..46aa4840735 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirSteppingTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirSteppingTestGenerated.java @@ -313,6 +313,12 @@ public class FirSteppingTestGenerated extends AbstractFirSteppingTest { runTest("compiler/testData/debug/stepping/localFunctionWIthOnelineExpressionBody.kt"); } + @Test + @TestMetadata("localProperty.kt") + public void testLocalProperty() throws Exception { + runTest("compiler/testData/debug/stepping/localProperty.kt"); + } + @Test @TestMetadata("multilineExpression.kt") public void testMultilineExpression() throws Exception { diff --git a/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmGeneratorExtensionsImpl.kt b/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmGeneratorExtensionsImpl.kt index 03df050ef70..9f47a126bae 100644 --- a/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmGeneratorExtensionsImpl.kt +++ b/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmGeneratorExtensionsImpl.kt @@ -17,6 +17,7 @@ import org.jetbrains.kotlin.config.languageVersionSettings import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.annotations.FilteredAnnotations import org.jetbrains.kotlin.incremental.components.NoLookupLocation +import org.jetbrains.kotlin.ir.IrBuiltIns import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI import org.jetbrains.kotlin.ir.backend.jvm.serialization.JvmIrMangler import org.jetbrains.kotlin.ir.builders.declarations.addConstructor @@ -24,7 +25,6 @@ import org.jetbrains.kotlin.ir.builders.declarations.buildClass import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.declarations.impl.IrExternalPackageFragmentImpl import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl -import org.jetbrains.kotlin.ir.IrBuiltIns import org.jetbrains.kotlin.ir.expressions.IrDelegatingConstructorCall import org.jetbrains.kotlin.ir.expressions.impl.IrDelegatingConstructorCallImpl import org.jetbrains.kotlin.ir.symbols.impl.DescriptorlessExternalPackageFragmentSymbol @@ -252,4 +252,7 @@ open class JvmGeneratorExtensionsImpl( override val parametersAreAssignable: Boolean get() = true + + override val debugInfoOnlyOnVariablesInDestructuringDeclarations: Boolean + get() = true } diff --git a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/TypeOperatorLowering.kt b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/TypeOperatorLowering.kt index 0cdea2ce86c..8aeb64dc045 100644 --- a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/TypeOperatorLowering.kt +++ b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/TypeOperatorLowering.kt @@ -722,10 +722,10 @@ private class TypeOperatorLowering(private val backendContext: JvmBackendContext val source = if (owner is IrFunction && owner.isDelegated()) { "${owner.name.asString()}(...)" } else { - val (startOffset, endOffset) = expression.extents() val declarationParent = parent as? IrDeclaration val sourceView = declarationParent?.let(::sourceViewFor) - if (sourceView != null && startOffset >= 0 && endOffset < sourceView.length) { + val (startOffset, endOffset) = expression.extents() + if (sourceView?.validSourcePosition(startOffset, endOffset) == true) { sourceView.subSequence(startOffset, endOffset).toString() } else { // Fallback for inconsistent line numbers @@ -757,6 +757,9 @@ private class TypeOperatorLowering(private val backendContext: JvmBackendContext origin == IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR || origin == IrDeclarationOrigin.DELEGATED_MEMBER + private fun CharSequence.validSourcePosition(startOffset: Int, endOffset: Int): Boolean = + startOffset in 0 until endOffset && endOffset < length + private fun IrElement.extents(): Pair { var startOffset = Int.MAX_VALUE var endOffset = 0 diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/BodyGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/BodyGenerator.kt index ee9159b5366..ccc614f006e 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/BodyGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/BodyGenerator.kt @@ -103,7 +103,7 @@ class BodyGenerator( valueParameter.type.toIrType(), IrStatementOrigin.DESTRUCTURING_DECLARATION ) - statementGenerator.declareComponentVariablesInBlock(ktDestructuringDeclaration, irBlockBody, parameterValue) + statementGenerator.declareComponentVariablesInBlock(ktDestructuringDeclaration, irBlockBody, parameterValue, parameterValue) } val ktBodyStatements = ktBody.statements diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/CallGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/CallGenerator.kt index d69415a8482..bb2353dbdbf 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/CallGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/CallGenerator.kt @@ -463,8 +463,14 @@ fun IrExpression.isUnchanging() = fun IrExpression.hasNoSideEffects() = isUnchanging() || this is IrGetValue -fun CallGenerator.generateCall(ktElement: KtElement, call: CallBuilder, origin: IrStatementOrigin? = null) = - generateCall(ktElement.startOffsetSkippingComments, ktElement.endOffset, call, origin) +fun CallGenerator.generateCall( + ktElement: KtElement, + call: CallBuilder, + origin: IrStatementOrigin? = null, + startOffset: Int = ktElement.startOffsetSkippingComments, + endOffset: Int = ktElement.endOffset, +) = + generateCall(startOffset, endOffset, call, origin) fun CallGenerator.generateCall(irExpression: IrExpression, call: CallBuilder, origin: IrStatementOrigin? = null) = generateCall(irExpression.startOffset, irExpression.endOffset, call, origin) diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/GeneratorExtensions.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/GeneratorExtensions.kt index 970eb19ac54..51a8af1dad9 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/GeneratorExtensions.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/GeneratorExtensions.kt @@ -48,4 +48,35 @@ open class GeneratorExtensions : StubGeneratorExtensions() { open val parametersAreAssignable: Boolean get() = false + + /** + * Enables improved source offsets for the desugared IR generated for + * destructuring declarations. + * + * Local variables defined by destructuring, e.g. + * + * val (x, y) = destructee() + * + * is represented in IR by + * + * block { + * val containerTmp = destructee() + * val x = containerTmp.component1() + * val y = containerTmp.component2() + * } + * + * When [debugInfoOnlyOnVariablesInDestructuringDeclarations] is `false`, the + * access to `containerTmp` in the calls to `component` calls are given source + * positions corresponding to `destructee()` which causes multi-line + * destructuring declarations to step back and forth between the variables being + * declared and the right-hand side, implying the repeated evaluation of the + * right-hand side. + * + * When `true`, only the stores to `x` and `y` in the generated code are are + * given source offsets, the source offsets of `x` and `y` in the original + * declaration, giving fewer, more accurate steps, that are closer to the JVM + * backend in behavior. + */ + open val debugInfoOnlyOnVariablesInDestructuringDeclarations: Boolean + get() = false } diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LoopExpressionGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LoopExpressionGenerator.kt index ad6b251682e..a3d9c5565ac 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LoopExpressionGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/LoopExpressionGenerator.kt @@ -21,6 +21,7 @@ import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrLoop import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.expressions.impl.* +import org.jetbrains.kotlin.ir.util.SYNTHETIC_OFFSET import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.endOffset import org.jetbrains.kotlin.psi.psiUtil.getParentOfType @@ -202,10 +203,16 @@ class LoopExpressionGenerator(statementGenerator: StatementGenerator) : Statemen irInnerBody.statements.add(irLoopParameter) if (ktLoopDestructuringDeclaration != null) { + val firstContainerValue = VariableLValue(context, irLoopParameter) statementGenerator.declareComponentVariablesInBlock( ktLoopDestructuringDeclaration, irInnerBody, - VariableLValue(context, irLoopParameter) + firstContainerValue, + if (context.extensions.debugInfoOnlyOnVariablesInDestructuringDeclarations) { + VariableLValue(context, irLoopParameter, startOffset = SYNTHETIC_OFFSET, endOffset = SYNTHETIC_OFFSET) + } else { + firstContainerValue + } ) } diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/StatementGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/StatementGenerator.kt index 8241b314026..c6c997d4908 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/StatementGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/StatementGenerator.kt @@ -16,6 +16,7 @@ package org.jetbrains.kotlin.psi2ir.generators +import com.intellij.psi.PsiElement import org.jetbrains.kotlin.backend.common.BackendException import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.ir.IrStatement @@ -25,6 +26,7 @@ import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.ir.symbols.IrSymbol +import org.jetbrains.kotlin.ir.util.SYNTHETIC_OFFSET import org.jetbrains.kotlin.ir.util.referenceFunction import org.jetbrains.kotlin.ir.util.render import org.jetbrains.kotlin.psi.* @@ -32,7 +34,8 @@ import org.jetbrains.kotlin.psi.psiUtil.endOffset import org.jetbrains.kotlin.psi.psiUtil.startOffsetSkippingComments import org.jetbrains.kotlin.psi2ir.deparenthesize import org.jetbrains.kotlin.psi2ir.intermediate.IntermediateValue -import org.jetbrains.kotlin.psi2ir.intermediate.createTemporaryVariableInBlock +import org.jetbrains.kotlin.psi2ir.intermediate.VariableLValue +import org.jetbrains.kotlin.psi2ir.intermediate.declareTemporaryVariableInBlock import org.jetbrains.kotlin.psi2ir.intermediate.setExplicitReceiverValue import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.BindingContext.SMARTCAST @@ -110,8 +113,14 @@ class StatementGenerator( ) } + val sourceElement = + if (context.extensions.debugInfoOnlyOnVariablesInDestructuringDeclarations) { + property.nameIdentifier ?: property + } else { + property + } return context.symbolTable.declareVariable( - property.startOffsetSkippingComments, property.endOffset, IrDeclarationOrigin.DEFINED, + sourceElement.startOffsetSkippingComments, sourceElement.endOffset, IrDeclarationOrigin.DEFINED, variableDescriptor, variableDescriptor.type.toIrType(), property.initializer?.let { generateExpression(it) } @@ -128,14 +137,31 @@ class StatementGenerator( .generateLocalDelegatedProperty(ktProperty, ktDelegate, variableDescriptor, scopeOwnerSymbol) override fun visitDestructuringDeclaration(multiDeclaration: KtDestructuringDeclaration, data: Nothing?): IrStatement { + val (blockStartOffset, blockEndOffset) = if (context.extensions.debugInfoOnlyOnVariablesInDestructuringDeclarations) { + SYNTHETIC_OFFSET to SYNTHETIC_OFFSET + } else { + multiDeclaration.startOffsetSkippingComments to multiDeclaration.endOffset + } val irBlock = IrCompositeImpl( - multiDeclaration.startOffsetSkippingComments, multiDeclaration.endOffset, + blockStartOffset, blockEndOffset, context.irBuiltIns.unitType, IrStatementOrigin.DESTRUCTURING_DECLARATION ) val ktInitializer = multiDeclaration.initializer!! - val containerValue = scope.createTemporaryVariableInBlock(context, generateExpression(ktInitializer), irBlock, "container") + val irInitializer = generateExpression(ktInitializer) - declareComponentVariablesInBlock(multiDeclaration, irBlock, containerValue) + val containerVariable = scope.declareTemporaryVariableInBlock(irInitializer, irBlock, nameHint = "container") + + val firstContainerValue = VariableLValue(context, containerVariable) + declareComponentVariablesInBlock( + multiDeclaration, + irBlock, + firstContainerValue, + if (context.extensions.debugInfoOnlyOnVariablesInDestructuringDeclarations) { + VariableLValue(context, containerVariable, startOffset = SYNTHETIC_OFFSET, endOffset = SYNTHETIC_OFFSET) + } else { + firstContainerValue + } + ) return irBlock } @@ -143,26 +169,47 @@ class StatementGenerator( fun declareComponentVariablesInBlock( multiDeclaration: KtDestructuringDeclaration, irBlock: IrStatementContainer, - containerValue: IntermediateValue + firstContainerValue: IntermediateValue, + restContainerValue: IntermediateValue ) { val callGenerator = CallGenerator(this) + + // TODO: Every access to the container value causes a null check even though subsequent checks after the first can be assumed to pass. + var containerValue = firstContainerValue for ((index, ktEntry) in multiDeclaration.entries.withIndex()) { - val componentResolvedCall = getOrFail(BindingContext.COMPONENT_RESOLVED_CALL, ktEntry) - - val componentSubstitutedCall = pregenerateCall(componentResolvedCall) - componentSubstitutedCall.setExplicitReceiverValue(containerValue) - val componentVariable = getOrFail(BindingContext.VARIABLE, ktEntry) // componentN for '_' SHOULD NOT be evaluated if (componentVariable.name.isSpecial) continue + val componentResolvedCall = getOrFail(BindingContext.COMPONENT_RESOLVED_CALL, ktEntry) + val componentSubstitutedCall = pregenerateCall(componentResolvedCall) + + componentSubstitutedCall.setExplicitReceiverValue(containerValue) + + containerValue = restContainerValue + + val (componentCallStartOffset, componentCallEndOffset) = + if (context.extensions.debugInfoOnlyOnVariablesInDestructuringDeclarations) { + SYNTHETIC_OFFSET to SYNTHETIC_OFFSET + } else { + ktEntry.startOffsetSkippingComments to ktEntry.endOffset + } val irComponentCall = callGenerator.generateCall( - ktEntry.startOffsetSkippingComments, ktEntry.endOffset, componentSubstitutedCall, + componentCallStartOffset, componentCallEndOffset, + componentSubstitutedCall, IrStatementOrigin.COMPONENT_N.withIndex(index + 1) ) + + val componentVarOffsetSource: PsiElement = + if (context.extensions.debugInfoOnlyOnVariablesInDestructuringDeclarations) { + ktEntry.nameIdentifier ?: ktEntry + } else { + ktEntry + } val irComponentVar = context.symbolTable.declareVariable( - ktEntry.startOffsetSkippingComments, ktEntry.endOffset, IrDeclarationOrigin.DEFINED, + componentVarOffsetSource.startOffsetSkippingComments, componentVarOffsetSource.endOffset, + IrDeclarationOrigin.DEFINED, componentVariable, componentVariable.type.toIrType(), irComponentCall ) irBlock.statements.add(irComponentVar) diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/RematerializableValue.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/RematerializableValue.kt index 289fd93658b..419a55b1119 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/RematerializableValue.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/RematerializableValue.kt @@ -18,6 +18,7 @@ package org.jetbrains.kotlin.psi2ir.intermediate import org.jetbrains.kotlin.ir.builders.IrGeneratorContext import org.jetbrains.kotlin.ir.builders.Scope +import org.jetbrains.kotlin.ir.declarations.IrVariable import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrStatementContainer import org.jetbrains.kotlin.ir.types.IrType @@ -31,9 +32,26 @@ fun Scope.createTemporaryVariableInBlock( context: IrGeneratorContext, irExpression: IrExpression, block: IrStatementContainer, - nameHint: String? = null + nameHint: String? = null, + startOffset: Int = irExpression.startOffset, + endOffset: Int = irExpression.endOffset ): IntermediateValue { - val temporaryVariable = createTemporaryVariable(irExpression, nameHint) - block.statements.add(temporaryVariable) - return VariableLValue(context, temporaryVariable) + return VariableLValue( + context, + declareTemporaryVariableInBlock(irExpression, block, nameHint, startOffset, endOffset) + ) } + +fun Scope.declareTemporaryVariableInBlock( + irExpression: IrExpression, + block: IrStatementContainer, + nameHint: String? = null, + startOffset: Int = irExpression.startOffset, + endOffset: Int = irExpression.endOffset +): IrVariable { + val temporaryVariable = createTemporaryVariable(irExpression, nameHint, startOffset = startOffset, endOffset = endOffset) + block.statements.add(temporaryVariable) + return temporaryVariable +} + + diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/VariableLValue.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/VariableLValue.kt index 509a6183f67..15552359e9c 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/VariableLValue.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/intermediate/VariableLValue.kt @@ -38,8 +38,14 @@ class VariableLValue( LValue, AssignmentReceiver { - constructor(context: IrGeneratorContext, irVariable: IrVariable, origin: IrStatementOrigin? = null) : - this(context, irVariable.startOffset, irVariable.endOffset, irVariable.symbol, irVariable.type, origin) + constructor( + context: IrGeneratorContext, + irVariable: IrVariable, + origin: IrStatementOrigin? = null, + startOffset: Int = irVariable.startOffset, + endOffset: Int = irVariable.endOffset + ) : + this(context, startOffset, endOffset, irVariable.symbol, irVariable.type, origin) override fun load(): IrExpression = IrGetValueImpl(startOffset, endOffset, type, symbol, origin) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/builders/Scope.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/builders/Scope.kt index 47c6f543778..c8dbc5f1171 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/builders/Scope.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/builders/Scope.kt @@ -16,7 +16,6 @@ package org.jetbrains.kotlin.ir.builders -import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.declarations.IrDeclaration import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin import org.jetbrains.kotlin.ir.declarations.IrDeclarationParent @@ -71,12 +70,14 @@ class Scope(val scopeOwnerSymbol: IrSymbol) { nameHint: String? = null, isMutable: Boolean = false, origin: IrDeclarationOrigin = IrDeclarationOrigin.IR_TEMPORARY_VARIABLE, - irType: IrType? = null + irType: IrType? = null, + startOffset: Int = irExpression.startOffset, + endOffset: Int = irExpression.endOffset ): IrVariable { return createTemporaryVariableDeclaration( irType ?: irExpression.type, nameHint, isMutable, - origin, irExpression.startOffset, irExpression.endOffset + origin, startOffset, endOffset ).apply { initializer = irExpression } diff --git a/compiler/testData/debug/localVariables/assignment.kt b/compiler/testData/debug/localVariables/assignment.kt index 3562b84ca61..1c6e91f4789 100644 --- a/compiler/testData/debug/localVariables/assignment.kt +++ b/compiler/testData/debug/localVariables/assignment.kt @@ -1,5 +1,5 @@ -// IGNORE_BACKEND: JVM_IR // IGNORE_BACKEND_FIR: JVM_IR + // FILE: test.kt fun box(): String { val diff --git a/compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNsMultiline.kt b/compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNsMultiline.kt index 576b16ca647..03028a4704d 100644 --- a/compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNsMultiline.kt +++ b/compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNsMultiline.kt @@ -1,5 +1,5 @@ // IGNORE_BACKEND_FIR: JVM_IR -// IGNORE_BACKEND: JVM_IR + // FILE: test.kt class MyPair(val x: String, val y: String) { operator fun component1(): String { diff --git a/compiler/testData/debug/localVariables/destructuring/assignmentMultiline.kt b/compiler/testData/debug/localVariables/destructuring/assignmentMultiline.kt index 8c465f9f1fe..2b33be2bf4d 100644 --- a/compiler/testData/debug/localVariables/destructuring/assignmentMultiline.kt +++ b/compiler/testData/debug/localVariables/destructuring/assignmentMultiline.kt @@ -1,6 +1,6 @@ // WITH_STDLIB // IGNORE_BACKEND_FIR: JVM_IR -// IGNORE_BACKEND: JVM_IR + // FILE: test.kt fun box(): String { val p = "O" to "K" diff --git a/compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNamesMultiline.kt b/compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNamesMultiline.kt index 2d799290d5b..794c767bdd7 100644 --- a/compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNamesMultiline.kt +++ b/compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNamesMultiline.kt @@ -1,6 +1,6 @@ // WITH_STDLIB // IGNORE_BACKEND_FIR: JVM_IR -// IGNORE_BACKEND: JVM_IR + // FILE: test.kt fun box(): String { val p = Triple("X","O","K") diff --git a/compiler/testData/debug/localVariables/destructuring/lambdaCustomComponentNsMultiline.kt b/compiler/testData/debug/localVariables/destructuring/lambdaCustomComponentNsMultiline.kt index 80dc6eb8640..560b8d1ee1c 100644 --- a/compiler/testData/debug/localVariables/destructuring/lambdaCustomComponentNsMultiline.kt +++ b/compiler/testData/debug/localVariables/destructuring/lambdaCustomComponentNsMultiline.kt @@ -49,11 +49,9 @@ fun box() { // test.kt:17 box: // test.kt:14 foo: a:MyPair=MyPair, block:kotlin.jvm.functions.Function1=TestKt$box$1 // test.kt:19 invoke: -// test.kt:20 invoke: // test.kt:6 component1: // test.kt:20 invoke: // test.kt:19 invoke: x:java.lang.String="O":java.lang.String -// test.kt:22 invoke: x:java.lang.String="O":java.lang.String // test.kt:10 component2: // test.kt:22 invoke: x:java.lang.String="O":java.lang.String // test.kt:25 invoke: x:java.lang.String="O":java.lang.String, y:java.lang.String="K":java.lang.String diff --git a/compiler/testData/debug/stepping/localProperty.kt b/compiler/testData/debug/stepping/localProperty.kt new file mode 100644 index 00000000000..30edad2bf81 --- /dev/null +++ b/compiler/testData/debug/stepping/localProperty.kt @@ -0,0 +1,21 @@ +// IGNORE_BACKEND_FIR: JVM_IR + +// FILE: test.kt +fun box(): String { + val + o + = + "O" + + + val k = "K" + + return o + k +} + +// EXPECTATIONS + +// test.kt:8 box +// test.kt:6 box +// test.kt:11 box +// test.kt:13 box \ No newline at end of file diff --git a/compiler/testData/ir/sourceRanges/kt24258.txt b/compiler/testData/ir/sourceRanges/kt24258.txt index b168ecfeb0a..4fe61650207 100644 --- a/compiler/testData/ir/sourceRanges/kt24258.txt +++ b/compiler/testData/ir/sourceRanges/kt24258.txt @@ -18,5 +18,5 @@ @3:27..53 PROPERTY_REFERENCE 'public final lazyNullString: kotlin.String [delegated,val]' field=null getter='public final fun (): kotlin.String declared in ' setter=null type=kotlin.reflect.KProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE @5:0..7:1 FUN name:testLazyNullString visibility:public modality:FINAL <> () returnType:kotlin.Unit @5:25..7:1 BLOCK_BODY - @6:4..34 VAR name:s type:kotlin.String [val] + @6:8..9 VAR name:s type:kotlin.String [val] @6:20..34 CALL 'public final fun (): kotlin.String declared in ' type=kotlin.String origin=GET_PROPERTY diff --git a/compiler/testData/ir/sourceRanges/postfixIncrementDecrement.txt b/compiler/testData/ir/sourceRanges/postfixIncrementDecrement.txt index 58387d5c1b9..f7aad373188 100644 --- a/compiler/testData/ir/sourceRanges/postfixIncrementDecrement.txt +++ b/compiler/testData/ir/sourceRanges/postfixIncrementDecrement.txt @@ -1,9 +1,9 @@ @0:0..6:0 FILE fqName: fileName:/postfixIncrementDecrement.kt @0:0..5:1 FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit @0:11..5:1 BLOCK_BODY - @1:4..13 VAR name:x type:kotlin.Int [var] + @1:8..9 VAR name:x type:kotlin.Int [var] @1:12..13 CONST Int type=kotlin.Int value=0 - @2:4..13 VAR name:y type:kotlin.Int [var] + @2:8..9 VAR name:y type:kotlin.Int [var] @2:12..13 CONST Int type=kotlin.Int value=0 @3:4..5 SET_VAR 'var y: kotlin.Int [var] declared in .test' type=kotlin.Unit origin=EQ @3:8..11 BLOCK type=kotlin.Int origin=POSTFIX_INCR diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSteppingTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSteppingTestGenerated.java index 85d759c7fcc..1774aeb42ce 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSteppingTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSteppingTestGenerated.java @@ -313,6 +313,12 @@ public class IrSteppingTestGenerated extends AbstractIrSteppingTest { runTest("compiler/testData/debug/stepping/localFunctionWIthOnelineExpressionBody.kt"); } + @Test + @TestMetadata("localProperty.kt") + public void testLocalProperty() throws Exception { + runTest("compiler/testData/debug/stepping/localProperty.kt"); + } + @Test @TestMetadata("multilineExpression.kt") public void testMultilineExpression() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/SteppingTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/SteppingTestGenerated.java index f040fca486d..976666dc02e 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/SteppingTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/SteppingTestGenerated.java @@ -313,6 +313,12 @@ public class SteppingTestGenerated extends AbstractSteppingTest { runTest("compiler/testData/debug/stepping/localFunctionWIthOnelineExpressionBody.kt"); } + @Test + @TestMetadata("localProperty.kt") + public void testLocalProperty() throws Exception { + runTest("compiler/testData/debug/stepping/localProperty.kt"); + } + @Test @TestMetadata("multilineExpression.kt") public void testMultilineExpression() throws Exception {