object A {
  private constructor() /* primary */ {
    super/*Any*/()
    /* <init>() */

  }

}

object B {
  private constructor() /* primary */ {
    super/*Any*/()
    /* <init>() */

  }

}

interface IFoo {
  val A.foo: B
    get(): B {
      return B
    }

}

interface IInvoke {
  operator fun B.invoke(): Int {
    return 42
  }

}

fun test(fooImpl: IFoo, invokeImpl: IInvoke) {
  with<A, Int>(receiver = A, block = local fun A.<anonymous>(): Int {
    return with<IFoo, Int>(receiver = fooImpl, block = local fun IFoo.<anonymous>(): Int {
      return with<IInvoke, Int>(receiver = invokeImpl, block = local fun IInvoke.<anonymous>(): Int {
        return ($this$with, ($this$with, $this$with).<get-foo>()).invoke()
      }
)
    }
)
  }
) /*~> Unit */
}

