Nicolai C.
08/21/2025, 3:51 AMExample
and manually implement example1
I can reference example2
just fine, which puzzles me as to why the following snippet doesn't compile.
val example = Example {
// this is without `example1`
example2() // this line doesn't compile
}
fun interface Example {
fun example1()
fun example2() {
println("Example")
}
}
dmitriy.novozhilov
08/21/2025, 7:14 AMephemient
08/21/2025, 9:50 AMthis
is whatever it was from outside the lambda (unless it's inferred to take a receiver), not the lambda itself. same in a SAM-converted lambdaNicolai C.
08/21/2025, 10:10 AMdmitriy.novozhilov
08/21/2025, 10:12 AM@ephemient
is fully valid, and it's better to not change the language semantics for this featureYoussef Shoaib [MOD]
08/21/2025, 12:59 PMval example = Example {
example2()
}
fun interface Example {
fun Example.example1DontCall()
fun example2() {
println("Example")
}
}
fun Example.example1() = example1DontCall()
This workaround exists