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

RazvanN <razvan.nitu1...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|                            |razvan.nitu1...@gmail.com
         Resolution|---                         |FIXED

--- Comment #2 from RazvanN <razvan.nitu1...@gmail.com> ---
(In reply to Jarrett Billingsley from comment #0)
> -------- modules/mymod.d ----------
> 
> module modules.mymod;
> 
> package int foo;
> 
> package void bar()
> {
> 
> }
> 
> -------- modules/level/test.d ----------
> 
> module modules.level.test;
> 
> import modules.mymod;
> 
> void f()
> {
>       foo = 1;
>       bar();
> }
> 
> ----------------------------------------
> 
> Compiling those gives an error when trying to access bar() from test, but
> accessing foo is OK.
> 
> Moreover, 
> 
> -------- modules/mymod2.d ----------
> 
> module modules.mymod2; // notice it's in the same package as mymod
> 
> import modules.mymod;
> 
> void f()
> {
>       foo = 1;
>       bar();
> }
> 
> --------------------------------------
> 
> Works, as expected, just fine.
> 
> If I'm reading the spec correctly, neither foo or bar() should be accessible
> from test, as only modules in the same package (i.e. other modules in the
> "modules" package; test is in "modules.level") should be able to access them.
> 
> I'm flagging this as accepts-invalid, as you can access foo, when I don't
> think you should.

Compiling both examples on Ubuntu 16.04 and Windows (via wine) with git HEAD
results in successful compilation as it should. modules/level/test is a
subpackage of the package modules and is considered to be in the same package
as mymod. Therefore, both package members bar and foo should be accesible and
they are. Closing as fixed.

--

Reply via email to