Files
kotlin-fork/compiler/testData/codegen/box/extensionClasses/edouble.kt
T
2021-12-09 13:26:37 +03:00

24 lines
545 B
Kotlin
Vendored

// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_FIR: JVM_IR
// FIR status: context receivers aren't yet supported
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"
}
}