www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Weird interaction with public and non-public imports

reply SealabJaster <sealabjaster gmail.com> writes:
Please see: https://run.dlang.io/is/2mwcPH

I'd expect that the `isInstanceOf` would be true instead of false 
here.

Commenting out the public import changes the output of 
`fullyQualifiedName`. I can kind of see why this happens, but 
it's kind of annoying when things like `isInstanceOf` silently 
fail due to this.

For context: I found this after getting a compiler error after 
stitching a bunch of D files together, which is why there's a mix 
of a public import and local import in the same file.

Part of me feels like it's a bug since if the alias `T` is using 
one "version" (for lack of a better word) of `Nullable`, then 
surely that same "version" would be given to `isInstanceOf`?

It can get a bit more interesting as well: 
https://run.dlang.io/is/n5jzJs
Jan 28
parent reply Paul Backus <snarwin gmail.com> writes:
On Thursday, 28 January 2021 at 13:07:13 UTC, SealabJaster wrote:
 Please see: https://run.dlang.io/is/2mwcPH

 I'd expect that the `isInstanceOf` would be true instead of 
 false here.

 Commenting out the public import changes the output of 
 `fullyQualifiedName`. I can kind of see why this happens, but 
 it's kind of annoying when things like `isInstanceOf` silently 
 fail due to this.
Looks like a bug to me. I recommend filing a bug report on issues.dlang.org.
Jan 28
parent SealabJaster <sealabjaster gmail.com> writes:
On Thursday, 28 January 2021 at 13:13:46 UTC, Paul Backus wrote:
 ...
https://issues.dlang.org/show_bug.cgi?id=21589 These issues are always so subtle and specific yet so annoying, e.g.: https://issues.dlang.org/show_bug.cgi?id=21496 and https://issues.dlang.org/show_bug.cgi?id=21377
Jan 28