K2: Update substituted member candidate if it contains type variables
See the comment at updateSubstitutedMemberIfReceiverContainsTypeVariable It became necessary after delegate inference is rewritten, since before that happened, stub types were being left there and FIR2IR handled them accidentally properly because stub types are equal to anything. But that wasn't really correct even there because stub types are not intended to leak out of the FIR ^KT-61060
This commit is contained in:
committed by
Space Team
parent
0f6a51fd97
commit
034671ad78
@@ -0,0 +1,18 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
var foo: (() -> String)? by property(null)
|
||||
|
||||
private fun <T> property(initialValue: T): RwProperty<T> = RwProperty(initialValue)
|
||||
|
||||
class RwProperty<V>(var v: V) {
|
||||
operator fun getValue(thisRef: Any?, property: KProperty<*>): V = v
|
||||
|
||||
operator fun setValue(thisRef: Any?, property: KProperty<*>, value: V) {
|
||||
this.v = value
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
foo = { "OK" }
|
||||
return foo!!.invoke()
|
||||
}
|
||||
Reference in New Issue
Block a user