interface A { fun foo() } interface B { fun bar() } fun B.b() { object : A { override fun foo() { this@b.bar() } } } fun test() { fun without(f: T.() -> Unit): Unit = (null!!).f() without() b@ { object : A { override fun foo() { this@b.bar() } } } }