I found this in the Kotlin spec 11.4 Choosing the most specific candidate from the overload candidate set (ref):
The most specific callable can forward itself to any other callable from the overload candidate set, while the opposite is not true.
public fun <T> CompletableDeferred(parent: Job? = null): CompletableDeferred<T>
is more specific than
public fun <T> CompletableDeferred(value: T): CompletableDeferred<T>
because you can pass a Job?
as a T
(here unbounded, so Any?
), but not vice versa.
A compile-time error would only be raised if there are multiple functions with the same specificity:
If there are several functions with this property, none of them are the most specific and an overload resolution ambiguity error should be reported by the compiler.
I guess that makes sense.