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(
1632
1632
if (parameterBindings[paramIdx].empty()) {
1633
1633
auto &ctx = cs.getASTContext();
1634
1634
1635
- if (paramTy->hasTypeVariable() &&
1636
- ctx.TypeCheckerOpts.EnableTypeInferenceFromDefaultArguments) {
1635
+ if (ctx.TypeCheckerOpts.EnableTypeInferenceFromDefaultArguments) {
1637
1636
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();
1639
1645
1640
1646
// A caller side default.
1641
1647
if (!defaultExprType || defaultExprType->hasError())
1642
1648
continue;
1643
1649
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.
1646
1653
if (defaultExprType->hasArchetype())
1647
1654
continue;
1648
1655
You can’t perform that action at this time.
0 commit comments