Skip to content

Commit d69a1a5

Browse files
committed
[CSDiagnostics] Attach extra argument ambiguity note to the overload choice
1 parent 0485065 commit d69a1a5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4310,11 +4310,16 @@ bool ExtraneousArgumentsFailure::diagnoseAsError() {
43104310
}
43114311

43124312
bool ExtraneousArgumentsFailure::diagnoseAsNote() {
4313+
auto overload = getChoiceFor(getLocator());
4314+
if (!(overload && overload->choice.isDecl()))
4315+
return false;
4316+
4317+
auto *decl = overload->choice.getDecl();
43134318
auto *anchor = getAnchor();
43144319
auto numArgs = getTotalNumArguments();
4315-
emitDiagnostic(anchor->getLoc(), diag::candidate_with_extraneous_args,
4316-
ContextualType, ContextualType->getNumParams(), numArgs,
4317-
(numArgs == 1), isa<ClosureExpr>(anchor));
4320+
emitDiagnostic(decl, diag::candidate_with_extraneous_args, ContextualType,
4321+
ContextualType->getNumParams(), numArgs, (numArgs == 1),
4322+
isa<ClosureExpr>(anchor));
43184323
return true;
43194324
}
43204325

0 commit comments

Comments
 (0)