Wrong delegation to delegation property in debugger when property defined in another module (KT-12678)
Different bytecode can be generated for delegated property and for non-delegated one. Backend inspects DELEGATED_PROPERTY_CALL to understand the property type, and expects that this information had been already recorded into context. Frontend writes DELEGATED_PROPERTY_CALL into context during body resolve or type inference if type is not present. Either way in debugger context it may happen that the DELEGATED_PROPERTY_CALL won't be written into context. #KT-12678
This commit is contained in:
committed by
Nikolay Krasko
parent
0bc5007147
commit
4087e650aa
+11
@@ -0,0 +1,11 @@
|
||||
package delegatedPropertyInOtherFileOther
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class WithDelegate {
|
||||
val a: Int by Id(12)
|
||||
}
|
||||
|
||||
class Id(val v: Int) {
|
||||
operator fun getValue(o: Any, property: KProperty<*>): Int = v
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
LineBreakpoint created at delegatedPropertyInOtherFile.kt:9
|
||||
!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! delegatedPropertyInOtherFile.DelegatedPropertyInOtherFileKt
|
||||
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||
delegatedPropertyInOtherFile.kt:9
|
||||
Compile bytecode for t.a
|
||||
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||
|
||||
Process finished with exit code 0
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
package delegatedPropertyInOtherFile
|
||||
|
||||
import delegatedPropertyInOtherFileOther.*
|
||||
|
||||
fun main(a: Array<String>) {
|
||||
val t = WithDelegate()
|
||||
|
||||
//Breakpoint!
|
||||
t.a
|
||||
}
|
||||
|
||||
// EXPRESSION: t.a
|
||||
// RESULT: 12: I
|
||||
Reference in New Issue
Block a user