@@ -2650,8 +2650,12 @@ static bool fixMissingArguments(ConstraintSystem &cs, ASTNode anchor,
26502650 // If the argument was a single "tuple", let's bind newly
26512651 // synthesized arguments to it.
26522652 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)) }.
26532656 cs.addConstraint(ConstraintKind::Bind, *argumentTuple,
2654- FunctionType::composeTuple(ctx, args),
2657+ FunctionType::composeTuple(
2658+ ctx, args, ParameterFlagHandling::IgnoreNonEmpty),
26552659 cs.getConstraintLocator(anchor));
26562660 }
26572661
@@ -2884,8 +2888,8 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
28842888 // Form an imploded tuple type, dropping the parameter flags as although
28852889 // canImplodeParams makes sure we're not dealing with vargs, inout, etc,
28862890 // 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 );
28892893 params.clear();
28902894 // If fixes are disabled let's do an easy thing and implode
28912895 // tuple directly into parameters list.
@@ -7008,8 +7012,11 @@ ConstraintSystem::simplifyConstructionConstraint(
70087012 args.push_back(arg.withFlags(flags));
70097013 }
70107014
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);
70137020 Type resultType = fnType->getResult();
70147021
70157022 ConstraintLocatorBuilder builder(locator);
@@ -7995,7 +8002,7 @@ ConstraintSystem::simplifyBindTupleOfFunctionParamsConstraint(
79958002
79968003 auto tupleTy =
79978004 AnyFunctionType::composeTuple(getASTContext(), funcTy->getParams(),
7998- /*wantParamFlags*/ false );
8005+ ParameterFlagHandling::IgnoreNonEmpty );
79998006
80008007 addConstraint(ConstraintKind::Bind, tupleTy, second,
80018008 locator.withPathElement(ConstraintLocator::FunctionArgument));
0 commit comments