Vaizin Nikita
08/07/2023, 1:55 PMThis annotation is also used to discriminate the annotated overloads in case if overload selection still cannot choose one of them even taking in account the result of lambda parameter analysis. In that case a warning is reported.But I have read this like 10 times, and I don't get which function do I annotate, how exactly is Kotlin going to discriminate? Do I annotate the preferred function or the other? Running the example code in Kotlin playground doesn't make any difference whatsoever no matter which one I annotate
Klitos Kyriacou
08/07/2023, 2:42 PM() -> Int
or a () -> Double
, it can't be both so there's no room for "preference". Thus, I would annotate both functions (for the sake of symmetry) even though you only have to annotate one of them.Vaizin Nikita
08/07/2023, 3:05 PMResult<T>
and the other is just
T
For example:
fun <T> chain(block: () -> T)
fun <T> chain(block: () -> Result<T>)
And I of course want to make the more specific function be chosen firstVaizin Nikita
08/07/2023, 5:18 PM