www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21589] New: Mixing public and local selective imports causes

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 puremagic.com
          Reporter: bradley.chatha 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(){}
```

--
Jan 28