From 203cab8d1b4c8b1bc60ab85c889b1876e43f1ec7 Mon Sep 17 00:00:00 2001 From: Natalia Ukhorskaya Date: Fri, 15 Jan 2016 16:43:20 +0300 Subject: [PATCH] Debugger: fix step over for if with inline function call without lambda arguments --- .../stepping/KotlinSteppingCommandProvider.kt | 4 ++++ .../debugger/tinyApp/outs/stepOverIfWithInline.out | 11 +++++++---- .../src/stepping/stepOver/stepOverIfWithInline.kt | 12 +++++++++++- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinSteppingCommandProvider.kt b/idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinSteppingCommandProvider.kt index 6a4bb65eb9a..7758ed79429 100644 --- a/idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinSteppingCommandProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinSteppingCommandProvider.kt @@ -87,6 +87,10 @@ class KotlinSteppingCommandProvider: JvmSteppingCommandProvider() { return null } + if (inlineArguments.isEmpty() && inlineFunctionCalls.any { it.shouldNotUseStepOver(sourcePosition.elementAt) }) { + return null + } + val additionalElementsToSkip = sourcePosition.elementAt.getAdditionalElementsToSkip() return DebuggerSteppingHelper.createStepOverCommand(suspendContext, ignoreBreakpoints, file, linesRange, inlineArguments, additionalElementsToSkip) diff --git a/idea/testData/debugger/tinyApp/outs/stepOverIfWithInline.out b/idea/testData/debugger/tinyApp/outs/stepOverIfWithInline.out index 117969fe96f..ad7ffbb00be 100644 --- a/idea/testData/debugger/tinyApp/outs/stepOverIfWithInline.out +++ b/idea/testData/debugger/tinyApp/outs/stepOverIfWithInline.out @@ -9,21 +9,24 @@ stepOverIfWithInline.kt:15 stepOverIfWithInline.kt:18 stepOverIfWithInline.kt:15 stepOverIfWithInline.kt:21 -stepOverIfWithInline.kt:41 +stepOverIfWithInline.kt:46 stepOverIfWithInline.kt:21 stepOverIfWithInline.kt:24 stepOverIfWithInline.kt:25 stepOverIfWithInline.kt:24 stepOverIfWithInline.kt:28 -stepOverIfWithInline.kt:41 +stepOverIfWithInline.kt:46 stepOverIfWithInline.kt:28 stepOverIfWithInline.kt:28 stepOverIfWithInline.kt:32 -stepOverIfWithInline.kt:41 +stepOverIfWithInline.kt:46 stepOverIfWithInline.kt:32 stepOverIfWithInline.kt:36 stepOverIfWithInline.kt:32 -stepOverIfWithInline.kt:38 +stepOverIfWithInline.kt:40 +stepOverIfWithInline.kt:53 +stepOverIfWithInline.kt:54 +stepOverIfWithInline.kt:43 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/stepping/stepOver/stepOverIfWithInline.kt b/idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverIfWithInline.kt index c369931606d..563a65a98d1 100644 --- a/idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverIfWithInline.kt +++ b/idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverIfWithInline.kt @@ -35,6 +35,11 @@ fun main(args: Array) { else { foo { test(1) } } + + // Reified function call in if condition + if (reified(1) != 1) { + val a = 1 + } } inline fun foo(f: () -> Int): Int { @@ -44,4 +49,9 @@ inline fun foo(f: () -> Int): Int { fun test(i: Int) = 1 -// STEP_OVER: 22 \ No newline at end of file +inline fun reified(f: T): Int { + val a = 1 + return 1 +} + +// STEP_OVER: 25 \ No newline at end of file