1a29b9efff
- Mangled names of property accessors now include context receiver types of the corresponding property when computed from FIR. - Context receivers are now supported when computing mangled names from IR - IrBasedDescriptors now account for context receivers ^KT-57435 Fixed
24 lines
515 B
Kotlin
Vendored
24 lines
515 B
Kotlin
Vendored
// !LANGUAGE: +ContextReceivers
|
|
// IGNORE_BACKEND: JS_IR
|
|
|
|
data class MyContainer(var s: String)
|
|
|
|
context(Int)
|
|
operator fun MyContainer.get(index: Int): String? {
|
|
return if (index == 0 && this@Int == 42) s else null
|
|
}
|
|
|
|
context(Int)
|
|
operator fun MyContainer.set(index: Int, value: String) {
|
|
if (index != 0 || this@Int != 42) return
|
|
s = value
|
|
}
|
|
|
|
fun box(): String {
|
|
return with(42) {
|
|
val myContainer = MyContainer("fail")
|
|
myContainer[0] = "OK"
|
|
myContainer[0] ?: "fail"
|
|
}
|
|
}
|