KT-23397 Optimize out field for property delegate when it's safe (JVM)
This commit is contained in:
committed by
teamcity
parent
9ee0268197
commit
65b2cee913
+25
@@ -0,0 +1,25 @@
|
||||
// WITH_STDLIB
|
||||
// CHECK_BYTECODE_LISTING
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
object Store {
|
||||
private val map = mutableMapOf<Pair<Any?, KProperty<*>>, String?>()
|
||||
|
||||
operator fun getValue(thisRef: Any?, property: KProperty<*>): String? = map[thisRef to property]
|
||||
|
||||
operator fun setValue(thisRef: Any?, property: KProperty<*>, value: String?) {
|
||||
map[thisRef to property] = value
|
||||
}
|
||||
}
|
||||
|
||||
object O {
|
||||
var s: String? by Store
|
||||
}
|
||||
|
||||
fun box(): String? {
|
||||
O.s = "OK"
|
||||
return O.s
|
||||
}
|
||||
Reference in New Issue
Block a user