I am far from an expert in Swift, but, I think the answer is that when matching the signatures, the fact that 'x' has a default value is ignored so that the closest match in type signature is foo(A()), not foo(A2(),x) for for(A2()), since you do not explicitly include a Bool argument in the call. It works the first time because there is not conflict, there is not 'func foo(_ a: A)' defined. Whether this is intended, or a deficiency in the overload resolution rules, others will need to comment on that.
No because there is no initializer with just A2(). The compiler has to consider these two options:
foo(A())
foo(A2(),bool) --> ignoring fact the bool is defaulted.
for a call to foo(A2()), the best match is foo(A()) by signature. Similar to situations in C++ with function/operator overloads and base classes. Again, not sure if this is intended, or if a deficiency in overload resolution rules.
This is similar to SR-1876 but not quite the same. It's true that there are two ranking rules in play here:
Concrete types are better than protocol types.
Not having to provide default arguments is better than having to provide them.
So the question is whether the interaction between these two rules is correct. It's possible to explicitly select either overload:
foo(A2() as A)
foo(A2(), x: false)
which is usually the first test for whether one rule must take priority over another. But you can't always do the same thing with generics (well, not as compactly), and so that's one point in favor of the current behavior being preferable.