@@ -2650,8 +2650,12 @@ static bool fixMissingArguments(ConstraintSystem &cs, ASTNode anchor,
2650
2650
// If the argument was a single "tuple", let's bind newly
2651
2651
// synthesized arguments to it.
2652
2652
if (argumentTuple) {
2653
+ // We can ignore parameter flags here as we're imploding a tuple for a
2654
+ // simulated ((X, Y, Z)) -> R to (X, Y, Z) -> R conversion. As such, this is
2655
+ // similar to e.g { x, y, z in fn((x, y, z)) }.
2653
2656
cs.addConstraint(ConstraintKind::Bind, *argumentTuple,
2654
- FunctionType::composeTuple(ctx, args),
2657
+ FunctionType::composeTuple(
2658
+ ctx, args, ParameterFlagHandling::IgnoreNonEmpty),
2655
2659
cs.getConstraintLocator(anchor));
2656
2660
}
2657
2661
@@ -2884,8 +2888,8 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
2884
2888
// Form an imploded tuple type, dropping the parameter flags as although
2885
2889
// canImplodeParams makes sure we're not dealing with vargs, inout, etc,
2886
2890
// we may still have e.g ownership flags left over, which we can drop.
2887
- auto input = AnyFunctionType::composeTuple(getASTContext(), params,
2888
- /*wantParamFlags*/ false );
2891
+ auto input = AnyFunctionType::composeTuple(
2892
+ getASTContext(), params, ParameterFlagHandling::IgnoreNonEmpty );
2889
2893
params.clear();
2890
2894
// If fixes are disabled let's do an easy thing and implode
2891
2895
// tuple directly into parameters list.
@@ -7008,8 +7012,11 @@ ConstraintSystem::simplifyConstructionConstraint(
7008
7012
args.push_back(arg.withFlags(flags));
7009
7013
}
7010
7014
7011
- // Tuple construction is simply tuple conversion.
7012
- Type argType = AnyFunctionType::composeTuple(getASTContext(), args);
7015
+ // Tuple construction is simply tuple conversion. We should have already
7016
+ // handled the parameter flags. If any future parameter flags are added,
7017
+ // they should also be verified above.
7018
+ Type argType = AnyFunctionType::composeTuple(
7019
+ getASTContext(), args, ParameterFlagHandling::AssertEmpty);
7013
7020
Type resultType = fnType->getResult();
7014
7021
7015
7022
ConstraintLocatorBuilder builder(locator);
@@ -7995,7 +8002,7 @@ ConstraintSystem::simplifyBindTupleOfFunctionParamsConstraint(
7995
8002
7996
8003
auto tupleTy =
7997
8004
AnyFunctionType::composeTuple(getASTContext(), funcTy->getParams(),
7998
- /*wantParamFlags*/ false );
8005
+ ParameterFlagHandling::IgnoreNonEmpty );
7999
8006
8000
8007
addConstraint(ConstraintKind::Bind, tupleTy, second,
8001
8008
locator.withPathElement(ConstraintLocator::FunctionArgument));
0 commit comments