Debugger: Fix "Step over" with inline function calls in non-functions (KT-20342)

This commit is contained in:
Yan Zhulanow
2019-08-08 21:39:07 +09:00
parent 7bd628f989
commit 8325216d38
12 changed files with 206 additions and 10 deletions
@@ -422,6 +422,31 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
runTest("idea/jvm-debugger/jvm-debugger-test/testData/stepping/stepOver/inlineCallInForRangeExpression.kt");
}
@TestMetadata("inlineFunInClassInitializer.kt")
public void testInlineFunInClassInitializer() throws Exception {
runTest("idea/jvm-debugger/jvm-debugger-test/testData/stepping/stepOver/inlineFunInClassInitializer.kt");
}
@TestMetadata("inlineFunInClassInitializer2.kt")
public void testInlineFunInClassInitializer2() throws Exception {
runTest("idea/jvm-debugger/jvm-debugger-test/testData/stepping/stepOver/inlineFunInClassInitializer2.kt");
}
@TestMetadata("inlineFunInConstructor.kt")
public void testInlineFunInConstructor() throws Exception {
runTest("idea/jvm-debugger/jvm-debugger-test/testData/stepping/stepOver/inlineFunInConstructor.kt");
}
@TestMetadata("inlineFunInLazyProperty.kt")
public void testInlineFunInLazyProperty() throws Exception {
runTest("idea/jvm-debugger/jvm-debugger-test/testData/stepping/stepOver/inlineFunInLazyProperty.kt");
}
@TestMetadata("inlineFunInPropertyGetter.kt")
public void testInlineFunInPropertyGetter() throws Exception {
runTest("idea/jvm-debugger/jvm-debugger-test/testData/stepping/stepOver/inlineFunInPropertyGetter.kt");
}
@TestMetadata("inlineFunctionSameLines.kt")
public void testInlineFunctionSameLines() throws Exception {
runTest("idea/jvm-debugger/jvm-debugger-test/testData/stepping/stepOver/inlineFunctionSameLines.kt");
@@ -0,0 +1,23 @@
package inlineFunInClassInitializer
fun main() {
Goo()
}
class Foo(val a: String?)
class DumbList<T>(private val element: T) : AbstractList<T>() {
override val size get() = 1
override fun get(index: Int) = if (index == 0) element else error("Invalid index $index")
}
class Goo {
init {
//Breakpoint!
val a = DumbList(Foo("a"))
val b = a.mapNotNull { it.a }
1
}
}
// STEP_OVER: 2
@@ -0,0 +1,9 @@
LineBreakpoint created at inlineFunInClassInitializer.kt:17
Run Java
Connected to the target VM
inlineFunInClassInitializer.kt:17
inlineFunInClassInitializer.kt:18
inlineFunInClassInitializer.kt:19
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,29 @@
package inlineFunInClassInitializer2
fun main() {
Goo()
}
class Foo(val a: String?)
class DumbList<T>(private val element: T) : AbstractList<T>() {
override val size get() = 1
override fun get(index: Int) = if (index == 0) element else error("Invalid index $index")
}
class Goo {
init {
block {
//Breakpoint!
val a = DumbList(Foo("a"))
val b = a.mapNotNull { it.a }
1
}
}
}
fun <T> block(block: () -> T): T {
return block()
}
// STEP_OVER: 2
@@ -0,0 +1,9 @@
LineBreakpoint created at inlineFunInClassInitializer2.kt:18
Run Java
Connected to the target VM
inlineFunInClassInitializer2.kt:18
inlineFunInClassInitializer2.kt:19
inlineFunInClassInitializer2.kt:20
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,23 @@
package inlineFunInConstructor
fun main() {
Goo()
}
class Foo(val a: String?)
class DumbList<T>(private val element: T) : AbstractList<T>() {
override val size get() = 1
override fun get(index: Int) = if (index == 0) element else error("Invalid index $index")
}
class Goo {
constructor() {
//Breakpoint!
val a = DumbList(Foo("a"))
val b = a.mapNotNull { it.a }
1
}
}
// STEP_OVER: 2
@@ -0,0 +1,9 @@
LineBreakpoint created at inlineFunInConstructor.kt:17
Run Java
Connected to the target VM
inlineFunInConstructor.kt:17
inlineFunInConstructor.kt:18
inlineFunInConstructor.kt:19
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,23 @@
package inlineFunInLazyProperty
fun main() {
Goo().f
}
class Foo(val a: String?)
class DumbList<T>(private val element: T) : AbstractList<T>() {
override val size get() = 1
override fun get(index: Int) = if (index == 0) element else error("Invalid index $index")
}
class Goo {
val f by lazy {
//Breakpoint!
val a = DumbList(Foo("a"))
val b = a.mapNotNull { it.a }
1
}
}
// STEP_OVER: 2
@@ -0,0 +1,9 @@
LineBreakpoint created at inlineFunInLazyProperty.kt:17
Run Java
Connected to the target VM
inlineFunInLazyProperty.kt:17
inlineFunInLazyProperty.kt:18
inlineFunInLazyProperty.kt:19
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,24 @@
package inlineFunInPropertyGetter
fun main() {
Goo().f
}
class Foo(val a: String?)
class DumbList<T>(private val element: T) : AbstractList<T>() {
override val size get() = 1
override fun get(index: Int) = if (index == 0) element else error("Invalid index $index")
}
class Goo {
val f: Int
get() {
//Breakpoint!
val a = DumbList(Foo("a"))
val b = a.mapNotNull { it.a }
return 1
}
}
// STEP_OVER: 2
@@ -0,0 +1,9 @@
LineBreakpoint created at inlineFunInPropertyGetter.kt:18
Run Java
Connected to the target VM
inlineFunInPropertyGetter.kt:18
inlineFunInPropertyGetter.kt:19
inlineFunInPropertyGetter.kt:20
Disconnected from the target VM
Process finished with exit code 0