Debugger: more precise context expression in codeFragment

#KT-11380 Fixed
This commit is contained in:
Natalia Ukhorskaya
2016-03-22 12:13:44 +03:00
parent 77b7b46542
commit a09814961f
5 changed files with 110 additions and 17 deletions
+15
View File
@@ -0,0 +1,15 @@
LineBreakpoint created at smartcasts.kt:19
LineBreakpoint created at smartcasts.kt:29
!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! smartcasts.SmartcastsKt
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
smartcasts.kt:19
Compile bytecode for derived.prop
smartcasts.kt:19
Compile bytecode for derived.prop
smartcasts.kt:29
Compile bytecode for nullable.prop
smartcasts.kt:29
Compile bytecode for nullable.prop
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
@@ -0,0 +1,35 @@
package smartcasts
fun main(args: Array<String>) {
test1(Derived())
test1(Base())
test2(Derived())
test2(null)
}
// EXPRESSION: derived.prop
// RESULT: 1: I
// EXPRESSION: derived.prop
// RESULT: java.lang.ClassCastException: smartcasts.Base cannot be cast to smartcasts.Derived: Ljava/lang/ClassCastException;
fun test1(derived: Base) =
derived is Derived &&
//Breakpoint!
derived.prop == 1
// EXPRESSION: nullable.prop
// RESULT: 1: I
// EXPRESSION: nullable.prop
// RESULT: Method threw 'kotlin.TypeCastException' exception.
fun test2(nullable: Derived?) =
nullable != null &&
//Breakpoint!
nullable.prop == 1
class Derived : Base() {
val prop = 1
}
open class Base