Skip to content

Commit 4d02463

Browse files
committed
[Diagnostics] Fix missing argument diagnostic to support closures with captures
1 parent c968c14 commit 4d02463

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3504,7 +3504,11 @@ bool MissingArgumentsFailure::diagnoseAsError() {
35043504
path.back().getKind() == ConstraintLocator::ContextualType))
35053505
return false;
35063506

3507-
if (auto *closure = dyn_cast<ClosureExpr>(getAnchor()))
3507+
auto *anchor = getAnchor();
3508+
if (auto *captureList = dyn_cast<CaptureListExpr>(anchor))
3509+
anchor = captureList->getClosureBody();
3510+
3511+
if (auto *closure = dyn_cast<ClosureExpr>(anchor))
35083512
return diagnoseTrailingClosure(closure);
35093513

35103514
return false;

0 commit comments

Comments
 (0)