FIR: Fix candidate receivers orders when choosing a context receiver

^KT-53257 Fixed
This commit is contained in:
Denis.Zharkov
2022-07-22 13:31:08 +02:00
committed by Space
parent 8299cec66b
commit 7f7e5c5975
8 changed files with 57 additions and 18 deletions
@@ -0,0 +1,27 @@
// !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
}