Implement ThrowExpression's proposed by DIP 1034#451
Implement ThrowExpression's proposed by DIP 1034#451WebFreak001 merged 1 commit intodlang-community:masterfrom
ThrowExpression's proposed by DIP 1034#451Conversation
src/dparse/ast.d
Outdated
There was a problem hiding this comment.
Not sure what's the proper deprecation process is.
Couldn't mark ThrowStatement as deprecated due to this bug.
There was a problem hiding this comment.
I think it might be best to remove/rename it completely (causing compiler errors) and have the new behavior already and do a version bump. Currently as I see it this change would mean ThrowStatement wouldn't be used at all anymore after some point, causing old code to still compile but no longer work as expected.
There was a problem hiding this comment.
Not sure what's the proper deprecation process is. Couldn't mark
ThrowStatementas deprecated due to this bug.
I found where in dmd it does this check: https://github.com/dlang/dmd/blob/c2b23a3bc73cd8ef7559b86f77f7f9db7ccae507/src/dmd/dsymbolsem.d#L3815
Might take a bit to fix, but it looks pretty low hanging if you want to give it a go.
There was a problem hiding this comment.
[...] ThrowStatement wouldn't be used at all anymore after some point, causing old code to still compile but no longer work as expected.
The idea was to remove ThrowStatement once it's no longer parsed. Any program that has been adapted to ThrowExpression would keep working as expected and could simply remove the ThrowStatement-related code.
But outright removing it now should also be fine - assuming that users can likely transition by replacing ThrowStatement. with ThrowExpression.
There was a problem hiding this comment.
if they dependend on ThrowStatement: (in a visitor)
- if we keep it and also add ThrowExpression, the visit function is likely no longer going to be called as expected anymore or have some changes in accessed member properties (potentially causing silent breakage)
- if we remove it and move all the relevant properties into ThrowExpression, the code will no longer compile and they can see that they need to update their code (loud breakage, no runnable wrong code)
So I think removing it is the better choice.
sadly I don't think we can alias ThrowStatement to some broken type to cause additional error messages, which would be optimal in guiding users how to upgrade.
There was a problem hiding this comment.
The old ThrowStatement is now an alias to ThrowExpression and the field names are now identical. So existing code referencing ThrowStatement should keep working with a deprecation message.
d40ddbe to
33b9429
Compare
Codecov Report
@@ Coverage Diff @@
## master #451 +/- ##
===========================================
- Coverage 82.66% 45.09% -37.57%
===========================================
Files 11 11
Lines 8280 8306 +26
===========================================
- Hits 6845 3746 -3099
- Misses 1435 4560 +3125
Continue to review full report at Codecov.
|
33b9429 to
a80fb80
Compare
Replaces `ThrowStatement`'s with `ThrowExpression`'s which may appear nested into any other declaration.
a80fb80 to
6e92f3b
Compare
|
Ping. The implementation & documentation was merged upstream |
ThrowExpression's replaceThrowStatement's which may appear nested into any other declaration.