[IR+Tests] Improve Local Function Debugging Experience
This change improves the debugging experience around local functions on the IR backend. The changes include moving old checkLocalVariablesTable (cLVT) tests to the new stepping/local variable infrastructure in order to refine the tests and further define the behavior of the two JVM backends, and their differences. The primary ported test case is cLVT/localFun.kt that documents the discrepancy in implementation strategy for local functions on the two backends. The old backend implements local functions as lambdas assigned to a local variable while the IR backend lifts them out as static funtions on the surrounding class. The discrepancies and their consequences are documented in bytecodeListing, idea-stepping, localVariableTable and debugStepping tests. The only _code change_ is disabling the captured variable name mangling for captured variables on the IR backend. Captured variables are passed as arguments to the static function, so in the debugger, they really just are local variables. For them to show properly in the debugger and be detectable by evaluate expression, they simply need no mangling. Finally, this change cleans 3 redundant cLVT tests, copyFunction.kt and destructuringInlineLambda.kt and destructuringInFor.kt, that are all covered in the new suite. The stepping behavior needs to be made precise around for loops, but that is an entirely seperate issue.
This commit is contained in:
committed by
max-kammerer
parent
c2d7b69e5f
commit
43b61a618d
+5
@@ -155,6 +155,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/kt43519.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("localFunction.kt")
|
||||
public void testLocalFunction() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/localFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("localFunctionInInitBlock.kt")
|
||||
public void testLocalFunctionInInitBlock() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/localFunctionInInitBlock.kt");
|
||||
|
||||
Generated
-20
@@ -30,26 +30,11 @@ public class CheckLocalVariablesTableTestGenerated extends AbstractCheckLocalVar
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/checkLocalVariablesTable"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("copyFunction.kt")
|
||||
public void testCopyFunction() throws Exception {
|
||||
runTest("compiler/testData/checkLocalVariablesTable/copyFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("destructuringInFor.kt")
|
||||
public void testDestructuringInFor() throws Exception {
|
||||
runTest("compiler/testData/checkLocalVariablesTable/destructuringInFor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("destructuringInLambdas.kt")
|
||||
public void testDestructuringInLambdas() throws Exception {
|
||||
runTest("compiler/testData/checkLocalVariablesTable/destructuringInLambdas.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("destructuringInlineLambda.kt")
|
||||
public void testDestructuringInlineLambda() throws Exception {
|
||||
runTest("compiler/testData/checkLocalVariablesTable/destructuringInlineLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineLambdaWithItParam.kt")
|
||||
public void testInlineLambdaWithItParam() throws Exception {
|
||||
runTest("compiler/testData/checkLocalVariablesTable/inlineLambdaWithItParam.kt");
|
||||
@@ -90,11 +75,6 @@ public class CheckLocalVariablesTableTestGenerated extends AbstractCheckLocalVar
|
||||
runTest("compiler/testData/checkLocalVariablesTable/lambdaAsVar.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("localFun.kt")
|
||||
public void testLocalFun() throws Exception {
|
||||
runTest("compiler/testData/checkLocalVariablesTable/localFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("objectInLocalPropertyDelegate.kt")
|
||||
public void testObjectInLocalPropertyDelegate() throws Exception {
|
||||
runTest("compiler/testData/checkLocalVariablesTable/objectInLocalPropertyDelegate.kt");
|
||||
|
||||
Generated
+12
@@ -56,6 +56,12 @@ public class IrLocalVariableTestGenerated extends AbstractIrLocalVariableTest {
|
||||
runTest("compiler/testData/debug/localVariables/destructuringInLambdas.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyFun.kt")
|
||||
public void testEmptyFun() throws Exception {
|
||||
runTest("compiler/testData/debug/localVariables/emptyFun.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineProperty.kt")
|
||||
public void testInlineProperty() throws Exception {
|
||||
@@ -74,6 +80,12 @@ public class IrLocalVariableTestGenerated extends AbstractIrLocalVariableTest {
|
||||
runTest("compiler/testData/debug/localVariables/localFun.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localFunUnused.kt")
|
||||
public void testLocalFunUnused() throws Exception {
|
||||
runTest("compiler/testData/debug/localVariables/localFunUnused.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("underscoreNames.kt")
|
||||
public void testUnderscoreNames() throws Exception {
|
||||
|
||||
Generated
+6
@@ -266,6 +266,12 @@ public class IrSteppingTestGenerated extends AbstractIrSteppingTest {
|
||||
runTest("compiler/testData/debug/stepping/localFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localFunctionWIthOnelineExpressionBody.kt")
|
||||
public void testLocalFunctionWIthOnelineExpressionBody() throws Exception {
|
||||
runTest("compiler/testData/debug/stepping/localFunctionWIthOnelineExpressionBody.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("multilineFunctionCall.kt")
|
||||
public void testMultilineFunctionCall() throws Exception {
|
||||
|
||||
Generated
+12
@@ -56,6 +56,12 @@ public class LocalVariableTestGenerated extends AbstractLocalVariableTest {
|
||||
runTest("compiler/testData/debug/localVariables/destructuringInLambdas.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("emptyFun.kt")
|
||||
public void testEmptyFun() throws Exception {
|
||||
runTest("compiler/testData/debug/localVariables/emptyFun.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inlineProperty.kt")
|
||||
public void testInlineProperty() throws Exception {
|
||||
@@ -74,6 +80,12 @@ public class LocalVariableTestGenerated extends AbstractLocalVariableTest {
|
||||
runTest("compiler/testData/debug/localVariables/localFun.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localFunUnused.kt")
|
||||
public void testLocalFunUnused() throws Exception {
|
||||
runTest("compiler/testData/debug/localVariables/localFunUnused.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("underscoreNames.kt")
|
||||
public void testUnderscoreNames() throws Exception {
|
||||
|
||||
Generated
+6
@@ -266,6 +266,12 @@ public class SteppingTestGenerated extends AbstractSteppingTest {
|
||||
runTest("compiler/testData/debug/stepping/localFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localFunctionWIthOnelineExpressionBody.kt")
|
||||
public void testLocalFunctionWIthOnelineExpressionBody() throws Exception {
|
||||
runTest("compiler/testData/debug/stepping/localFunctionWIthOnelineExpressionBody.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("multilineFunctionCall.kt")
|
||||
public void testMultilineFunctionCall() throws Exception {
|
||||
|
||||
+5
@@ -155,6 +155,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes
|
||||
runTest("compiler/testData/codegen/bytecodeListing/kt43519.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("localFunction.kt")
|
||||
public void testLocalFunction() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/localFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("localFunctionInInitBlock.kt")
|
||||
public void testLocalFunctionInInitBlock() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/localFunctionInInitBlock.kt");
|
||||
|
||||
Generated
-20
@@ -30,26 +30,11 @@ public class IrCheckLocalVariablesTableTestGenerated extends AbstractIrCheckLoca
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/checkLocalVariablesTable"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("copyFunction.kt")
|
||||
public void testCopyFunction() throws Exception {
|
||||
runTest("compiler/testData/checkLocalVariablesTable/copyFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("destructuringInFor.kt")
|
||||
public void testDestructuringInFor() throws Exception {
|
||||
runTest("compiler/testData/checkLocalVariablesTable/destructuringInFor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("destructuringInLambdas.kt")
|
||||
public void testDestructuringInLambdas() throws Exception {
|
||||
runTest("compiler/testData/checkLocalVariablesTable/destructuringInLambdas.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("destructuringInlineLambda.kt")
|
||||
public void testDestructuringInlineLambda() throws Exception {
|
||||
runTest("compiler/testData/checkLocalVariablesTable/destructuringInlineLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineLambdaWithItParam.kt")
|
||||
public void testInlineLambdaWithItParam() throws Exception {
|
||||
runTest("compiler/testData/checkLocalVariablesTable/inlineLambdaWithItParam.kt");
|
||||
@@ -90,11 +75,6 @@ public class IrCheckLocalVariablesTableTestGenerated extends AbstractIrCheckLoca
|
||||
runTest("compiler/testData/checkLocalVariablesTable/lambdaAsVar.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("localFun.kt")
|
||||
public void testLocalFun() throws Exception {
|
||||
runTest("compiler/testData/checkLocalVariablesTable/localFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("objectInLocalPropertyDelegate.kt")
|
||||
public void testObjectInLocalPropertyDelegate() throws Exception {
|
||||
runTest("compiler/testData/checkLocalVariablesTable/objectInLocalPropertyDelegate.kt");
|
||||
|
||||
Reference in New Issue
Block a user