Hi there, I’m facing an issue when declaring an su...
# coroutines
a
Hi there, I’m facing an issue when declaring an suspended overload of a function
Copy code
interface 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)
o
I don't think this is a bug, I would just cast to ensure you're calling the right one, or rename them