I can't seem to find much documentation on why the second invocation of foo works. Using the receiver as an argument doesn't make sense to me. I realize it might be more of a use case for DSLs but for some reason I can't wrap my head around how it is even possible. Can someone break it down?
val foo: Int.() -> Int = {
plus(1)
}
fun main() {
val x = 1.foo()
val y = foo(1)
}