Skip to content

Fix Issue 21294 - Improve unhelpful error message with duplicate name… - #23821

Merged
thewilsonator merged 3 commits into
dlang:masterfrom
usefahmed07:fix-21294
Sep 12, 2026
Merged

Fix Issue 21294 - Improve unhelpful error message with duplicate name…#23821
thewilsonator merged 3 commits into
dlang:masterfrom
usefahmed07:fix-21294

Conversation

@usefahmed07

Copy link
Copy Markdown
Contributor

Fixes #21294

…d argument in overload set

Named-argument errors (e.g. "parameter assigned twice") were only
reported via checkNamedArgErrorAndReportOverload() when the symbol
was an OverDeclaration (od). Plain function overloads declared in
the same scope use the fd.overnext chain instead, so the
hasOverloads branch in resolveFuncCall() never ran this check and
fell back to the generic "none of the overloads are callable"
message.

Call checkNamedArgErrorAndReportOverload(fd, ...) in that branch
too, since overloadApply() already supports walking fd.overnext.
Comment thread compiler/test/fail_compilation/issue21294.d Outdated
Previously 'parameter X assigned twice' (and similar named-argument
binding errors) were printed as a supplemental line under 'none of
the overloads of X are callable...', followed by a list of
candidates. This was misleading since a duplicate named argument is
invalid regardless of overload resolution.

checkNamedArgErrorAndReportOverload now returns bool and reports the
binding error as the primary diagnostic; callers skip the
'none of the overloads' message and candidate list when it fires.
@usefahmed07
usefahmed07 requested a review from dkorpel September 10, 2026 23:15
Comment thread compiler/src/dmd/funcsem.d
@thewilsonator
thewilsonator merged commit 17a2ccd into dlang:master Sep 12, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unhelpful error message with duplicate named argument when calling overload set

3 participants