[ConstraintSystem] Bail out of inference from default arguments if there

is no parameter list for the callee.

This can happen when the callee is a closure that has been assigned to
a variable.
This commit is contained in:
Holly Borla
2022-03-25 00:20:34 -07:00
parent c71b7c500e
commit 0fdb9a38d2
2 changed files with 4 additions and 1 deletions

View File

@@ -1753,10 +1753,12 @@ static ConstraintSystem::TypeMatchResult matchCallArguments(
if (ctx.TypeCheckerOpts.EnableTypeInferenceFromDefaultArguments) {
auto *paramList = getParameterList(callee);
auto *PD = paramList->get(paramIdx);
if (!paramList)
continue;
// There is nothing to infer if parameter doesn't have any
// generic parameters in its type.
auto *PD = paramList->get(paramIdx);
if (!PD->getInterfaceType()->hasTypeParameter())
continue;