Support local delegated properties in kotlinx-metadata-jvm

This commit is contained in:
Alexander Udalov
2018-06-13 19:17:02 +02:00
parent b00f765255
commit fec2c14ea5
12 changed files with 330 additions and 20 deletions
@@ -0,0 +1,30 @@
import kotlin.reflect.KProperty
class Delegate<T>(val value: T? = null) {
operator fun getValue(instance: Any?, property: KProperty<*>): T = value!!
}
val nonLocal by Delegate<String>()
val init0 = run {
val local1 by Delegate<Double>()
val local2 by Delegate<Any>()
}
val init1 = run {
val local3 by Delegate<CharSequence?>()
}
class Class {
init {
val local4 by Delegate<Array<String>>()
}
fun f() {
val local5 by Delegate<List<Unit>?>()
fun g() {
val local6 by Delegate<Int>()
}
}
}