-
-
Notifications
You must be signed in to change notification settings - Fork 608
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 20008 - __traits(allMembers) of packages is complete nonsense #15335
Conversation
|
Thanks for your pull request and interest in making D better, @dkorpel! 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#15335" |
|
This is silently changing the behavior of __traits(allMembers) on imports. Not sure what to do about that. Also, couldn't |
6cedde9
to
cf7ac33
Compare
I sure hope nobody was relying on the nonsensical behavior of
Not sure, it gets set when the module is loaded. There's this piece of code in if (Import imp = s.isImport())
{
if (!imp.pkg)
{
.error(loc, "forward reference of import `%s`", imp.toChars());
return ErrorExp.get();
}
auto ie = new ScopeExp(loc, imp.pkg);
return ie.expressionSemantic(sc);
}But there's no test case for that error. I added a check to be safe. |
|
@RazvanN7 To clarify, the Now I have no idea why it works like that, but |
|
I think that this happened because module pkg20008;
import pkg20008.submod;
enum T2 { y }
enum T3 { z }
static assert([__traits(allMembers, pkg20008)] == ["object", "pkg20008", "T2", "T3"]);
Arguably, |
It also happens when you import
True, but this PR doesn't touch the generation of members for a module.
That's not how any other trait works. |
No description provided.