mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Diagnostics] Ignore type mismatches related to synthesized arguments
The main issue is the absence of the argument itself. Resolves: rdar://90419017
This commit is contained in:
@@ -4826,6 +4826,27 @@ bool ConstraintSystem::repairFailures(
|
||||
case ConstraintLocator::ApplyArgToParam: {
|
||||
auto loc = getConstraintLocator(locator);
|
||||
|
||||
// If this type mismatch is associated with a synthesized argument,
|
||||
// let's just ignore it because the main problem is the absence of
|
||||
// the argument.
|
||||
if (auto applyLoc = elt.getAs<LocatorPathElt::ApplyArgToParam>()) {
|
||||
if (auto *argumentList = getArgumentList(loc)) {
|
||||
// This is either synthesized argument or a default value.
|
||||
if (applyLoc->getArgIdx() >= argumentList->size()) {
|
||||
auto *calleeLoc = getCalleeLocator(loc);
|
||||
auto overload = findSelectedOverloadFor(calleeLoc);
|
||||
// If this cannot be a default value matching, let's ignore.
|
||||
if (!(overload && overload->choice.isDecl()))
|
||||
return true;
|
||||
|
||||
if (!getParameterList(overload->choice.getDecl())
|
||||
->get(applyLoc->getParamIdx())
|
||||
->getTypeOfDefaultExpr())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Don't attempt to fix an argument being passed to a
|
||||
// _OptionalNilComparisonType parameter. Such an overload should only take
|
||||
// effect when a nil literal is used in valid code, and doesn't offer any
|
||||
|
||||
Reference in New Issue
Block a user