class A {
    fun B.foo() {}
}

trait B

fun bar(a: A, b: B) {
    with (a) {
        b.<caret>foo()
    }
}

fun <T, R> with(receiver: T, f: T.() -> R) : R = receiver.f()


Resolved call:

Resulting descriptor: fun B.foo(): Unit

Explicit receiver kind = RECEIVER_ARGUMENT
This object = AExt{fun A.<anonymous>(): Unit}
Receiver argument = b {B}
