Files
kotlin-fork/compiler/testData/codegen/box/extensionFunctions/contextReceivers/receiversOrder.kt
T
2022-07-25 15:11:29 +00:00

28 lines
346 B
Kotlin
Vendored

// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
class A(val x: String)
var result = ""
context(A)
fun foo() {
result += x
}
fun A.bar() {
foo()
baz {
foo()
}
}
fun baz(a: A.() -> Unit) {
a(A("K"))
}
fun box(): String {
A("O").bar() // prints "1", "1" while "1", "2" is expected
return result
}