-
-
Notifications
You must be signed in to change notification settings - Fork 608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve error message for when we pass wrong arguments to a function #13366
Conversation
|
Thanks for your pull request and interest in making D better, @ryuukk! 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. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#13366" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to change the tests that are making this fail accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Can we really not have one error == one line here?
- Avoid mixing tabs and spaces.
- Do we use
%*sas a format specifier in other errors? (Meaning, has it been vetted as a portable format to use).
| fd.kind(), fdPC, parametersTypeToChars(tf.parameterList), | ||
| tf.modToChars(), pIndex, cast(const(char)*) "", fargsBuf.peekChars()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you prepended a space by mistake in both lines
i'll look into it, thanks
It wasn't really readable before as a one line
I'll fix that
I have no idea.. |
You can use |
I mean, you can break up an error into multiple lines using errorSupplemental for subsequent messages. |
|
Awesome that you're looking into improving diagnostic! Could we somehow utilize alignment to make it easier to spot which parameter (index) that is fed the wrong parameter? |
|
I have another request which might belong in a separate PR, namely: The code snippet void f(T)(int x) {}
unittest { f(42); }currently erroring as could also include a . |
thanks!
i will do that! that was initially the goal, to put arrows to display wich one is the problem, or maybe put some color, but i'm not familiar with the code base and i got distracted by my wasm project, that's something definitely worth trying, i will try to find some time and finish this little side project of mine! |
|
@ryuukk any progress on this? |
|
@RazvanN7 i am still busy working on my WASM project, also some people raised some interesting point on IRC that i need to take into consideration So i want to improve it further |
%*s is specified in c89. It is not used as such elsewhere in dmd, but %.*s is used; so the feature is still required. |
I think it looks better!