@@ -127,6 +127,18 @@ static bool isPackExpansionType(Type type) {
127
127
return false;
128
128
}
129
129
130
+ static bool containsPackExpansionType(ArrayRef<AnyFunctionType::Param> params) {
131
+ return llvm::any_of(params, [&](const auto ¶m) {
132
+ return isPackExpansionType(param.getPlainType());
133
+ });
134
+ }
135
+
136
+ static bool containsPackExpansionType(TupleType *tuple) {
137
+ return llvm::any_of(tuple->getElements(), [&](const auto &elt) {
138
+ return isPackExpansionType(elt.getType());
139
+ });
140
+ }
141
+
130
142
bool constraints::doesMemberRefApplyCurriedSelf(Type baseTy,
131
143
const ValueDecl *decl) {
132
144
assert(decl->getDeclContext()->isTypeContext() &&
@@ -2107,8 +2119,8 @@ class TupleMatcher {
2107
2119
bool match(MatchKind kind, ConstraintLocatorBuilder locator) {
2108
2120
// FIXME: TuplePackMatcher should completely replace the non-variadic
2109
2121
// case too eventually.
2110
- if (tuple1-> containsPackExpansionType() ||
2111
- tuple2-> containsPackExpansionType()) {
2122
+ if (containsPackExpansionType(tuple1 ) ||
2123
+ containsPackExpansionType(tuple2 )) {
2112
2124
TuplePackMatcher matcher(tuple1, tuple2, isPackExpansionType);
2113
2125
if (matcher.match())
2114
2126
return true;
@@ -3352,8 +3364,8 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
3352
3364
3353
3365
// FIXME: ParamPackMatcher should completely replace the non-variadic
3354
3366
// case too eventually.
3355
- if (AnyFunctionType:: containsPackExpansionType(func1Params) ||
3356
- AnyFunctionType:: containsPackExpansionType(func2Params)) {
3367
+ if (containsPackExpansionType(func1Params) ||
3368
+ containsPackExpansionType(func2Params)) {
3357
3369
ParamPackMatcher matcher(func1Params, func2Params, getASTContext(),
3358
3370
isPackExpansionType);
3359
3371
if (matcher.match())
@@ -14184,8 +14196,8 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyFixConstraint(
14184
14196
// the fix constraint solved without trying to figure out which tuple
14185
14197
// elements were part of the pack.
14186
14198
{
14187
- if (lhs-> containsPackExpansionType() ||
14188
- rhs-> containsPackExpansionType()) {
14199
+ if (containsPackExpansionType(lhs ) ||
14200
+ containsPackExpansionType(rhs )) {
14189
14201
if (recordFix(fix))
14190
14202
return SolutionKind::Error;
14191
14203
return SolutionKind::Solved;
0 commit comments