KT-52791 Make it possible to pass multiple context receivers to a class
This commit is contained in:
committed by
Space Team
parent
62217b39ec
commit
906c161068
@@ -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()
|
||||
}
|
||||
Reference in New Issue
Block a user