diff --git a/ChangeLog.md b/ChangeLog.md index ecc801f9cb6..db87996d65a 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -97,6 +97,12 @@ These artifacts include extensions for the types available in the latter JDKs, s - [`KT-12830`](https://youtrack.jetbrains.com/issue/KT-12830) Remove spaces before *?* in nullable types +#### Debugger + +###### Issues fixed + +- [`KT-13059`](https://youtrack.jetbrains.com/issue/KT-13059) Fix error stepping on *Step Over* action in the end of while block + ## 1.0.3 ### Compiler diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index 7b212c870fd..bc7aa0bab2c 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -528,6 +528,7 @@ public class ExpressionCodegen extends KtVisitor impleme generateLoopBody(expression.getBody()); + markStartLineNumber(expression); v.goTo(condition); v.mark(end); diff --git a/compiler/testData/lineNumber/custom/beforeGotoToWhileStart.kt b/compiler/testData/lineNumber/custom/beforeGotoToWhileStart.kt new file mode 100644 index 00000000000..0cb7ee0dfd4 --- /dev/null +++ b/compiler/testData/lineNumber/custom/beforeGotoToWhileStart.kt @@ -0,0 +1,13 @@ +fun foo() { + while (true) { + if (testSome()) { + break + } + } +} + +fun testSome(): Boolean { + return false +} + +// 2 3 4 2 7 10 \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LineNumberTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LineNumberTestGenerated.java index 9e5e272637a..6dade8bb30f 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LineNumberTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LineNumberTestGenerated.java @@ -148,6 +148,12 @@ public class LineNumberTestGenerated extends AbstractLineNumberTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/lineNumber/custom"), Pattern.compile("^(.+)\\.kt$"), true); } + @TestMetadata("beforeGotoToWhileStart.kt") + public void testBeforeGotoToWhileStart() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/lineNumber/custom/beforeGotoToWhileStart.kt"); + doTestCustom(fileName); + } + @TestMetadata("callWithCallInArguments.kt") public void testCallWithCallInArguments() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/lineNumber/custom/callWithCallInArguments.kt"); diff --git a/idea/testData/debugger/tinyApp/outs/stepOverFalseConditionInLastIfInWhile.out b/idea/testData/debugger/tinyApp/outs/stepOverFalseConditionInLastIfInWhile.out new file mode 100644 index 00000000000..7e31411b77d --- /dev/null +++ b/idea/testData/debugger/tinyApp/outs/stepOverFalseConditionInLastIfInWhile.out @@ -0,0 +1,8 @@ +LineBreakpoint created at stepOverFalseConditionInLastIfInWhile.kt:13 +!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! stepOverFalseConditionInLastIfInWhile.StepOverFalseConditionInLastIfInWhileKt +Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' +stepOverFalseConditionInLastIfInWhile.kt:13 +stepOverFalseConditionInLastIfInWhile.kt:6 +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/stepOverWhileWithInline.out b/idea/testData/debugger/tinyApp/outs/stepOverWhileWithInline.out index 092255b022e..03ac05a7328 100644 --- a/idea/testData/debugger/tinyApp/outs/stepOverWhileWithInline.out +++ b/idea/testData/debugger/tinyApp/outs/stepOverWhileWithInline.out @@ -29,7 +29,6 @@ stepOverWhileWithInline.kt:30 stepOverWhileWithInline.kt:35 stepOverWhileWithInline.kt:41 stepOverWhileWithInline.kt:35 -stepOverWhileWithInline.kt:36 stepOverWhileWithInline.kt:38 Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' diff --git a/idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverFalseConditionInLastIfInWhile.kt b/idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverFalseConditionInLastIfInWhile.kt new file mode 100644 index 00000000000..c722a95ace1 --- /dev/null +++ b/idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverFalseConditionInLastIfInWhile.kt @@ -0,0 +1,23 @@ +package stepOverFalseConditionInLastIfInWhile + +fun main(args: Array) { + var i = 0 + + while (true) { + if (i > 0) { + break + } + i++ + + //Breakpoint! + if (testSome()) { + some() + } + } +} + +fun testSome(): Boolean { + return false +} + +fun some() {} \ 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 23ed8f5ecd3..0a12ac00779 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java @@ -385,6 +385,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest { doStepOverTest(fileName); } + @TestMetadata("stepOverFalseConditionInLastIfInWhile.kt") + public void testStepOverFalseConditionInLastIfInWhile() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverFalseConditionInLastIfInWhile.kt"); + doStepOverTest(fileName); + } + @TestMetadata("stepOverForWithInline.kt") public void testStepOverForWithInline() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverForWithInline.kt");