(Re)Introduce Throwable.message #1895
(Re)Introduce Throwable.message #1895
Conversation
Thanks for your pull request, @nemanja-boric-sociomantic! 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 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. |
9bf4ef3
to
4714a27
Compare
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.
Don't think druntime is the right place to test the implementation of @__future
. There should be proper tests in dmd (hopefully already).
Thanks for taking this off of my hands :D |
@MartinNowak They already are, I'm not testing |
Is there anything else missing? |
No, I think this should be it. @MartinNowak @WalterBright ? |
Oh, except the question if the test is suitable here. |
After rereading the whole discussion in #1445, the main concerns that remain (the breaking change issue should be addressed with use
(*) I would prefer if the signature would be |
Whatever maintainers agree on. I would myself prefer to avoid Keep in mind that D override rules allow to override with more restrictive attributes, but not the other way around. |
But I want to emphasize that we need a decision. We've said before that at this point we don't really care much about what the solution is as long as it fixes our problem. We are already proxying all our code reading exception messages through a function to be able to adapt effortless to what the upstream solution is. We've been going around this problem for years now (literally), we even thought about mechanisms (and wrote a DIP) to avoid any code breakage when implementing this (incidentally the DIP wasn't really implemented, a different solution was implemented but it still solves our problems so at this point we don't even want to fight to get the DIP properly implemented). Please make up your mind soon so we can get over this and finally start moving forward... :) |
Based on the added label, I think it's fair to ping @andralex here... |
*/ | ||
@__future const(char)[] message() const | ||
{ | ||
return this.msg; |
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.
Need a test case to turn the red to green.
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 see all tests in green, or do you mean the green of a review approval?
Also, there are some test cases already included, is there anything in particular you see missing?
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.
Line 1745 above is red. It isn't executed because all the test cases override Throwable.message()
. Need a test case that does not override it, and just calls it.
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.
@leandro-lucarella-sociomantic There is a CodeCov browser extension, which overlays the unittest coverage on top of the diff for pull requests. I think what Walter is saying is that this line doesn't show up as covered by a unittest.
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.
@ZombineDev is right. Here it is: https://github.com/codecov/browser-extension Please install it!
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.
Thanks, had no idea there's an extension, will do it today!
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've started looking into this and it feels something is off with the code coverage - because this is already covered by: https://github.com/dlang/druntime/pull/1895/files#diff-8289be999021da628af8f313e9992573R4 (I even confirmed this with printouts in the line - it sure gets triggered)
Could it be that source of the problem is that code coverage doesn't collect ones from the test suite? IIRC, we have the similar problem in sociomantic's ocean, about the code coverage overriding each other, I wonder if it same here.
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've added the unittest, let's see if that helps
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.
Ok, green now!
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.
[..] it feels something is off with the code coverage - because this is already covered [..]
Not sure if there's a bugzilla issue about this (if not there should be), the reason for this initially not appearing covered is that coverage in external test files is essentially ignored. I think it is a build-system level issue, though I haven't looked in detail.
This patch introduces `Throwable.message` method which returns `Throwable.msg`'s contents. In order to prevent name clashes with the code already defining `message` method inside their own subclasses of Throwable, `Throwable.message` is marked as `@__future`, providing "forward deprecation" message to users.
4714a27
to
54f97e3
Compare
54f97e3
to
3ccc280
Compare
❤️ |
This patch introduces
Throwable.message
method which returnsThrowable.msg
's contents. In order to prevent name clashes with thecode already defining
message
method inside their own subclasses ofThrowable,
Throwable.message
is marked as@__future
, providing"forward deprecation" message to users.