IR: fix offsets in irTemporary

The variable generated by IrStatementBuilder.irTemporary doesn't inherit
startOffset and endOffset from the builder. In particular, as a result,
temporary variables generated for elvis operator left operand have
UNDEFINED_OFFSET.

Additionally, ProvisionalFunctionExpressionLowering copies the offsets
of a variable to lowered lambda in the variable initializer. With the
problem described above, this causes invalid debug information in
Kotlin/Native, see KT-49360.

Fix irTemporary by using builder's offsets for the variable.

^KT-49360 Fixed
This commit is contained in:
Svyatoslav Scherbina
2021-11-12 11:45:09 +03:00
committed by Space
parent fb859c0270
commit 2f5706597a
8 changed files with 181 additions and 1 deletions
@@ -39,6 +39,11 @@ public class IrSourceRangesTestCaseGenerated extends AbstractIrSourceRangesTestC
runTest("compiler/testData/ir/sourceRanges/comments.kt");
}
@TestMetadata("elvis.kt")
public void testElvis() throws Exception {
runTest("compiler/testData/ir/sourceRanges/elvis.kt");
}
@TestMetadata("kt17108.kt")
public void testKt17108() throws Exception {
runTest("compiler/testData/ir/sourceRanges/kt17108.kt");
@@ -49,6 +54,11 @@ public class IrSourceRangesTestCaseGenerated extends AbstractIrSourceRangesTestC
runTest("compiler/testData/ir/sourceRanges/kt24258.kt");
}
@TestMetadata("postfixIncrementDecrement.kt")
public void testPostfixIncrementDecrement() throws Exception {
runTest("compiler/testData/ir/sourceRanges/postfixIncrementDecrement.kt");
}
@TestMetadata("compiler/testData/ir/sourceRanges/declarations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)