Bug 12694 – Better error message for function call matching more than two overloads

Status
ASSIGNED
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-05-02T23:22:46Z
Last change time
2024-12-13T18:20:22Z
Keywords
diagnostic
Assigned to
wolframw
Creator
bearophile_hugs
See also
https://issues.dlang.org/show_bug.cgi?id=2789
Moved to GitHub: dmd#18824 →

Comments

Comment #0 by bearophile_hugs — 2014-05-02T23:22:46Z
void bar(float) {} void bar(double) {} void bar(real) {} void main() { bar(1); } Gives in dmd 2.066alpha: temp.d(5,8): Error: temp.bar called with argument types (int) matches both: temp.d(1,6): temp.bar(float _param_0) and: temp.d(3,6): temp.bar(real _param_0) I suggest to list all overloads and remove the word "both". I suggest to use a visual output similar to the one generated fixing Issue 8101 , that gives errors that look like this: temp.d(7,5): Error: None of the overloads of 'foo' are callable using argument types (), candidates are: temp.d(1,6): temp.foo(int _param_0) temp.d(2,6): temp.foo(int _param_0, int _param_1) So I suggest an error message like: temp.d(5,8): Error: call to 'bar' with argument types (int) matches more than one overload, candidates are: temp.d(1,6): test.bar(float _param_0) temp.d(2,6): test.bar(double _param_0) temp.d(3,6): test.bar(real _param_0) I think it's useful to improve such error messages because calling functions is one of the most basic and common operations you do in D. See also Issue 2789 .
Comment #1 by robert.schadek — 2024-12-13T18:20:22Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18824 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB