Debugger: Fix evaluation of function declarations with expression bodies (KT-32704)

Before this commit, the substituted FunctionDescriptor didn't have a source element.
As a result, 'CodeFragmentParameterAnalyzer.isCodeFragmentDeclaration' failed to recognize such a descriptor as fragment-local, and it was erroneously captured.
This commit is contained in:
Yan Zhulanow
2019-10-10 21:30:10 +09:00
parent fa45122c6b
commit 87e0a2d98c
7 changed files with 36 additions and 5 deletions
@@ -190,6 +190,11 @@ public class KotlinEvaluateExpressionTestGenerated extends AbstractKotlinEvaluat
runTest("idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/functionDeclaration.kt");
}
@TestMetadata("functionWithBodyExpression.kt")
public void testFunctionWithBodyExpression() throws Exception {
runTest("idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/functionWithBodyExpression.kt");
}
@TestMetadata("genericCrossinlineArgument.kt")
public void testGenericCrossinlineArgument() throws Exception {
runTest("idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/genericCrossinlineArgument.kt");
@@ -0,0 +1,6 @@
package functionWithBodyExpression
fun main() {
//Breakpoint!
val a = 5
}
@@ -0,0 +1,4 @@
fun f2() = "f2"
f2()
// RESULT: "f2": Ljava/lang/String;
@@ -0,0 +1,11 @@
LineBreakpoint created at functionWithBodyExpression.kt:5
Run Java
Connected to the target VM
functionWithBodyExpression.kt:5
Compile bytecode for fun f2() = "f2"
f2()
// RESULT: "f2": Ljava/lang/String;
Disconnected from the target VM
Process finished with exit code 0