[Issue 21589] New: Mixing public and local selective imports causes behaviour differences
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jan 28 13:19:18 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=21589
Issue ID: 21589
Summary: Mixing public and local selective imports causes
behaviour differences
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: bradley.chatha at gmail.com
Relevent forum post:
https://forum.dlang.org/post/yoyoxqhqtesbmqkngbrx@forum.dlang.org
Code snippet 1:
```
import std;
public import std.typecons : Nullable;
import std.typecons : Nullable;
alias T = Nullable!int;
// onlineapp.Nullable or std.typecons.Nullable
// depending on whether the public import exists or not
pragma(msg, fullyQualifiedName!Nullable);
// false if the public import exists, true otherwise.
pragma(msg, isInstanceOf!(Nullable, T));
void main(){}
```
Code snippet 2:
```
import std;
public import std.typecons : Nullable;
import std.typecons : Nullable;
alias T = Nullable!int;
void fails()
{
// false
pragma(msg, isInstanceOf!(Nullable, T));
}
void passes()
{
// true
import std.typecons : Nullable;
pragma(msg, isInstanceOf!(Nullable, T));
}
void main(){}
```
--
More information about the Digitalmars-d-bugs
mailing list