Debugger: add tests for accessing outer class members from lambda inside inner class
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
LineBreakpoint created at funFromOuterClassInLamdba.kt:20
|
||||||
|
LineBreakpoint created at funFromOuterClassInLamdba.kt:28
|
||||||
|
LineBreakpoint created at funFromOuterClassInLamdba.kt:36
|
||||||
|
!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !APP_PATH!\classes;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! funFromOuterClassInLamdba.FunFromOuterClassInLamdbaPackage
|
||||||
|
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||||
|
funFromOuterClassInLamdba.kt:20
|
||||||
|
Compile bytecode for foo() + 1
|
||||||
|
funFromOuterClassInLamdba.kt:28
|
||||||
|
Compile bytecode for foo() + 2
|
||||||
|
funFromOuterClassInLamdba.kt:36
|
||||||
|
Compile bytecode for foo() + 3
|
||||||
|
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||||
|
|
||||||
|
Process finished with exit code 0
|
||||||
+42
@@ -0,0 +1,42 @@
|
|||||||
|
package funFromOuterClassInLamdba
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
Outer().Inner().test()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Outer {
|
||||||
|
fun foo() = 1
|
||||||
|
|
||||||
|
inner class Inner {
|
||||||
|
fun innerFun() = 1
|
||||||
|
fun test() {
|
||||||
|
fun f() = 1
|
||||||
|
|
||||||
|
// outer is captured in lambda
|
||||||
|
lambda {
|
||||||
|
// EXPRESSION: foo() + 1
|
||||||
|
// RESULT: 2: I
|
||||||
|
//Breakpoint!
|
||||||
|
val a = foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
// outer isn't captured in lambda
|
||||||
|
lambda {
|
||||||
|
// EXPRESSION: foo() + 2
|
||||||
|
// RESULT: Cannot find local variable: name = this
|
||||||
|
//Breakpoint!
|
||||||
|
val a = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
// inner is captured in lambda
|
||||||
|
lambda {
|
||||||
|
// EXPRESSION: foo() + 3
|
||||||
|
// RESULT: 4: I
|
||||||
|
//Breakpoint!
|
||||||
|
val a = innerFun()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun lambda(f: () -> Unit) = f()
|
||||||
+6
@@ -488,6 +488,12 @@ public class KotlinEvaluateExpressionTestGenerated extends AbstractKotlinEvaluat
|
|||||||
doMultipleBreakpointsTest(fileName);
|
doMultipleBreakpointsTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("funFromOuterClassInLamdba.kt")
|
||||||
|
public void testFunFromOuterClassInLamdba() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/evaluate/multipleBreakpoints/funFromOuterClassInLamdba.kt");
|
||||||
|
doMultipleBreakpointsTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("whenEntry.kt")
|
@TestMetadata("whenEntry.kt")
|
||||||
public void testWhenEntry() throws Exception {
|
public void testWhenEntry() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/evaluate/multipleBreakpoints/whenEntry.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/evaluate/multipleBreakpoints/whenEntry.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user