[Issue 15086] import doesn't verify module declaration

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 12 04:11:35 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=15086

Andrei Alexandrescu <andrei at erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei at erdani.com

--- Comment #3 from Andrei Alexandrescu <andrei at erdani.com> ---
(In reply to Timothee Cour from comment #2)
> just ran into this again, this is a serious hole in the D module system.
> 
> Here was the example i was gonna report:
> 
> 
> ```dmd -I. main.d
> main
> bar // BUG! was imported as foo.bar (inconsistent)
> foo.bar2
> asdf.wrong // BUG! was imported as foo.bar (inconsistent)
> ```
> 
> ```pragma(msg, __MODULE__);
> import foo.bar;
> import foo.bar2;
> import foo.bar3;
> void main(){}
> 
> cat foo/bar.d
> pragma(msg, __MODULE__);
> cat foo/bar2.d
> 
> cat foo/bar2.d
> module foo.bar2;
> pragma(msg, __MODULE__);
> 
> cat foo/bar3.d
> module asdf.wrong;
> pragma(msg, __MODULE__);
> ```
> 
> 
> 
> LINKS:
> https://github.com/dlang/dmd/pull/7778 Bug fix: dmd allows importing modules
> with wrong name #7778

Can you please reorganize the examples? It is difficult to understand which
files have which content. Thanks!

--


More information about the Digitalmars-d-bugs mailing list