mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
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.