-
-
Notifications
You must be signed in to change notification settings - Fork 611
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 20863 - Passing aggregate types by alias parameter drops qualifier #11320
base: master
Are you sure you want to change the base?
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#11320" |
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!
Looks like the autotester doesn't like it. Can you please take a look? E.g. https://auto-tester.puremagic.com/show-run.ghtml?projectid=1&runid=4093573&isPull=true |
So I think dmd tests are now passing, but there is a wrong assert in Phobos's |
This does look like a somewhat scary change. |
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 is a breaking change that affects production/active projects.
e.g: https://buildkite.com/dlang/dmd/builds/14142#aabac065-d196-4981-bc2b-c796800aebe9/106-432
At the very least need to either deprecate the old behaviour, or pick the -transition or -revert route.
I added a revert switch, I don't think a deprecation can work 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 added a revert switch, I don't think a deprecation can work here.
In the absence of a clear deprecation path then, cannot merge until...
- All downstream projects covered by buildkite are patched and new releases made.
- Changelog entry added saying what was fixed (demonstrating old and new behaviour, link to bugzilla issue), and that this is a breaking change.
- A test for the new -revert switch has been added
- C++ headers have been updated
That's only one, here's the fix: |
Hmm I wonder how many production projects are accurately sampled by buildkite. |
Given that most templates that had to deal with both symbols and types had to use two overloads (one with alias or one with a type), or use a tuple, I'd say the breakage is going to be pretty minimal. I think the vibe.d case is a problem with the unittest possibly. The test was added 7 years ago, and the implementation was changed at that same commit (vibe-d/vibe.d@53b6947). I bet @mihails-strasuns just copied what the thing spit out for the unit test, not really intending it to be so inconsistent. |
Note that this fixes a latent bug in Edit: of course, there is a bug report, I should have looked :) |
@@ -8108,8 +8109,13 @@ MATCH matchArg(TemplateParameter tp, Scope* sc, RootObject oarg, size_t i, Templ | |||
if (sa) | |||
{ | |||
if ((cast(Dsymbol)sa).isAggregateDeclaration()) | |||
{ | |||
// Don't lose type qualifiers |
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'm curious why it lost the qualifiers in the first place.
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 don't want to merge this until I find out why there's a special case for aggregates (the bug doesn't appear for non-aggregates). I suspect the real flaw is elsewhere.
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.
Dsymbols
doesn't have qualifiers and you get one as result of the getDsymbol
call a little above.
We need to investigate why is it there and if it's possible to drop it, or just avoid getting a symbol if the type has any qualifier.
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 find out why the qualifier was stripped only from aggregates in the first place.
@WalterBright any progress on this? This is currently blocking work in phobos |
No description provided.