File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -1632,17 +1632,24 @@ static ConstraintSystem::TypeMatchResult matchCallArguments(
16321632 if (parameterBindings[paramIdx].empty()) {
16331633 auto &ctx = cs.getASTContext();
16341634
1635- if (paramTy->hasTypeVariable() &&
1636- ctx.TypeCheckerOpts.EnableTypeInferenceFromDefaultArguments) {
1635+ if (ctx.TypeCheckerOpts.EnableTypeInferenceFromDefaultArguments) {
16371636 auto *paramList = getParameterList(callee);
1638- auto defaultExprType = paramList->get(paramIdx)->getTypeOfDefaultExpr();
1637+ auto *PD = paramList->get(paramIdx);
1638+
1639+ // There is nothing to infer if parameter doesn't have any
1640+ // generic parameters in its type.
1641+ if (!PD->getInterfaceType()->hasTypeParameter())
1642+ continue;
1643+
1644+ auto defaultExprType = PD->getTypeOfDefaultExpr();
16391645
16401646 // A caller side default.
16411647 if (!defaultExprType || defaultExprType->hasError())
16421648 continue;
16431649
1644- // If this is just a regular default type that works
1645- // for any generic parameter type, let's continue.
1650+ // If this is just a regular default type that should
1651+ // work for all substitutions of generic parameter,
1652+ // let's continue.
16461653 if (defaultExprType->hasArchetype())
16471654 continue;
16481655
You can’t perform that action at this time.
0 commit comments