Skip to content

Commit 12497b7

Browse files
committed
[CSSimplify] Allow callers to provide argument list to matchCallArguments
This would make it much easier to implement trailing closure splitting for during callable type construction.
1 parent 4f38eb3 commit 12497b7

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5467,6 +5467,7 @@ matchCallArguments(
54675467
ConstraintSystem::TypeMatchResult
54685468
matchCallArguments(ConstraintSystem &cs,
54695469
FunctionType *contextualType,
5470+
ArgumentList *argumentList,
54705471
ArrayRef<AnyFunctionType::Param> args,
54715472
ArrayRef<AnyFunctionType::Param> params,
54725473
ConstraintKind subKind,

lib/Sema/CSSimplify.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,7 @@ class OpenTypeSequenceElements {
13211321
// Match the argument of a call to the parameter.
13221322
ConstraintSystem::TypeMatchResult constraints::matchCallArguments(
13231323
ConstraintSystem &cs, FunctionType *contextualType,
1324+
ArgumentList *argList,
13241325
ArrayRef<AnyFunctionType::Param> args,
13251326
ArrayRef<AnyFunctionType::Param> params, ConstraintKind subKind,
13261327
ConstraintLocatorBuilder locator,
@@ -1340,8 +1341,7 @@ ConstraintSystem::TypeMatchResult constraints::matchCallArguments(
13401341

13411342
ParameterListInfo paramInfo(params, callee, appliedSelf);
13421343

1343-
// Dig out the argument information.
1344-
auto *argList = cs.getArgumentList(loc);
1344+
// Make sure that argument list is available.
13451345
assert(argList);
13461346

13471347
// Apply labels to arguments.
@@ -10634,11 +10634,14 @@ ConstraintSystem::simplifyApplicableFnConstraint(
1063410634
? ConstraintKind::OperatorArgumentConversion
1063510635
: ConstraintKind::ArgumentConversion);
1063610636

10637+
auto *argumentsLoc = getConstraintLocator(
10638+
outerLocator.withPathElement(ConstraintLocator::ApplyArgument));
10639+
10640+
auto *argumentList = getArgumentList(argumentsLoc);
1063710641
// The argument type must be convertible to the input type.
1063810642
auto matchCallResult = ::matchCallArguments(
10639-
*this, func2, func1->getParams(), func2->getParams(), subKind,
10640-
outerLocator.withPathElement(ConstraintLocator::ApplyArgument),
10641-
trailingClosureMatching);
10643+
*this, func2, argumentList, func1->getParams(), func2->getParams(),
10644+
subKind, argumentsLoc, trailingClosureMatching);
1064210645

1064310646
switch (matchCallResult) {
1064410647
case SolutionKind::Error:

0 commit comments

Comments
 (0)