[Issue 20229] New: Importing a second module enables FQN sidestepping selective import
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Sep 19 07:38:52 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20229
Issue ID: 20229
Summary: Importing a second module enables FQN sidestepping
selective import
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: simen.kjaras at gmail.com
unittest {
import std.complex : complex;
static assert(!__traits(compiles, { alias a = std.complex.abs; }));
}
unittest {
import std.complex : complex;
import std.internal.test.uda; // module with no imports
static assert(__traits(compiles, { alias a = std.complex.abs; }));
}
In the first block above, we can't refer to std.complex.abs, as it's not
imported by the selective import statement. In the second block however, the
presence of a second, non-selective, import statement makes std.complex.abs
accessible again.
Note that the module selected has no imports, and it's thus not a case of
referring to imports in that imported module.
Note also that the name of the second module is important - it needs to be in
the same package as the first imported module. I tested with a module called
`bar`, and the static assert correctly triggered, but renaming the module to
std.bar (still an empty file) made it compile again.
--
More information about the Digitalmars-d-bugs
mailing list