Why does the following code compile? I'd expect it to complain about ambiguous use of 'x', but that only happens when both methods have the same number of parameters, all with default values
struct Foo {
func x(a: Int = 0, b: Int = 0) {
}
func x(b: Int = 0) {
}
}
Foo().x()
What I assume is that the compiler considers func x(b: Int = 0) to be the “more specific” method matching the call, and therefore chooses it. I am sure that someone can give a more authoritative answer ...