KT-52791 Make it possible to pass multiple context receivers to a class

This commit is contained in:
Pavel Mikhailovskii
2022-12-28 11:21:03 +00:00
committed by Space Team
parent 62217b39ec
commit 906c161068
38 changed files with 180 additions and 516 deletions
@@ -0,0 +1,19 @@
// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
class A(val a: String)
class B(val b: String)
context(A, B)
class C {
fun foo() = this@A.a + this@B.b
}
fun box(): String {
val c = with(A("O")) {
with(B("K")) {
C()
}
}
return c.foo()
}