[Diagnostics] Prioritize type mismatches over labeling failures for calls

Since labels are considered part of the name, mismatches in labeling
should be invalidate overload choices. Let's prefer an overload with
correct labels but incorrect types over the one with incorrect labels.

This also means that it's possible to restore performance optimizations
related to early filtering in diagnostic mode, which is important for
deeply nested code i.e. SwiftUI views.
This commit is contained in:
Pavel Yaskevich
2021-03-03 17:41:48 -08:00
parent 0ee9e698ce
commit cd08350fe5
3 changed files with 39 additions and 8 deletions

View File

@@ -9221,13 +9221,6 @@ bool ConstraintSystem::simplifyAppliedOverloadsImpl(
for (auto *choice : choices.slice(1))
choice->setDisabled();
}
// Don't attempt further optimization in "diagnostic mode" because
// in such mode we'd like to attempt all of the available overloads
// regardless of problems related to missing or extraneous labels
// and/or arguments.
if (solverState)
return false;
}
/// The common result type amongst all function overloads.