altavir
02/06/2019, 2:21 PMTsvetozar Bonev
02/06/2019, 2:25 PMAlan Evans
02/06/2019, 2:25 PMaltavir
02/06/2019, 2:25 PMAlan Evans
02/06/2019, 2:25 PMaltavir
02/06/2019, 2:26 PMTsvetozar Bonev
02/06/2019, 2:26 PMaltavir
02/06/2019, 2:27 PMalex
02/06/2019, 2:30 PMaltavir
02/06/2019, 2:31 PMalex
02/06/2019, 2:32 PMaltavir
02/06/2019, 2:33 PMAlan Evans
02/06/2019, 2:36 PMfun position(arg: Int = 0){println("B")}
fun position(arg: Int = 0, arg2:Int = 1) {println("A")}
fun main(){
position(1)
}
altavir
02/06/2019, 2:36 PMAlan Evans
02/06/2019, 2:38 PMfun wrongTwoDefault(a: Any = 2) = 1
fun wrongTwoDefault(a: Int = 2, b: String = "") = ""
<!OVERLOAD_RESOLUTION_AMBIGUITY!>wrongTwoDefault<!>(1)
altavir
02/06/2019, 2:39 PMRuckus
02/06/2019, 3:19 PMaltavir
02/06/2019, 3:19 PMRuckus
02/06/2019, 3:23 PMaltavir
02/06/2019, 3:24 PMRuckus
02/06/2019, 3:27 PMaltavir
02/06/2019, 3:28 PMstanislav.erokhin
02/07/2019, 7:05 AMInt
should win over Any
. So none of function usn't specific that another.altavir
02/07/2019, 7:14 AMAlan Evans
02/07/2019, 2:15 PM<!OVERLOAD_RESOLUTION_AMBIGUITY!>wrongTwoDefault<!>(1)
Not say that there should be an ambiguity error at this point?wrongWithDefaultGeneric
from that test also does not fail @stanislav.erokhinstanislav.erokhin
02/07/2019, 2:30 PMInt
and Any
at first and because Int
is more specific that Any
we chose second candidate. but if types are equal, then we compare by defaults count.Alan Evans
02/07/2019, 4:14 PM