Fix "smart step into" for classes with complex hierarchy (KT-16667)

#KT-16667 Fixed
This commit is contained in:
Nikolay Krasko
2017-03-07 18:13:26 +03:00
parent 6d9b519bb2
commit e6ee933b27
9 changed files with 243 additions and 18 deletions
@@ -0,0 +1,8 @@
LineBreakpoint created at smartStepIntoComponentFunction.kt:10
!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! smartStepIntoComponentFunction.SmartStepIntoComponentFunctionKt
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
smartStepIntoComponentFunction.kt:10
smartStepIntoComponentFunction.kt:11
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
@@ -0,0 +1,20 @@
LineBreakpoint created at smartStepIntoWithDelegates.kt:24
LineBreakpoint created at smartStepIntoWithDelegates.kt:32
LineBreakpoint created at smartStepIntoWithDelegates.kt:40
LineBreakpoint created at smartStepIntoWithDelegates.kt:49
LineBreakpoint created at smartStepIntoWithDelegates.kt:58
!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! smartStepIntoWithDelegates.SmartStepIntoWithDelegatesKt
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
smartStepIntoWithDelegates.kt:24
smartStepIntoWithDelegates.kt:12
smartStepIntoWithDelegates.kt:32
smartStepIntoWithDelegates.kt:12
smartStepIntoWithDelegates.kt:40
smartStepIntoWithDelegates.kt:8
smartStepIntoWithDelegates.kt:49
smartStepIntoWithDelegates.kt:8
smartStepIntoWithDelegates.kt:58
smartStepIntoWithDelegates.kt:12
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
@@ -0,0 +1,20 @@
LineBreakpoint created at smartStepIntoWithOverrides.kt:22
LineBreakpoint created at smartStepIntoWithOverrides.kt:30
LineBreakpoint created at smartStepIntoWithOverrides.kt:38
LineBreakpoint created at smartStepIntoWithOverrides.kt:47
LineBreakpoint created at smartStepIntoWithOverrides.kt:56
!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! smartStepIntoWithOverrides.SmartStepIntoWithOverridesKt
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
smartStepIntoWithOverrides.kt:22
smartStepIntoWithOverrides.kt:12
smartStepIntoWithOverrides.kt:30
smartStepIntoWithOverrides.kt:8
smartStepIntoWithOverrides.kt:38
smartStepIntoWithOverrides.kt:12
smartStepIntoWithOverrides.kt:47
smartStepIntoWithOverrides.kt:8
smartStepIntoWithOverrides.kt:56
smartStepIntoWithOverrides.kt:12
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
@@ -0,0 +1,11 @@
package smartStepIntoComponentFunction
data class Test(val a: Int, val b: Int)
fun main(args: Array<String>) {
val t = Test(12, 2)
// SMART_STEP_INTO_BY_INDEX: 1
// RESUME: 1
//Breakpoint!
t.component2()
}
@@ -0,0 +1,67 @@
package smartStepIntoWithDelegates
interface A {
fun foo(): String
}
class AA : A {
override fun foo(): String = "AA"
}
class B(a: A) : A by a {
override fun foo(): String = "B"
}
class C(b: B) : A by b
class D(a: A) : A by a
fun test1() {
val c: C = C(B(AA()))
// SMART_STEP_INTO_BY_INDEX: 1
// RESUME: 1
//Breakpoint!
c.foo() // 12
}
fun test2() {
val a: A = C(B(AA()))
// SMART_STEP_INTO_BY_INDEX: 1
// RESUME: 1
//Breakpoint!
a.foo() // 12
}
fun test3() {
val d: D = D(AA())
// SMART_STEP_INTO_BY_INDEX: 1
// RESUME: 1
//Breakpoint!
d.foo() // 8
}
fun test4() {
val aa: A = AA()
val c: B = B(AA())
// SMART_STEP_INTO_BY_INDEX: 1
// RESUME: 1
//Breakpoint!
aa.foo() + c.foo() // 8
}
fun test5() {
val aa: A = AA()
val c: B = B(AA())
// SMART_STEP_INTO_BY_INDEX: 2
// RESUME: 1
//Breakpoint!
aa.foo() + c.foo() // 12 (Shouldn't stop at B.foo() even it's evaluated before C.foo())
}
fun main(args: Array<String>) {
test1()
test2()
test3()
test4()
test5()
}
@@ -0,0 +1,66 @@
package smartStepIntoWithOverrides
abstract class A {
abstract fun foo(): String
}
open class B : A() {
override fun foo(): String = "B"
}
open class C : B() {
override fun foo(): String = "C"
}
class D : C()
fun test1() {
val d: D = D()
// SMART_STEP_INTO_BY_INDEX: 1
// RESUME: 1
//Breakpoint!
d.foo() // 12
}
fun test2() {
val a: A = B()
// SMART_STEP_INTO_BY_INDEX: 1
// RESUME: 1
//Breakpoint!
a.foo() // 8
}
fun test3() {
val a: A = C()
// SMART_STEP_INTO_BY_INDEX: 1
// RESUME: 1
//Breakpoint!
a.foo() // 12
}
fun test4() {
val a: A = B()
val d: D = D()
// SMART_STEP_INTO_BY_INDEX: 1
// RESUME: 1
//Breakpoint!
a.foo() + d.foo() // 8
}
fun test5() {
val a: A = B()
val d: D = D()
// SMART_STEP_INTO_BY_INDEX: 2
// RESUME: 1
//Breakpoint!
a.foo() + d.foo() // 12 (Shouldn't stop at B.foo() even it's evaluated before C.foo())
}
fun main(args: Array<String>) {
test1()
test2()
test3()
test4()
test5()
}