-
-
Notifications
You must be signed in to change notification settings - Fork 609
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 12954 - Deprecated only works with string literals #5302
Conversation
|
| @@ -411,6 +411,11 @@ public: | |||
| { | |||
| assert(msg); | |||
| char* depmsg = null; | |||
| sc = sc.startCTFE(); | |||
| this.msg = this.msg.semantic(sc); | |||
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.
Prefixing with this is not necessary.
714847e to
98ac415
Compare
|
Updated |
| } | ||
|
|
||
| override void semantic2(Scope* sc) | ||
| { | ||
| assert(msg); | ||
| char* depmsg = null; |
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.
Dead code?
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.
RIchtig ! Fixed.
|
This looks ok to me. @9rnsr ? |
| msg = msg.semantic(sc); | ||
| msg = resolveProperties(sc, msg); | ||
| sc = sc.endCTFE(); | ||
| msg = msg.optimize(WANTexpand); |
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 to use msg.ctfeInterpret() instead.
|
Updated according to @9rnsr 's comments:
Also documented the functions and added a small test with a deprecated class + deprecated member to reflect the new implementation. @9rnsr : |
|
Excellent work!
Of course there's no problem. The |
|
#5425 is merged. |
|
Rebased on master, changelog entry added. |
Allow code to use `enum` and `static {immutable,const}` for the deprecation message.
This will allow for more dynamic deprecation message (e.g. with release informations).
It purposedly doesn't support direct function call to get the deprecation message.
|
Thanks! |
|
Auto-merge toggled on |
|
Dlang.org P.R.: dlang/dlang.org#1229 |
Fix issue 12954 - Deprecated only works with string literals
|
Mm, I had overlooked this statement written in the summary.
While the reviewing I've proposed this change.
By that, now any compile time function calls for the custom deprecation message is properly allowed... @Geod24 , why you've thought that function call use has to be rejected as a custom message? I'd just hear your argument. |
I'm very happy with it accepting direct function call. I think it was originally rejected because I was afraid it would cause forward references, but that was down to using |
|
I understand, thanks. |
|
Seems like this introduced a small regression. |
https://issues.dlang.org/show_bug.cgi?id=12954
Allow code to use
enumandstatic {immutable,const}for the deprecation message.This will allow for more dynamic deprecation message (e.g. with release informations).
It purposedly doesn't support direct function call to get the deprecation message.