Fix Issue 21294: Improve unhelpful error message with duplicate named argument in overload set#22804
Fix Issue 21294: Improve unhelpful error message with duplicate named argument in overload set#22804shivajigandham wants to merge 6 commits intodlang:masterfrom
Conversation
|
Thanks for your pull request and interest in making D better, @shivajigandham! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.
|
|
It appears that you may have misunderstood what supplemental messages are. They are basically additional lines of output. |
Fixes #21294
Description
When calling an overload set with a duplicate named argument (e.g.,
fun(a: 1, a: 2)), the compiler previously reported a generic "none of the overloads are callable" error. This happened because the specific error fromresolveNamedArgswas being treated as a supplemental error and then masked by the primary resolution failure.This PR:
checkNamedArgErrorAndReportOverloadto check all candidates in an overload set.aassigned twice"), it promotes that error to a primary error.resolveFuncCallto respect these primary errors and avoid printing redundant "none of the overloads are callable" messages.This results in much clearer diagnostics for duplicate named arguments in overloaded functions.