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 21570 - Deprecate __traits(isStaticArray, ...) accepts enums... #12142
Fix Issue 21570 - Deprecate __traits(isStaticArray, ...) accepts enums... #12142
Conversation
7d8fa14
to
f9e30b3
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.
This requires a changelog entry and a deprecation as it is silently changing behavior. Looks good otherwise.
Also, it looks like there are some public examples that need to be updated. Later edit: Hm... it seems that this might not be a bug? Look at this documentation example [1]. From the is expression perspective those are different types, however, it seems that traits(isStaticArray) |
How should that deprecation work? Retain the current behaviour and issue a deprecation message for
Those examples were added long after the introduction of |
Yes.
|
f9e30b3
to
4a42236
Compare
Thanks for your pull request and interest in making D better, @MoonlightSentinel! 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#12142" |
Why did you delete |
Because this PR just adds a warning for the user, the current behaviour remains unchanged, But I can re-add the fix if preferred. |
My point was that the deprecation should close the issue. An action was taken (i.e. the behavior is deprecated and will be changed) and the bug report no longer has any usefulness. So please re-add the "Fix" keyword. |
4a42236
to
0ff7f5a
Compare
Fair enough |
Can you also, please, add a changelog entry? |
...with static array as base type. The spec[1] states that a named enum creates a distinct type which is implicitly convertible to it's base type. Hence `__traits(isStaticArray, <enum>)` should yield `false` as done for an equivalent `is(...)` expression. [1] https://dlang.org/spec/enum.html#named_enums
0ff7f5a
to
a0156e0
Compare
Sorry, see |
This would also require a spec change . Specifically, this: https://dlang.org/spec/traits.html#isStaticArray |
After discussing with Walter, it seems that this is not actually a bug. |
...with static array as base type.
The spec[1] states that a named enum creates a distinct type which is
implicitly convertible to it's base type. Hence
__traits(isStaticArray, <enum>)
should yield
false
as done for an equivalentis(...)
expression.[1] https://dlang.org/spec/enum.html#named_enums