Skip to content

Commit e40d4e4

Browse files
committed
[Diagnostics] Adjust isMisplacedMissingArgument to handle unresolved closures when matching to new parameter
Cannot rely that closure type is always resolved, but if the other parameter has a correct shape, consider it a match.
1 parent 859106e commit e40d4e4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5580,6 +5580,12 @@ bool MissingArgumentsFailure::isMisplacedMissingArgument(
55805580
auto argType = solution.simplifyType(solution.getType(unaryArg));
55815581
auto paramType = fnType->getParams()[1].getPlainType();
55825582

5583+
if (isExpr<ClosureExpr>(unaryArg) && argType->is<UnresolvedType>()) {
5584+
auto unwrappedParamTy = paramType->lookThroughAllOptionalTypes();
5585+
if (unwrappedParamTy->is<FunctionType>() || unwrappedParamTy->isAny())
5586+
return true;
5587+
}
5588+
55835589
return TypeChecker::isConvertibleTo(argType, paramType, solution.getDC());
55845590
}
55855591

0 commit comments

Comments
 (0)