Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/Sema/CSSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4896,9 +4896,13 @@ bool ConstraintSystem::repairFailures(
if (!(overload && overload->choice.isDecl()))
return true;

if (!getParameterList(overload->choice.getDecl())
->get(applyLoc->getParamIdx())
->getTypeOfDefaultExpr())
// Ignore decls that don't have meaningful parameter lists - this
// matches variables and parameters with function types.
auto *paramList = getParameterList(overload->choice.getDecl());
if (!paramList)
return true;

if (!paramList->get(applyLoc->getParamIdx())->getTypeOfDefaultExpr())
return true;
}
}
Expand Down
7 changes: 7 additions & 0 deletions test/Constraints/argument_matching.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1782,3 +1782,10 @@ func testExtraTrailingClosure() {
func qux(x: () -> Void, y: () -> Void, z: () -> Void) {} // expected-note {{'qux(x:y:z:)' declared here}}
qux() {} m: {} y: {} n: {} z: {} o: {} // expected-error@:6 {{extra trailing closures at positions #2, #4, #6 in call}}
}

// rdar://93922410 - argument-to-parameter doesn't handle applies of ParamDecls
func rdar93922410(_ completion: (Int?) -> Void) { // expected-note {{'completion' declared here}}
_ = {
return completion() // expected-error {{missing argument for parameter #1 in call}}
}
}