Skip to content

Commit b8528cd

Browse files
committed
[ConstraintSystem] Short-circuit matching if missing arguments have been synthesized
1 parent 881f521 commit b8528cd

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,7 @@ matchCallArguments(ArrayRef<AnyFunctionType::Param> args,
575575

576576
// If we have any unfulfilled parameters, check them now.
577577
if (haveUnfulfilledParams) {
578+
bool hasSynthesizedArgs = false;
578579
for (paramIdx = 0; paramIdx != numParams; ++paramIdx) {
579580
// If we have a binding for this parameter, we're done.
580581
if (!parameterBindings[paramIdx].empty())
@@ -590,16 +591,19 @@ matchCallArguments(ArrayRef<AnyFunctionType::Param> args,
590591
if (paramInfo.hasDefaultArgument(paramIdx))
591592
continue;
592593

593-
if (potentiallyOutOfOrder)
594-
return true;
595-
596594
if (auto newArgIdx = listener.missingArgument(paramIdx)) {
597595
parameterBindings[paramIdx].push_back(*newArgIdx);
596+
hasSynthesizedArgs = true;
598597
continue;
599598
}
600599

601600
return true;
602601
}
602+
603+
// If all of the missing arguments have been synthesized,
604+
// let's stop since we have found the problem.
605+
if (hasSynthesizedArgs)
606+
return false;
603607
}
604608

605609
// If any arguments were provided out-of-order, check whether we have

0 commit comments

Comments
 (0)