diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt index 627d2a4eaee..3cc9624f986 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt @@ -1252,8 +1252,7 @@ private fun updateLvtAccordingToLiveness(method: MethodNode, isForNamedFunction: for (insnIndex in 0 until (method.instructions.size() - 1)) { val insn = method.instructions[insnIndex] if (!isAlive(insnIndex, variableIndex) && isAlive(insnIndex + 1, variableIndex)) { - val lvtRecord = oldLvt.findRecord(insnIndex, variableIndex) ?: continue - startLabel = max(lvtRecord.start, previousSuspensionPointLabel(insn)) + startLabel = insn as? LabelNode ?: insn.findNextOrNull { it is LabelNode } as? LabelNode } if (isAlive(insnIndex, variableIndex) && !isAlive(insnIndex + 1, variableIndex)) { // No variable in LVT -> do not add one diff --git a/compiler/testData/codegen/bytecodeText/coroutines/debug/localVariableCorrectLabel.kt b/compiler/testData/codegen/bytecodeText/coroutines/debug/localVariableCorrectLabel.kt index 9d69e09e4c0..d77fe4f3fa7 100644 --- a/compiler/testData/codegen/bytecodeText/coroutines/debug/localVariableCorrectLabel.kt +++ b/compiler/testData/codegen/bytecodeText/coroutines/debug/localVariableCorrectLabel.kt @@ -15,7 +15,7 @@ fun main(args: Array) { suspend fun SequenceScope.awaitSeq(): Int = 42 -// 1 LOCALVARIABLE a I L[0-9]+ L4 +// 1 LOCALVARIABLE a I L[0-9]+ L19 /* TODO: JVM_IR does not generate LINENUMBER at the end of the lambda */ // JVM_TEMPLATES