[refactor] Simplify parameter mismatch error code#8263
[refactor] Simplify parameter mismatch error code#8263dlang-bot merged 2 commits intodlang:masterfrom
Conversation
|
Thanks for your pull request and interest in making D better, @ntrel! 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 fetch digger
dub run digger -- build "master + dmd#8263" |
| const rv = !arg.isLvalue() && par.storageClass & (STC.ref_ | STC.out_); | ||
| const char* fmt = rv ? | ||
| "cannot pass rvalue argument `%s` of type `%s` to parameter `%s`" : | ||
| "cannot pass argument `%s` of type `%s` to parameter `%s`"; |
There was a problem hiding this comment.
Seems a bit unnecessary to duplicate the whole format string when the only difference is rvalue. Perhaps rvalue can be passed as a parameter to printf as well?
There was a problem hiding this comment.
Yep, last time I tried something in this direction, it was complained that this increases the binary size.
It's just "cannot pass%s" and then rv ? " rvalue" : "", no?
There was a problem hiding this comment.
Cool. Would you mind submitting it as PR too? Thanks!
OutBufferinstead of 3, reducing memory allocations.