Skip to content

Commit

Permalink
Revert "Fix Issue 15896 - private ignored when import bindings are used"
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberShadow committed Apr 3, 2017
1 parent fbddd24 commit 423c522
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 30 deletions.
16 changes: 4 additions & 12 deletions src/ddmd/dimport.d
Expand Up @@ -13,7 +13,6 @@ module ddmd.dimport;
import core.stdc.string;
import core.stdc.stdio;

import ddmd.access;
import ddmd.arraytypes;
import ddmd.declaration;
import ddmd.dmodule;
Expand Down Expand Up @@ -253,7 +252,7 @@ extern (C++) final class Import : Dsymbol
if (mod)
{
// Modules need a list of each imported module
//printf("%s imports %s\n", sc._module.toChars(), mod.toChars());
//printf("%s imports %s\n", sc.module.toChars(), mod.toChars());
sc._module.aimports.push(mod);

if (sc.explicitProtection)
Expand Down Expand Up @@ -304,15 +303,10 @@ extern (C++) final class Import : Dsymbol
for (size_t i = 0; i < aliasdecls.dim; i++)
{
AliasDeclaration ad = aliasdecls[i];
//printf("\tImport %s alias %s = %s, scope = %p\n", toPrettyChars(), aliasdecls[i].toChars(), names[i].toChars(), ad._scope);
Dsymbol importedSymbol = mod.search(loc, names[i]);
if (importedSymbol)
//printf("\tImport %s alias %s = %s, scope = %p\n", toPrettyChars(), aliases[i].toChars(), names[i].toChars(), ad._scope);
if (mod.search(loc, names[i]))
{
// BUGZILLA 15896 : if symbol is private then it shouldn't be accessed
if(importedSymbol.prot().kind == PROTprivate)
mod.error(loc, "member '%s' is private", names[i].toChars());
else
ad.semantic(sc);
ad.semantic(sc);
// If the import declaration is in non-root module,
// analysis of the aliased symbol is deferred.
// Therefore, don't see the ad.aliassym or ad.type here.
Expand All @@ -321,9 +315,7 @@ extern (C++) final class Import : Dsymbol
{
Dsymbol s = mod.search_correct(names[i]);
if (s)
{
mod.error(loc, "import '%s' not found, did you mean %s '%s'?", names[i].toChars(), s.kind(), s.toChars());
}
else
mod.error(loc, "import '%s' not found", names[i].toChars());
ad.type = Type.terror;
Expand Down
2 changes: 1 addition & 1 deletion src/ddmd/expression.d
Expand Up @@ -6584,7 +6584,7 @@ extern (C++) final class VarExp : SymbolExp
* problems when instantiating imported templates passing private
* variables as alias template parameters.
*/
//checkAccess(loc, sc, null, var);
//checkAccess(loc, sc, NULL, var);

if (auto vd = var.isVarDeclaration())
{
Expand Down
14 changes: 0 additions & 14 deletions test/fail_compilation/fail15896.d

This file was deleted.

3 changes: 0 additions & 3 deletions test/fail_compilation/imports/imp15896.d

This file was deleted.

0 comments on commit 423c522

Please sign in to comment.