Handle ParamDecls and VarDecls in Argument Matching Diagnostics

These don't produce meaningful ParameterLists for this analysis to
consider. Bail instead of crashing.

rdar://93922410
This commit is contained in:
Robert Widmann
2022-05-25 16:12:03 -07:00
parent 3ee8034c7a
commit 174bbd2586
2 changed files with 14 additions and 3 deletions

View File

@@ -4896,9 +4896,13 @@ bool ConstraintSystem::repairFailures(
if (!(overload && overload->choice.isDecl()))
return true;
if (!getParameterList(overload->choice.getDecl())
->get(applyLoc->getParamIdx())
->getTypeOfDefaultExpr())
// Ignore decls that don't have meaningful parameter lists - this
// matches variables and parameters with function types.
auto *paramList = getParameterList(overload->choice.getDecl());
if (!paramList)
return true;
if (!paramList->get(applyLoc->getParamIdx())->getTypeOfDefaultExpr())
return true;
}
}