Skip to content

Commit

Permalink
fix Issue 15402 - allow private access to package symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinNowak committed Apr 9, 2016
1 parent 1aa8a1e commit c424690
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/access.d
Expand Up @@ -492,7 +492,7 @@ extern (C++) bool symbolIsVisible(Module mod, Dsymbol s)
case PROTundefined: return true;
case PROTnone: return false; // no access
case PROTprivate: return s.getAccessModule() == mod;
case PROTpackage: return hasPackageAccess(mod, s);
case PROTpackage: return s.getAccessModule() == mod || hasPackageAccess(mod, s);
case PROTprotected: return s.getAccessModule() == mod;
case PROTpublic, PROTexport: return true;
}
Expand Down Expand Up @@ -533,7 +533,7 @@ extern (C++) bool symbolIsVisible(Scope *sc, Dsymbol s)
case PROTundefined: return true;
case PROTnone: return false; // no access
case PROTprivate: return sc._module == s.getAccessModule();
case PROTpackage: return hasPackageAccess(sc._module, s);
case PROTpackage: return sc._module == s.getAccessModule() || hasPackageAccess(sc._module, s);
case PROTprotected: return hasProtectedAccess(sc, s);
case PROTpublic, PROTexport: return true;
}
Expand Down
12 changes: 12 additions & 0 deletions test/compilable/test15402.d
@@ -0,0 +1,12 @@
// REQUIRED_ARGS: -de

struct S
{
package int field;
}

void test()
{
S s;
s.field = 1;
}

1 comment on commit c424690

@PetarKirov
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MartinNowak it looks like you made a branch in the official repo, instead of in your own. This tricked Bugzilla into thinking that the bug was "fixed".

Please sign in to comment.