-
-
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
Allow multiple message arguments for static assert #14611
Conversation
|
Thanks for your pull request and interest in making D better, @ntrel! 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 run digger -- build "master + dmd#14611" |
|
I guess one thing that is a bit weird is that this does not expand sequences: alias Seq(T...)=T;
static assert(false, Seq!("123", "456"));Idk if it's desirable for |
|
@tgehr I just tried calling static assert(false, Seq!("123", 456)); |
Yeah, Ideally this should behave the same way as |
Rebase dlang#11757. initial implementation ws ws fix compileable1 test case fix update frontend.h fix astbase take two
This does behave the same: alias Seq(T...) = T;
pragma(msg, Seq!(int, 0)); // tuple((int), 0) |
I found out that's because the Seq instantiation gets parsed as a ScopeExp, not a TupleExp (or TypeExp) which expandTuples expects. |
| @@ -442,12 +442,19 @@ struct ASTBase | |||
| extern (C++) final class StaticAssert : Dsymbol | |||
| { | |||
| Expression exp; | |||
| Expression msg; | |||
| Expressions* 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.
Maybe call it msgs?
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 this requires many changes it could be left for a subsequent PR.
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.
@RazvanN7 now done and removed style changes. Also there is a spec PR.
|
Looks good to me. cc @WalterBright. Also, mind the spec PR. |
|
@ntrel I assume @WalterBright is busy with other things but I don't think he would oppose this addition. I'm going to go ahead and merge this. |
|
Thanks for getting this in. Should we add a changelog entry for this? |
|
@thewilsonator Thanks for making it originally ;-) The changelog was included: |
Allow multiple message arguments for static assert Signed-off-by: Razvan Nitu <razvan.nitu1305@gmail.com> Merged-on-behalf-of: Razvan Nitu <razvan.nitu1305@gmail.com>
Allow multiple message arguments for static assert Signed-off-by: Razvan Nitu <razvan.nitu1305@gmail.com> Merged-on-behalf-of: Razvan Nitu <razvan.nitu1305@gmail.com>
Reboot of #11757 by @thewilsonator.