aballano
07/08/2020, 2:32 PMinterface ASyntax {}
interface BSyntax : ASyntax
fun hello(f: ASyntax.() -> Unit) = println("A")
suspend fun hello(f: BSyntax.() -> Unit) = println("B")
fun f1() = hello { } // Might work or cause a compiler error because it resolves to the suspended version
suspend fun f2() = hello { } // Will call any hello version, but which one is unknown at first place
suspend fun main() {
f1()
f2()
}
The problem is that depending on the case, either f1 will cause a compilation error because it resolves to the suspended version or f2 will resolve to the non-suspended version.
So I’m wondering if someone knows if this is doable and it might be a bug (that I can report) or this is not really intended to be a thing in the first place (and I should rename one of the hello functions instead)octylFractal
07/08/2020, 4:20 PM