www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21895] New: Module in package incorrectly accessible when it

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

          Issue ID: 21895
           Summary: Module in package incorrectly accessible when it was
                    not explicitly imported
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: eyal weka.io

With the following separate modules defined:

-----------------

  module pkg.a;

-----------------

  module pkg.b;

  import pkg.a;

-----------------

  module test;

  import pkg.b;

  // pkg.a is now incorrectly usable, without being imported

-----------------

If we remove the import of pkg.a in pkg.b, then module test suddenly does need
to import pkg.a.

Whether or not 'pkg.b' imports 'pkg.a' is an implementation detail of 'pkg.b',
so should not affect module 'test's accessibility of 'pkg.a'.

--
May 06 2021