[PSI2IR] Generate value arguments for context receivers in getter/setter

This commit is contained in:
Anastasiya Shadrina
2021-03-09 19:49:23 +07:00
committed by TeamCityServer
parent 5e426d5c16
commit 766e6bca75
5 changed files with 46 additions and 8 deletions
@@ -0,0 +1,22 @@
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_FIR: JVM_IR
class EntityContext {
var d = DoubleArray(16)
}
class EDouble(val i: Int) {
context(EntityContext)
var value: Double
get() = d[i]
set(value) { d[i] = value }
}
fun box(): String {
val entityContext = EntityContext()
with(entityContext) {
val eDouble = EDouble(0)
eDouble.value = .2
return if (eDouble.value == .2) "OK" else "fail"
}
}