But when you decompile, the two functions are clearly different.
@Nullable
public static final Object func(@NotNull Continuation $completion) {
return Unit.INSTANCE;
}
public static final void func() {
}
The suspend method has a Continuation object declared as a parameter.
If so, isn’t there a distinction between non-suspend methods and method signatures?
It’s because the two declarations are conflicting when called. If you call foo() inside a suspend function, which should that call resolve to? The question is ambiguous enough that the compiler throws its hands up and just tells you to deal with it
Of course it can be easily solved, and in fact Kotlin has made some ambiguity-resolving choices in other areas, but this one was deemed too semantically ambiguous for the person reading and writing the code
I don’t think it’s easily solved. If I call func() from within a coroutine, which version should be called? Both are perfectly valid function calls in that context, so the compiler has no idea which one I want.