Can I somehow access the context receiver "instanc...
# getting-started
n
Can I somehow access the context receiver "instance" in the following example? Thanks.
Copy code
interface A

    interface B

    fun f1(block: A.() -> Unit) { TODO() }

    fun f2(block: context(B) () -> Unit) { TODO() }

    fun f( block: context(B) A.() -> Unit) { 
        f1 {
            f2 {
                block(
                    this@f2, // How?
                    this@f1
                )
            }
        }
    }
(It works if I change
f2()
to
fun f2(block: B.() -> Unit)
, my question is about the above example.)
y
You need a function like:
Copy code
context(A) fun <A> given(): A = this@A
1
🙏 1