@@ -1182,10 +1182,11 @@ static bool isSingleTupleParam(ASTContext &ctx,
1182
1182
return false ;
1183
1183
1184
1184
const auto ¶m = params.front ();
1185
- if (param.isVariadic () || param.isInOut ())
1185
+ if (param.isVariadic () || param.isInOut () || param. hasLabel () )
1186
1186
return false ;
1187
1187
1188
1188
auto paramType = param.getPlainType ();
1189
+
1189
1190
// Support following case which was allowed until 5:
1190
1191
//
1191
1192
// func bar(_: (Int, Int) -> Void) {}
@@ -1195,11 +1196,9 @@ static bool isSingleTupleParam(ASTContext &ctx,
1195
1196
if (!ctx.isSwiftVersionAtLeast (5 ))
1196
1197
paramType = paramType->lookThroughAllOptionalTypes ();
1197
1198
1198
- // Parameter should not have a label and be either a tuple,
1199
- // type variable or a dependent member, which might later be
1200
- // assigned (or resolved to) a tuple type, e.g. opened generic parameter.
1201
- return !param.hasLabel () &&
1202
- (paramType->is <TupleType>() || paramType->isTypeVariableOrMember ());
1199
+ // Parameter type should either a tuple or something that can become a
1200
+ // tuple later on.
1201
+ return (paramType->is <TupleType>() || paramType->isTypeVariableOrMember ());
1203
1202
}
1204
1203
1205
1204
// / Attempt to fix missing arguments by introducing type variables
@@ -1359,7 +1358,7 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
1359
1358
return false ;
1360
1359
1361
1360
for (auto param : params)
1362
- if (param.isVariadic () || param.isInOut ())
1361
+ if (param.isVariadic () || param.isInOut () || param. isAutoClosure () )
1363
1362
return false ;
1364
1363
1365
1364
return true ;
0 commit comments