Stop eagerly generating error message for mismatch arguments#8216
Stop eagerly generating error message for mismatch arguments#8216Geod24 wants to merge 2 commits intodlang:stablefrom
Conversation
|
Thanks for your pull request and interest in making D better, @Geod24! 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 "stable + dmd#8216" |
Interesting. What error do you get? |
bbc7ae3 to
27b747c
Compare
This mostly reverts commit 15b1b50. The aforementioned commit eagerly allocated the error message during call resolution, resulting in a lot of garbage being generated for no reason. Said garbage was never freed, and freeing it seemingly has no effect, maybe because of DMD's memory allocation pattern.
27b747c to
a44c4fa
Compare
|
It's green :) |
|
This pull degrades error messages significantly. What memory usage do you get with my fix? #7554 (comment) If my fix is not sufficient, the proper solution would be to use |
But the test suite is passing. Which means the original pull request was significantly lacking tests. I haven't had a chance to test the fix you proposed yet, but I'm definitely not found of this approach. |
|
@ntrel Can you please submit a PR with your suggestion and sufficient coverage? |
|
|
||
| // disambiguate when toChars() is the same | ||
| auto at = arg.type.toChars(); | ||
| bool qual = !arg.type.equals(par.type) && strcmp(at, par.type.toChars()) == 0; |
There was a problem hiding this comment.
"strcmp must die."
(I am aware that this is moved existing code)
There was a problem hiding this comment.
Not sure what you're quoting. What should it be replaced with?
There was a problem hiding this comment.
Not sure what you're quoting.
Walter from DConf and the mailing list.
What should it be replaced with?
== (with D's strings), though that might be a bit difficult to achieve here as still many places lack the ability to use d strings.
|
(update the C++ headers) |
|
@JinShil I've now submitted #8232. If I have time I might try to improve the test suite.
My pull fixes the only case where an error could be allocated and not used. Returning an error string is necessary, otherwise we would have to combine and return various other data besides just a parameter index. |
| if (failIndex < fargs.dim && failIndex < tf.parameters.dim) | ||
| { | ||
| auto arg = (*fargs)[failIndex]; | ||
| auto par = (*tf.parameters)[failIndex]; |
There was a problem hiding this comment.
failIndex is the argument index, not parameter, so for typesafe variadics with more than one argument, no supplemental error will be shown. (This could be worked around perhaps). I'll send a PR to test this.
The only problem I've found is with typesafe variadics - PR for a test against this branch: Geod24#2 |
|
Now that @ntrel 's PRs have been merged. Is this needed anymore? |
Nope |
Testing here since the testsuite doesn't pass on my machine ¯_(ツ)_/¯
Also, targeting stable because I expect large project to suffer from this a lot.