Issue 9631 - Error message not using fully qualified name (part 2)#7441
Issue 9631 - Error message not using fully qualified name (part 2)#7441dlang-bot merged 3 commits intodlang:masterfrom
Conversation
|
Thanks for your pull request, @ntrel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Some tips to help speed things up:
Bear in mind that large or tricky changes may require multiple rounds of review and revision. Please see CONTRIBUTING.md for more information. Bugzilla references
|
966bd8a to
41078c6
Compare
| } | ||
| else if (e1.type.equals(e2.type)) | ||
| { | ||
| error("incompatible types for ((%s) %s (%s)): both operands are of type '%s'", |
There was a problem hiding this comment.
I think it would be better to denote that the operator %s cannot be used for two variables of type %s.
But maybe in another PR ?
41078c6 to
e233e2e
Compare
Disambiguate incompatible type errors. Add "both operands are of type '%s'" error message.
e233e2e to
cf01f68
Compare
| if (e1.op == TOKtype || e2.op == TOKtype) | ||
| { | ||
| error("incompatible types for ((%s) %s (%s)): cannot use '%s' with types", e1.toChars(), Token.toChars(thisOp), e2.toChars(), Token.toChars(op)); | ||
| error("incompatible types for ((%s) %s (%s)): cannot use '%s' with types", |
There was a problem hiding this comment.
I think we can change ((%s) %s (%s)) to `(%s) %s (%s)`. That is, lose the outer parentheses and surround the expression in back ticks.
There was a problem hiding this comment.
Also, those single quotes should be backticks.
There was a problem hiding this comment.
I agree, but I was just following the existing format for these errors. I'll do as you suggest for the new error added in this PR, but the other ones can be fixed in a separate PR.
| a.x = x; | ||
| a.y = y; | ||
| return a; | ||
| } |
There was a problem hiding this comment.
It doesn't seem relevant to the test - should I restore it?
There was a problem hiding this comment.
Yes, it does seem unnecessary, but I don't think it belongs in this PR.
| F x = tem!().F(); | ||
| } | ||
|
|
||
| void main() |
There was a problem hiding this comment.
Why the refactoring of this test case? There should only be changes to the error messages.
There was a problem hiding this comment.
I thought it was a bit simpler whilst still essentially testing the same thing. But I suppose it may be worth having both the two template version and the new changes.
There was a problem hiding this comment.
Restored the two template version.
src/dmd/expression.d
Outdated
| } | ||
| else if (e1.type.equals(e2.type)) | ||
| { | ||
| error("invalid operation for `(%s) %s (%s)` with both operands of type `%s`", |
There was a problem hiding this comment.
the error message is still bad. My first review comment was more accurate. Maybe:
"the
%soperator is not supported for two operands of type%s((%s) %s (%s))".
There was a problem hiding this comment.
I'm not sure there's much difference, but if necessary I'll update it.
f73a72b to
51b0dce
Compare
|
I've reverted the rewording of the new error message, so it now just follows the existing format, and does not use backticks. The backtick change should be done in a separate PR as it affects about 8 error messages in dmd, I could do it if this gets merged soon. |
| if (e1.op == TOKtype || e2.op == TOKtype) | ||
| { | ||
| error("incompatible types for ((%s) %s (%s)): cannot use '%s' with types", e1.toChars(), Token.toChars(thisOp), e2.toChars(), Token.toChars(op)); | ||
| error("incompatible types for ((%s) %s (%s)): cannot use '%s' with types", |
There was a problem hiding this comment.
This error message doesn't seem to have a test case.
There was a problem hiding this comment.
@JinShil What about fail_compilation/fail54.d and fail_compilation/ice8511.d?
There was a problem hiding this comment.
Sorry, I realize that error message didn't actually change.
|
Thanks for reviewing.
See #7464. |
@JinShil Following on from #7405.
The latter saves the programmer time reading the error when there are two types with long qualification.