diff --git a/changelog/import_deprecations.dd b/changelog/import_deprecations.dd new file mode 100644 index 000000000000..4bf488ff61c0 --- /dev/null +++ b/changelog/import_deprecations.dd @@ -0,0 +1,5 @@ +the deprecation phase for visiblity and lookup changes is finished + +The -transition=import and -transition=checkimports switches no longer have an +effect and are now deprecated. Symbols that are not visible in a particular +scope will no longer be found by the compiler. diff --git a/docs/gen_man.d b/docs/gen_man.d index 432e92ec1f0c..42d702525470 100644 --- a/docs/gen_man.d +++ b/docs/gen_man.d @@ -127,6 +127,8 @@ void main() Language changes listed by \fB-transition=id\fR:`); foreach (transition; Usage.transitions) { + if (transition.deprecated_) + continue; string additionalOptions; if (transition.bugzillaNumber) additionalOptions = "," ~ transition.bugzillaNumber; diff --git a/src/dmd/cli.d b/src/dmd/cli.d index b08ab26457fb..c3ed7b97c011 100644 --- a/src/dmd/cli.d +++ b/src/dmd/cli.d @@ -570,8 +570,9 @@ dmd -cov -unittest myprog.d { string bugzillaNumber; /// bugzilla issue number (if existent) string name; /// name of the transition - string paramName; // internal transition parameter name - string helpText; // detailed description of the transition + string paramName; /// internal transition parameter name + string helpText; /// detailed description of the transition + bool deprecated_; /// whether the flag is still in use } /// Returns all available transitions @@ -579,9 +580,9 @@ dmd -cov -unittest myprog.d Transition("3449", "field", "vfield", "list all non-mutable fields which occupy an object instance"), Transition("10378", "import", "bug10378", - "revert to single phase name lookup"), + "revert to single phase name lookup", true), Transition(null, "checkimports", "check10378", - "give deprecation messages about 10378 anomalies"), + "give deprecation messages about 10378 anomalies", true), Transition("14488", "complex", "vcomplex", "give deprecation messages about all usages of complex or imaginary types"), Transition("16997", "intpromote", "fix16997", @@ -658,6 +659,8 @@ CPU architectures supported by -mcpu=id: "list information on all language changes")] ~ Usage.transitions; foreach (t; allTransitions) { + if (t.deprecated_) + continue; buf ~= " ="; buf ~= t.name; auto lineLength = 3 + t.name.length; diff --git a/src/dmd/dscope.d b/src/dmd/dscope.d index b35482d5e2d2..ef38c6f15522 100644 --- a/src/dmd/dscope.d +++ b/src/dmd/dscope.d @@ -528,19 +528,6 @@ struct Scope if (this.flags & SCOPE.ignoresymbolvisibility) flags |= IgnoreSymbolVisibility; - Dsymbol sold = void; - if (global.params.bug10378 || global.params.check10378) - { - sold = searchScopes(flags | IgnoreSymbolVisibility); - if (!global.params.check10378) - return sold; - - if (ident == Id.dollar) // https://issues.dlang.org/show_bug.cgi?id=15825 - return sold; - - // Search both ways - } - // First look in local scopes Dsymbol s = searchScopes(flags | SearchLocalsOnly); version (LOGSEARCH) if (s) printMsg("-Scope.search() found local", s); @@ -549,68 +536,10 @@ struct Scope // Second look in imported modules s = searchScopes(flags | SearchImportsOnly); version (LOGSEARCH) if (s) printMsg("-Scope.search() found import", s); - - /** Still find private symbols, so that symbols that weren't access - * checked by the compiler remain usable. Once the deprecation is over, - * this should be moved to search_correct instead. - */ - if (!s && !(flags & IgnoreSymbolVisibility)) - { - s = searchScopes(flags | SearchLocalsOnly | IgnoreSymbolVisibility); - if (!s) - s = searchScopes(flags | SearchImportsOnly | IgnoreSymbolVisibility); - - if (s && !(flags & IgnoreErrors)) - .deprecation(loc, "%s is not visible from module %s", s.toPrettyChars(), _module.toChars()); - version (LOGSEARCH) if (s) printMsg("-Scope.search() found imported private symbol", s); - } - } - if (global.params.check10378) - { - alias snew = s; - if (sold !is snew) - deprecation10378(loc, sold, snew); - if (global.params.bug10378) - s = sold; } return s; } - /* A helper function to show deprecation message for new name lookup rule. - */ - extern (C++) static void deprecation10378(Loc loc, Dsymbol sold, Dsymbol snew) - { - // https://issues.dlang.org/show_bug.cgi?id=15857 - // - // The overloadset found via the new lookup rules is either - // equal or a subset of the overloadset found via the old - // lookup rules, so it suffices to compare the dimension to - // check for equality. - OverloadSet osold, osnew; - if (sold && (osold = sold.isOverloadSet()) !is null && - snew && (osnew = snew.isOverloadSet()) !is null && - osold.a.dim == osnew.a.dim) - return; - - OutBuffer buf; - buf.writestring("local import search method found "); - if (osold) - buf.printf("%s %s (%d overloads)", sold.kind(), sold.toPrettyChars(), cast(int) osold.a.dim); - else if (sold) - buf.printf("%s %s", sold.kind(), sold.toPrettyChars()); - else - buf.writestring("nothing"); - buf.writestring(" instead of "); - if (osnew) - buf.printf("%s %s (%d overloads)", snew.kind(), snew.toPrettyChars(), cast(int) osnew.a.dim); - else if (snew) - buf.printf("%s %s", snew.kind(), snew.toPrettyChars()); - else - buf.writestring("nothing"); - - deprecation(loc, buf.peekString()); - } - extern (C++) Dsymbol search_correct(Identifier ident) { if (global.gag) @@ -651,6 +580,10 @@ struct Scope return cast(void*)s; } + Dsymbol scopesym = null; + // search for exact name ignoring visibility first + if (auto s = search(Loc(), ident, &scopesym, IgnoreErrors | IgnoreSymbolVisibility)) + return s; return cast(Dsymbol)speller(ident.toChars(), &scope_search_fp, idchars); } diff --git a/src/dmd/dsymbol.d b/src/dmd/dsymbol.d index 0f5dc5c50ff1..3c56178cd220 100644 --- a/src/dmd/dsymbol.d +++ b/src/dmd/dsymbol.d @@ -660,6 +660,9 @@ extern (C++) class Dsymbol : RootObject if (global.gag) return null; // don't do it for speculative compiles; too time consuming + // search for exact name ignoring visibility first + if (auto s = search(Loc(), ident, IgnoreErrors | IgnoreSymbolVisibility)) + return s; return cast(Dsymbol)speller(ident.toChars(), &symbol_search_fp, idchars); } @@ -705,7 +708,8 @@ extern (C++) class Dsymbol : RootObject { sm = s.search_correct(ti.name); if (sm) - .error(loc, "template identifier `%s` is not a member of %s `%s`, did you mean %s `%s`?", ti.name.toChars(), s.kind(), s.toPrettyChars(), sm.kind(), sm.toChars()); + .error(loc, "template identifier `%s` is not a member of %s `%s`, did you mean %s%s `%s`?", + ti.name.toChars(), s.kind(), s.toPrettyChars(), sm.ident == ti.name ? "non-visible ".ptr : "".ptr, sm.kind(), sm.toChars()); else .error(loc, "template identifier `%s` is not a member of %s `%s`", ti.name.toChars(), s.kind(), s.toPrettyChars()); return null; @@ -1300,10 +1304,8 @@ public: { if (flags & SearchImportsOnly) continue; - // compatibility with -transition=import - // https://issues.dlang.org/show_bug.cgi?id=15925 - // SearchLocalsOnly should always get set for new lookup rules - sflags |= (flags & SearchLocalsOnly); + // only search locals, but not imports in mixin templates + sflags |= SearchLocalsOnly; } /* Don't find private members if ss is a module diff --git a/src/dmd/dsymbolsem.d b/src/dmd/dsymbolsem.d index 2f1b214650fa..dccfbdf7d27c 100644 --- a/src/dmd/dsymbolsem.d +++ b/src/dmd/dsymbolsem.d @@ -1160,7 +1160,8 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor { Dsymbol s = imp.mod.search_correct(imp.names[i]); if (s) - imp.mod.error(imp.loc, "import `%s` not found, did you mean %s `%s`?", imp.names[i].toChars(), s.kind(), s.toPrettyChars()); + imp.mod.error(imp.loc, "import `%s` not found, did you mean %s%s `%s`?", + imp.names[i].toChars(), s.ident == imp.names[i] ? "non-visible ".ptr : "".ptr, s.kind(), s.toPrettyChars()); else imp.mod.error(imp.loc, "import `%s` not found", imp.names[i].toChars()); ad.type = Type.terror; @@ -3145,7 +3146,8 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor } if (s) - funcdecl.error("does not override any function, did you mean to override `%s%s`?", + funcdecl.error("does not override any function, did you mean to override %s`%s%s`?", + s.ident == funcdecl.ident ? "non-visible ".ptr : "".ptr, bc.sym.isCPPclass() ? "extern (C++) ".ptr : "".ptr, s.toPrettyChars()); else funcdecl.error("does not override any function"); diff --git a/src/dmd/dtemplate.d b/src/dmd/dtemplate.d index a4dbdc27554c..41bbcafa667b 100644 --- a/src/dmd/dtemplate.d +++ b/src/dmd/dtemplate.d @@ -6409,7 +6409,8 @@ extern (C++) class TemplateInstance : ScopeDsymbol { s = sc.search_correct(id); if (s) - error("template `%s` is not defined, did you mean %s?", id.toChars(), s.toChars()); + error("template `%s` is not defined, did you mean %s%s?", + id.toChars(), s.ident == id ? "non-visible ".ptr : "".ptr, s.toChars()); else error("template `%s` is not defined", id.toChars()); return false; diff --git a/src/dmd/expression.d b/src/dmd/expression.d index 05ceda28053d..2ff03789d0d6 100644 --- a/src/dmd/expression.d +++ b/src/dmd/expression.d @@ -642,47 +642,13 @@ private Expression searchUFCS(Scope* sc, UnaExp ue, Identifier ident) if (sc.flags & SCOPE.ignoresymbolvisibility) flags |= IgnoreSymbolVisibility; - Dsymbol sold = void; - if (global.params.bug10378 || global.params.check10378) - { - sold = searchScopes(flags | IgnoreSymbolVisibility); - if (!global.params.check10378) - { - s = sold; - goto Lsearchdone; - } - } - // First look in local scopes s = searchScopes(flags | SearchLocalsOnly); if (!s) { // Second look in imported modules s = searchScopes(flags | SearchImportsOnly); - - /** Still find private symbols, so that symbols that weren't access - * checked by the compiler remain usable. Once the deprecation is over, - * this should be moved to search_correct instead. - */ - if (!s && !(flags & IgnoreSymbolVisibility)) - { - s = searchScopes(flags | SearchLocalsOnly | IgnoreSymbolVisibility); - if (!s) - s = searchScopes(flags | SearchImportsOnly | IgnoreSymbolVisibility); - - if (s) - .deprecation(loc, "`%s` is not visible from module `%s`", s.toPrettyChars(), sc._module.toChars()); - } - } - if (global.params.check10378) - { - alias snew = s; - if (sold !is snew) - Scope.deprecation10378(loc, sold, snew); - if (global.params.bug10378) - s = sold; } -Lsearchdone: if (!s) return ue.e1.type.Type.getProperty(loc, ident, 0); diff --git a/src/dmd/expressionsem.d b/src/dmd/expressionsem.d index 345f64343f97..6907e5685efb 100644 --- a/src/dmd/expressionsem.d +++ b/src/dmd/expressionsem.d @@ -1382,7 +1382,8 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor if (const n = importHint(exp.ident.toChars())) exp.error("`%s` is not defined, perhaps `import %s;` is needed?", exp.ident.toChars(), n); else if (auto s2 = sc.search_correct(exp.ident)) - exp.error("undefined identifier `%s`, did you mean %s `%s`?", exp.ident.toChars(), s2.kind(), s2.toChars()); + exp.error("undefined identifier `%s`, did you mean %s%s `%s`?", + exp.ident.toChars(), s2.ident == exp.ident ? "non-visible ".ptr : "".ptr, s2.kind(), s2.toChars()); else if (const p = Scope.search_correct_C(exp.ident)) exp.error("undefined identifier `%s`, did you mean `%s`?", exp.ident.toChars(), p); else @@ -9587,11 +9588,8 @@ Expression semanticY(DotIdExp exp, Scope* sc, int flag) */ if (s && !(sc.flags & SCOPE.ignoresymbolvisibility) && !symbolIsVisible(sc._module, s)) { - if (s.isDeclaration()) - error(exp.loc, "`%s` is not visible from module `%s`", s.toPrettyChars(), sc._module.toChars()); - else - deprecation(exp.loc, "`%s` is not visible from module `%s`", s.toPrettyChars(), sc._module.toChars()); - // s = null; + error(exp.loc, "`%s` is not visible from module `%s`", s.toPrettyChars(), sc._module.toChars()); + s = null; } if (s) { @@ -9771,7 +9769,8 @@ Expression semanticY(DotIdExp exp, Scope* sc, int flag) return null; s = ie.sds.search_correct(exp.ident); if (s) - exp.error("undefined identifier `%s` in %s `%s`, did you mean %s `%s`?", exp.ident.toChars(), ie.sds.kind(), ie.sds.toPrettyChars(), s.kind(), s.toChars()); + exp.error("undefined identifier `%s` in %s `%s`, did you mean %s%s `%s`?", + exp.ident.toChars(), ie.sds.kind(), ie.sds.toPrettyChars(), s.ident == exp.ident ? "non-visible ".ptr : "".ptr, s.kind(), s.toChars()); else exp.error("undefined identifier `%s` in %s `%s`", exp.ident.toChars(), ie.sds.kind(), ie.sds.toPrettyChars()); return new ErrorExp(); diff --git a/src/dmd/globals.d b/src/dmd/globals.d index 14fcc8514c6d..65339f1c2441 100644 --- a/src/dmd/globals.d +++ b/src/dmd/globals.d @@ -135,8 +135,6 @@ struct Param bool betterC; // be a "better C" compiler; no dependency on D runtime bool addMain; // add a default main() function bool allInst; // generate code for all template instantiations - bool check10378; // check for issues transitioning to 10738 - bool bug10378; // use pre- https://issues.dlang.org/show_bug.cgi?id=10378 search strategy bool fix16997; // fix integral promotions for unary + - ~ operators // https://issues.dlang.org/show_bug.cgi?id=16997 bool vsafe; // use enhanced @safe checking diff --git a/src/dmd/globals.h b/src/dmd/globals.h index 8fc5d7169bd6..60b1e93ee18a 100644 --- a/src/dmd/globals.h +++ b/src/dmd/globals.h @@ -123,8 +123,6 @@ struct Param bool betterC; // be a "better C" compiler; no dependency on D runtime bool addMain; // add a default main() function bool allInst; // generate code for all template instantiations - bool check10378; // check for issues transitioning to 10738 - bool bug10378; // use pre-bugzilla 10378 search strategy bool fix16997; // fix integral promotions for unary + - ~ operators // https://issues.dlang.org/show_bug.cgi?id=16997 bool vsafe; // use enhanced @safe checking diff --git a/src/dmd/initsem.d b/src/dmd/initsem.d index e36cd86a1386..ff11c9a5a35c 100644 --- a/src/dmd/initsem.d +++ b/src/dmd/initsem.d @@ -154,7 +154,8 @@ private extern(C++) final class InitializerSemanticVisitor : Visitor { s = sd.search_correct(id); if (s) - error(i.loc, "`%s` is not a member of `%s`, did you mean %s `%s`?", id.toChars(), sd.toChars(), s.kind(), s.toChars()); + error(i.loc, "`%s` is not a member of `%s`, did you mean %s%s `%s`?", + id.toChars(), sd.toChars(), s.ident == id ? "non-visible ".ptr : "".ptr, s.kind(), s.toChars()); else error(i.loc, "`%s` is not a member of `%s`", id.toChars(), sd.toChars()); result = new ErrorInitializer(); diff --git a/src/dmd/mars.d b/src/dmd/mars.d index 1a5ff3b219ae..0ed45339b70d 100644 --- a/src/dmd/mars.d +++ b/src/dmd/mars.d @@ -1736,7 +1736,16 @@ private bool parseCommandLine(const ref Strings arguments, const size_t argc, re foreach (t; Usage.transitions) { if (t.bugzillaNumber !is null) - buf ~= `case `~t.bugzillaNumber~`: params.`~t.paramName~` = true;break;`; + { + buf ~= `case `~t.bugzillaNumber~`:`; + if (t.deprecated_) + buf ~= `Loc loc; + deprecation(loc, "The -transition=`~t.bugzillaNumber ~` has no effect anymore.");`; + else + buf ~= `params.`~t.paramName~` = true;`; + + buf ~= "break;"; + } } return buf; } @@ -1756,12 +1765,20 @@ private bool parseCommandLine(const ref Strings arguments, const size_t argc, re import dmd.cli : Usage; string buf = `case "all":`; foreach (t; Usage.transitions) - buf ~= `params.`~t.paramName~` = true;`; + if (!t.deprecated_) + buf ~= `params.`~t.paramName~` = true;`; buf ~= "break;"; foreach (t; Usage.transitions) { - buf ~= `case "`~t.name~`": params.`~t.paramName~` = true;break;`; + buf ~= `case "`~t.name~`":`; + if (t.deprecated_) + buf ~= `Loc loc; + deprecation(loc, "The -transition=`~t.name~` has no effect anymore.");`; + else + buf ~= `params.`~t.paramName~` = true;`; + + buf ~= "break;"; } return buf; } diff --git a/src/dmd/mtype.d b/src/dmd/mtype.d index 8770f0dcbb90..672cc39400f9 100644 --- a/src/dmd/mtype.d +++ b/src/dmd/mtype.d @@ -2558,7 +2558,8 @@ extern (C++) abstract class Type : RootObject if (this != Type.terror) { if (s) - error(loc, "no property `%s` for type `%s`, did you mean `%s`?", ident.toChars(), toChars(), s.toPrettyChars()); + error(loc, "no property `%s` for type `%s`, did you mean %s`%s`?", + ident.toChars(), toChars(), s.ident == ident ? "non-visible ".ptr : "".ptr, s.toChars()); else error(loc, "no property `%s` for type `%s`", ident.toChars(), toChars()); } @@ -6550,8 +6551,8 @@ extern (C++) abstract class TypeQualified : Type Dsymbol sm = s.searchX(loc, sc, id, flags); if (sm && !(sc.flags & SCOPE.ignoresymbolvisibility) && !symbolIsVisible(sc, sm)) { - .deprecation(loc, "`%s` is not visible from module `%s`", sm.toPrettyChars(), sc._module.toChars()); - // sm = null; + .error(loc, "`%s` is not visible from module `%s`", sm.toPrettyChars(), sc._module.toChars()); + sm = null; } if (global.errors != errorsave) { @@ -6630,9 +6631,11 @@ extern (C++) abstract class TypeQualified : Type else { assert(id.dyncast() == DYNCAST.identifier); - sm = s.search_correct(cast(Identifier)id); + auto ident = cast(Identifier)id; + sm = s.search_correct(ident); if (sm) - error(loc, "identifier `%s` of `%s` is not defined, did you mean %s `%s`?", id.toChars(), toChars(), sm.kind(), sm.toChars()); + error(loc, "identifier `%s` of `%s` is not defined, did you mean %s %s `%s`?", + id.toChars(), toChars(), s.ident == ident ? "non-visible ".ptr : "".ptr, sm.kind(), sm.toChars()); else error(loc, "identifier `%s` of `%s` is not defined", id.toChars(), toChars()); } @@ -6731,7 +6734,8 @@ extern (C++) abstract class TypeQualified : Type if (const n = importHint(p)) error(loc, "`%s` is not defined, perhaps `import %s;` ?", p, n); else if (auto s2 = sc.search_correct(id)) - error(loc, "undefined identifier `%s`, did you mean %s `%s`?", p, s2.kind(), s2.toChars()); + error(loc, "undefined identifier `%s`, did you mean %s%s `%s`?", + p, s2.ident == id ? "non-visible ".ptr : "".ptr, s2.kind(), s2.toChars()); else if (const q = Scope.search_correct_C(id)) error(loc, "undefined identifier `%s`, did you mean `%s`?", p, q); else @@ -7277,31 +7281,8 @@ extern (C++) final class TypeStruct : Type return e; } - Dsymbol searchSym() - { - int flags = sc.flags & SCOPE.ignoresymbolvisibility ? IgnoreSymbolVisibility : 0; - - Dsymbol sold = void; - if (global.params.bug10378 || global.params.check10378) - { - sold = sym.search(e.loc, ident, flags); - if (!global.params.check10378) - return sold; - } - - auto s = sym.search(e.loc, ident, flags | IgnorePrivateImports); - if (global.params.check10378) - { - alias snew = s; - if (sold !is snew) - Scope.deprecation10378(e.loc, sold, snew); - if (global.params.bug10378) - s = sold; - } - return s; - } - - s = searchSym(); + int flags = sc.flags & SCOPE.ignoresymbolvisibility ? IgnoreSymbolVisibility : 0; + s = sym.search(e.loc, ident, flags | SearchLocalsOnly | IgnorePrivateImports); L1: if (!s) { @@ -7309,8 +7290,7 @@ extern (C++) final class TypeStruct : Type } if (!(sc.flags & SCOPE.ignoresymbolvisibility) && !symbolIsVisible(sc, s)) { - .deprecation(e.loc, "`%s` is not visible from module `%s`", s.toPrettyChars(), sc._module.toPrettyChars()); - // return noMember(sc, e, ident, flag); + return noMember(sc, e, ident, flag); } if (!s.isFuncDeclaration()) // because of overloading { @@ -8088,36 +8068,8 @@ extern (C++) final class TypeClass : Type return e; } - Dsymbol searchSym() - { - int flags = sc.flags & SCOPE.ignoresymbolvisibility ? IgnoreSymbolVisibility : 0; - Dsymbol sold = void; - if (global.params.bug10378 || global.params.check10378) - { - sold = sym.search(e.loc, ident, flags | IgnoreSymbolVisibility); - if (!global.params.check10378) - return sold; - } - - auto s = sym.search(e.loc, ident, flags | SearchLocalsOnly); - if (!s && !(flags & IgnoreSymbolVisibility)) - { - s = sym.search(e.loc, ident, flags | SearchLocalsOnly | IgnoreSymbolVisibility); - if (s && !(flags & IgnoreErrors)) - .deprecation(e.loc, "`%s` is not visible from class `%s`", s.toPrettyChars(), sym.toChars()); - } - if (global.params.check10378) - { - alias snew = s; - if (sold !is snew) - Scope.deprecation10378(e.loc, sold, snew); - if (global.params.bug10378) - s = sold; - } - return s; - } - - s = searchSym(); + int flags = sc.flags & SCOPE.ignoresymbolvisibility ? IgnoreSymbolVisibility : 0; + s = sym.search(e.loc, ident, flags | SearchLocalsOnly); L1: if (!s) { @@ -8261,8 +8213,8 @@ extern (C++) final class TypeClass : Type } if (!(sc.flags & SCOPE.ignoresymbolvisibility) && !symbolIsVisible(sc, s)) { - .deprecation(e.loc, "`%s` is not visible from module `%s`", s.toPrettyChars(), sc._module.toPrettyChars()); - // return noMember(sc, e, ident, flag); + .error(e.loc, "`%s` is not visible from module `%s`", s.toPrettyChars(), sc._module.toPrettyChars()); + return noMember(sc, e, ident, flag); } if (!s.isFuncDeclaration()) // because of overloading { diff --git a/src/dmd/scope.h b/src/dmd/scope.h index 28895841def9..ac3bdfdb5bac 100644 --- a/src/dmd/scope.h +++ b/src/dmd/scope.h @@ -148,7 +148,6 @@ struct Scope Module *instantiatingModule(); Dsymbol *search(Loc loc, Identifier *ident, Dsymbol **pscopesym, int flags = IgnoreNone); - static void deprecation10378(Loc loc, Dsymbol *sold, Dsymbol *snew); Dsymbol *search_correct(Identifier *ident); static const char *search_correct_C(Identifier *ident); Dsymbol *insert(Dsymbol *s); diff --git a/src/dmd/traits.d b/src/dmd/traits.d index 4c14dad9491a..70dd9bfefa6d 100644 --- a/src/dmd/traits.d +++ b/src/dmd/traits.d @@ -736,7 +736,7 @@ extern (C++) Expression semanticTraits(TraitsExp e, Scope* sc) return dimError(1); Scope* sc2 = sc.push(); - sc2.flags = sc.flags | SCOPE.noaccesscheck; + sc2.flags = sc.flags | SCOPE.noaccesscheck | SCOPE.ignoresymbolvisibility; bool ok = TemplateInstance.semanticTiargs(e.loc, sc2, e.args, 1); sc2.pop(); if (!ok) diff --git a/test/compilable/test15925.d b/test/compilable/test15925.d deleted file mode 100644 index 871af4e55edf..000000000000 --- a/test/compilable/test15925.d +++ /dev/null @@ -1,18 +0,0 @@ -/* REQUIRED_ARGS: -transition=import -transition=checkimports -PERMUTE_ARGS: -TEST_OUTPUT: ---- -compilable/test15925.d(17): Deprecation: local import search method found variable imp15925.X instead of nothing ---- -*/ - -mixin template Import() -{ - import imports.imp15925; -} - -class Foo -{ - mixin Import!(); - static assert(X == 1); -} diff --git a/test/compilable/testcheckimports.d b/test/compilable/testcheckimports.d index 328b8a9825b1..521b8303cfd2 100644 --- a/test/compilable/testcheckimports.d +++ b/test/compilable/testcheckimports.d @@ -1,4 +1,4 @@ -// REQUIRED_ARGS: -transition=checkimports -de +// REQUIRED_ARGS: /* TEST_OUTPUT: --- diff --git a/test/fail_compilation/fail10528.d b/test/fail_compilation/fail10528.d index 9c30ce68a909..983926d43ef2 100644 --- a/test/fail_compilation/fail10528.d +++ b/test/fail_compilation/fail10528.d @@ -1,18 +1,17 @@ /* TEST_OUTPUT: --- -fail_compilation/fail10528.d(23): Error: module fail10528 variable `a10528.a` is `private` -fail_compilation/fail10528.d(23): Deprecation: a10528.a is not visible from module fail10528 -fail_compilation/fail10528.d(24): Error: `a10528.a` is not visible from module `fail10528` -fail_compilation/fail10528.d(26): Error: module fail10528 enum member `a10528.b` is `private` -fail_compilation/fail10528.d(26): Deprecation: a10528.b is not visible from module fail10528 -fail_compilation/fail10528.d(27): Error: `a10528.b` is not visible from module `fail10528` -fail_compilation/fail10528.d(29): Deprecation: `a10528.S.c` is not visible from module `fail10528` +fail_compilation/fail10528.d(22): Error: undefined identifier `a`, did you mean non-visible variable `a`? +fail_compilation/fail10528.d(23): Error: `a10528.a` is not visible from module `fail10528` +fail_compilation/fail10528.d(23): Error: undefined identifier `a` in module `a10528`, did you mean non-visible variable `a`? +fail_compilation/fail10528.d(25): Error: undefined identifier `b`, did you mean non-visible enum member `b`? +fail_compilation/fail10528.d(26): Error: `a10528.b` is not visible from module `fail10528` +fail_compilation/fail10528.d(26): Error: undefined identifier `b` in module `a10528`, did you mean non-visible enum member `b`? +fail_compilation/fail10528.d(28): Error: no property `c` for type `S`, did you mean non-visible `c`? fail_compilation/fail10528.d(29): Error: variable `a10528.S.c` is not accessible from module `fail10528` -fail_compilation/fail10528.d(30): Error: variable `a10528.S.c` is not accessible from module `fail10528` -fail_compilation/fail10528.d(32): Deprecation: `a10528.C.d` is not visible from module `fail10528` +fail_compilation/fail10528.d(31): Error: `a10528.C.d` is not visible from module `fail10528` +fail_compilation/fail10528.d(31): Error: no property `d` for type `a10528.C`, did you mean non-visible `d`? fail_compilation/fail10528.d(32): Error: variable `a10528.C.d` is not accessible from module `fail10528` -fail_compilation/fail10528.d(33): Error: variable `a10528.C.d` is not accessible from module `fail10528` --- */ diff --git a/test/compilable/imports/imp15925.d b/test/fail_compilation/imports/imp15925.d similarity index 100% rename from test/compilable/imports/imp15925.d rename to test/fail_compilation/imports/imp15925.d diff --git a/test/fail_compilation/test15925.d b/test/fail_compilation/test15925.d new file mode 100644 index 000000000000..41521e091c76 --- /dev/null +++ b/test/fail_compilation/test15925.d @@ -0,0 +1,19 @@ +/* +PERMUTE_ARGS: +TEST_OUTPUT: +--- +fail_compilation/test15925.d(18): Error: undefined identifier `X` +fail_compilation/test15925.d(18): while evaluating: `static assert(X == 1)` +--- +*/ + +mixin template Import() +{ + import imports.imp15925; +} + +class Foo +{ + mixin Import!(); + static assert(X == 1); +}