-
-
Notifications
You must be signed in to change notification settings - Fork 636
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
Private imports can create conflicts with public imports when using selective imports #18223
Labels
Comments
The following code fails to compile because the selectively imported alias foo = AliasSeq!(int);
import core.time, std.meta;
Originally reported by @crazymonkyyy over there: dlang/phobos#10610 |
0xEAB
added a commit
to 0xEAB/dmd
that referenced
this issue
Jan 5, 2025
…ime` Workaround for: - <dlang#18223> - <dlang/phobos#10610>
0xEAB
added a commit
to 0xEAB/dmd
that referenced
this issue
Jan 5, 2025
…ime` Workaround for: - <dlang#18223> - <dlang/phobos#10610>
0xEAB
added a commit
to 0xEAB/dmd
that referenced
this issue
Jan 5, 2025
…ime` Workaround for: - <dlang#18223> - <dlang/phobos#10610>
0xEAB
added a commit
to 0xEAB/dmd
that referenced
this issue
Jan 5, 2025
…ime` Workaround for: - <dlang#18223> - <dlang/phobos#10610>
the bug is in alias (note selective import is just syntax sugar for static import + alias)
weird. |
thewilsonator
pushed a commit
that referenced
this issue
Jan 5, 2025
…ime` (#20638) Workaround for: - <#18223> - <dlang/phobos#10610>
kinke
pushed a commit
to ldc-developers/ldc
that referenced
this issue
Jan 13, 2025
…ime` (dlang/dmd!20638) Workaround for: - <dlang/dmd#18223> - <dlang/phobos#10610>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Jonathan M Davis (@jmdavis) reported this on 2024-03-26T05:20:08Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=24451
Description
Okay. This is a bit weird, but if we have
This results in
If the import in q.d is changed to
import foo;
then the problem goes away.So, something about how the selective import works makes it so that the symbols from the private import are in the overload set.
I don't know how likely it is for this situation to come up in practice is, but the way that I ran into it was by trying to add the range API functions for arrays to object.d to see what would happen.
Unsurprisingly, there were a bunch of symbol conflicts, but surprisingly, I couldn't fix the symbol conflicts with selective imports from std.range, e.g.
didn't fix anything. On the other hand, selective imports from std.range.primitives did resolve the conflicts, e.g.
So, something about the public import was screwing up the selective import, and the test case here is what I came up with.
With empty being in object.d, it's implicitly imported just like happens in the example here with baz being explicitly imported.
In any case, I don't know how likely it is that this problem would come up normally, but it will affect any conflicts with symbols that we add to object.d in the future, and it affects any symbols that are in there now.
It's just that it would only come up when public imports are involved, and they're less common, though it will definitely cause problems if we ever add the current range API functions to object.d.
The text was updated successfully, but these errors were encountered: