Thread overview
[Issue 19144] Imported package have different protection depending on how it's accessed
Sep 28, 2018
RazvanN
Dec 17, 2022
Iain Buclaw
September 28, 2018
https://issues.dlang.org/show_bug.cgi?id=19144

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305@gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305@gmail.com> ---
The matter of fact is that `__traits(getMember, file1, "std")` sees file1.std as a package, while getProtection sees file1.std as an import. `__traits(isSame)` compares them equally because [1] made it smart enough to compare them.

The situation is a bit complicated because you cannot identify imports by their first package. Consider this example:

//file1.d
public import std.stdio;
private import std.traits;

//file2.d
pragma(msg, __traits(getProtection, file1.std));

The invocation in file2 is ambiguous in this situation. However, if getProtection would consider file.std as a package and not an import it would pretty much become useless because the module itself is always public. I think that we need to come up with a way of identifying imports.

[1] https://github.com/dlang/dmd/pull/7095/files

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=19144

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
December 13
https://issues.dlang.org/show_bug.cgi?id=19144

--- Comment #2 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19474

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--