class A { } ~extension~fun A.foo() = 1 ~simple~fun foo() = 2 fun test(a: A) { with (a) { `simple`foo() } } fun with(receiver: T, f: T.() -> R) : R = receiver.f()