-
-
Notifications
You must be signed in to change notification settings - Fork 610
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
Fix Issue 18985 - bad error message for += operation on shared Object #8360
Conversation
|
Thanks for your pull request and interest in making D better, @RazvanN7! 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 references
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#8360" |
src/dmd/expressionsem.d
Outdated
| if (exp.checkScalar()) | ||
|
|
||
| AggregateDeclaration ad = isAggregate(exp.e1.type); | ||
| Dsymbol s; |
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 be moved into the if clause.
src/dmd/expressionsem.d
Outdated
| if (ad) | ||
| { | ||
| s = search_function(ad, Id.opOpAssign); | ||
| if (s) |
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 be moved into one combined line: if (auto s = ...)
src/dmd/expressionsem.d
Outdated
| { | ||
| error(exp.loc, "none of the `opOpAssign` overloads of `%s` are callable for `%s` of type `%s`", ad.toChars(), exp.e1.toChars(), exp.e1.type.toChars()); | ||
| return setError(); | ||
| } |
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.
Not sure that is correct. Consider the case where a user defines both a shared and a non-shared opOpAssign.
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.
If that is the case, then this code block is not going to get reached because op_overload [1] will either find the corresponding opOpAssign or it will error.
[1] https://github.com/dlang/dmd/blob/master/src/dmd/expressionsem.d#L4109
No description provided.