Support reflection for local delegated properties

#KT-15222 Fixed
This commit is contained in:
Alexander Udalov
2017-06-01 19:42:59 +03:00
parent c444c4d10b
commit 616d575fb6
27 changed files with 559 additions and 48 deletions
@@ -0,0 +1,43 @@
// TARGET_BACKEND: JVM
// WITH_REFLECT
// FILE: 1.kt
@file:JvmMultifileClass
@file:JvmName("Test")
package test
import kotlin.reflect.*
object Delegate {
lateinit var property: KProperty<*>
operator fun getValue(instance: Any?, kProperty: KProperty<*>): List<String?> {
property = kProperty
return emptyList()
}
}
// FILE: 2.kt
@file:JvmMultifileClass
@file:JvmName("Test")
package test
fun foo() {
val x by Delegate
x
}
// FILE: test.kt
import test.*
import kotlin.test.assertEquals
fun box(): String {
foo()
assertEquals("val x: kotlin.collections.List<kotlin.String?>", Delegate.property.toString())
return "OK"
}