Fix for KT-15437: VerifyError: Bad local variable type on simplest provideDelegate
#KT-15437 Fixed
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate(val value: String) {
|
||||
operator fun provideDelegate(instance: A, property: KProperty<*>): Delegate = Delegate(instance.value)
|
||||
operator fun getValue(instance: Any?, property: KProperty<*>) = value
|
||||
}
|
||||
|
||||
class A(val value: String) {
|
||||
val result: String by Delegate("Fail")
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return A("OK").result
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
operator fun provideDelegate(instance: Any?, property: KProperty<*>): Delegate = this
|
||||
operator fun getValue(instance: Any?, property: KProperty<*>) = "OK"
|
||||
}
|
||||
|
||||
val result: String by Delegate()
|
||||
|
||||
fun box(): String {
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user