diff --git a/idea/src/org/jetbrains/kotlin/idea/debugger/DebuggerClassNameProvider.kt b/idea/src/org/jetbrains/kotlin/idea/debugger/DebuggerClassNameProvider.kt index b8df586a111..9d101e6e621 100644 --- a/idea/src/org/jetbrains/kotlin/idea/debugger/DebuggerClassNameProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/debugger/DebuggerClassNameProvider.kt @@ -414,7 +414,7 @@ private fun isInlineCall(context: BindingContext, expr: KtCallExpression): Boole return InlineUtil.isInline(resolvedCall.resultingDescriptor) } -private inline fun PsiElement.typedParent(): T? = getStrictParentOfType() +private inline fun PsiElement.typedParent(): T? = parent as? T private fun String.substringIndex(): String { if (lastIndexOf("$") < 0) return this diff --git a/idea/testData/debugger/tinyApp/outs/stopInInlineUnderOtherCall.out b/idea/testData/debugger/tinyApp/outs/stopInInlineUnderOtherCall.out new file mode 100644 index 00000000000..44df4ef7ba0 --- /dev/null +++ b/idea/testData/debugger/tinyApp/outs/stopInInlineUnderOtherCall.out @@ -0,0 +1,8 @@ +LineBreakpoint created at stopInInlineUnderOtherCall.kt:11 +!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! stopInInlineUnderOtherCall.StopInInlineUnderOtherCallKt +Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' +stopInInlineUnderOtherCall.kt:11 +stopInInlineUnderOtherCall.kt:12 +Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' + +Process finished with exit code 0 diff --git a/idea/testData/debugger/tinyApp/outs/stopInInlineUnderSamConversion.out b/idea/testData/debugger/tinyApp/outs/stopInInlineUnderSamConversion.out new file mode 100644 index 00000000000..792bb5c2d3b --- /dev/null +++ b/idea/testData/debugger/tinyApp/outs/stopInInlineUnderSamConversion.out @@ -0,0 +1,8 @@ +LineBreakpoint created at stopInInlineUnderSamConversion.kt:12 +!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! stopInInlineUnderSamConversion.StopInInlineUnderSamConversionKt +Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' +stopInInlineUnderSamConversion.kt:12 +stopInInlineUnderSamConversion.kt:13 +Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' + +Process finished with exit code 0 diff --git a/idea/testData/debugger/tinyApp/src/forTests/SamConversion.java b/idea/testData/debugger/tinyApp/src/forTests/SamConversion.java new file mode 100644 index 00000000000..2080be6f74a --- /dev/null +++ b/idea/testData/debugger/tinyApp/src/forTests/SamConversion.java @@ -0,0 +1,11 @@ +package forTests; + +public class SamConversion { + public interface Runnable { + public abstract void run(); + } + + public static void doAction(Runnable runnable) { + runnable.run(); + } +} \ No newline at end of file diff --git a/idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInInlineUnderOtherCall.kt b/idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInInlineUnderOtherCall.kt new file mode 100644 index 00000000000..4689ad7715a --- /dev/null +++ b/idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInInlineUnderOtherCall.kt @@ -0,0 +1,26 @@ +package stopInInlineUnderOtherCall + +fun main(args: Array) { + val a = 1 + + nonInline( + { + inlineCall { + { + //Breakpoint! + foo(a) + }() + } + } + ) +} + +fun foo(a: Any) {} + +fun nonInline(f: () -> Unit) { + f() +} + +inline fun inlineCall(f: () -> Unit) { + f() +} \ No newline at end of file diff --git a/idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInInlineUnderSamConversion.kt b/idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInInlineUnderSamConversion.kt new file mode 100644 index 00000000000..d9d70654d15 --- /dev/null +++ b/idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInInlineUnderSamConversion.kt @@ -0,0 +1,22 @@ +package stopInInlineUnderSamConversion + +import forTests.SamConversion + +fun main(args: Array) { + val a = 1 + + SamConversion.doAction({ + inlineCall { + { + //Breakpoint! + foo(a) + }() + } + }) +} + +fun foo(a: Any) {} + +inline fun inlineCall(f: () -> Unit) { + f() +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java index 28a7ec087d9..defbc278132 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java @@ -746,6 +746,18 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest { doStepOverTest(fileName); } + @TestMetadata("stopInInlineUnderOtherCall.kt") + public void testStopInInlineUnderOtherCall() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInInlineUnderOtherCall.kt"); + doStepOverTest(fileName); + } + + @TestMetadata("stopInInlineUnderSamConversion.kt") + public void testStopInInlineUnderSamConversion() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInInlineUnderSamConversion.kt"); + doStepOverTest(fileName); + } + @TestMetadata("stopInInlinedInSpecialNamedFun.kt") public void testStopInInlinedInSpecialNamedFun() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInInlinedInSpecialNamedFun.kt");