Skip to content

Commit 59a349a

Browse files
committed
Test breakpoint is hit inside crossinline lambda called from anonymous object (KT-12612)
#KT-12612 Fixed
1 parent 23428c9 commit 59a349a

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
LineBreakpoint created at stopInLabdaOfCrossinlineCalledInAnonymous.kt:21
2+
!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !OUTPUT_PATH!;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! stopInLabdaOfCrossinlineCalledInAnonymous.StopInLabdaOfCrossinlineCalledInAnonymousKt
3+
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
4+
stopInLabdaOfCrossinlineCalledInAnonymous.kt:21
5+
stopInLabdaOfCrossinlineCalledInAnonymous.kt:22
6+
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
7+
8+
Process finished with exit code 0
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package stopInLabdaOfCrossinlineCalledInAnonymous
2+
3+
// KT-12612
4+
5+
class C {}
6+
interface D {
7+
fun run()
8+
}
9+
10+
inline fun C.bar(crossinline lambda: () -> Unit) {
11+
object: D {
12+
override fun run() {
13+
lambda()
14+
}
15+
}.run()
16+
}
17+
18+
fun foo(c: C) {
19+
c.bar {
20+
//Breakpoint!
21+
nop()
22+
nop()
23+
}
24+
}
25+
26+
fun main(args: Array<String>) {
27+
foo(C())
28+
}
29+
30+
fun nop() {}

idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,12 @@ public void testStopInInlineInOtherFileWithLambdaArgumentDex() throws Exception
721721
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInInlineInOtherFileWithLambdaArgumentDex.kt");
722722
doStepOverTest(fileName);
723723
}
724+
725+
@TestMetadata("stopInLabdaOfCrossinlineCalledInAnonymous.kt")
726+
public void testStopInLabdaOfCrossinlineCalledInAnonymous() throws Exception {
727+
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInLabdaOfCrossinlineCalledInAnonymous.kt");
728+
doStepOverTest(fileName);
729+
}
724730
}
725731

726732
@TestMetadata("idea/testData/debugger/tinyApp/src/stepping/filters")

0 commit comments

Comments
 (0)