From 12833baf1618557b24ff4b51a0ff35af7c5aa35b Mon Sep 17 00:00:00 2001 From: JinShil Date: Mon, 10 Dec 2018 16:34:45 +0900 Subject: [PATCH] Remove visiblity and lookup deprecation - Take 2 --- changelog/import_deprecations.dd | 5 ++ docs/gen_man.d | 3 + src/dmd/cli.d | 14 +++- src/dmd/dscope.d | 76 ++---------------- src/dmd/dsymbol.d | 15 ++-- src/dmd/dsymbolsem.d | 15 ++-- src/dmd/dtemplate.d | 3 +- src/dmd/expressionsem.d | 46 ++--------- src/dmd/globals.d | 2 - src/dmd/globals.h | 2 - src/dmd/initsem.d | 3 +- src/dmd/mars.d | 25 +++++- src/dmd/traits.d | 2 +- src/dmd/typesem.d | 80 ++++--------------- test/compilable/checkimports1a.d | 12 +++ test/compilable/checkimports1b.d | 12 +++ .../imports/diag12598a.d | 0 test/compilable/test15925.d | 18 ----- test/compilable/testcheckimports.d | 2 +- test/fail_compilation/checkimports1a.d | 20 ----- test/fail_compilation/checkimports1b.d | 20 ----- test/fail_compilation/checkimports2c.d | 29 +++---- test/fail_compilation/diag10169.d | 4 +- test/fail_compilation/diag5385.d | 28 +++---- test/fail_compilation/diag9191.d | 6 +- test/fail_compilation/dip22a.d | 18 ++--- test/fail_compilation/dip22e.d | 6 +- test/fail_compilation/fail10528.d | 19 +++-- test/fail_compilation/fail18093.d | 2 +- test/fail_compilation/fail18979.d | 5 +- test/fail_compilation/fail19209.d | 2 +- test/fail_compilation/fail262.d | 2 +- test/fail_compilation/fail313.d | 8 +- test/fail_compilation/fail347.d | 2 +- test/fail_compilation/fail8631.d | 2 +- .../imports/imp15925.d | 0 test/fail_compilation/lookup.d | 4 +- test/fail_compilation/retref2.d | 4 +- test/fail_compilation/test13867.d | 4 +- test/fail_compilation/test15785.d | 6 +- test/fail_compilation/test15785b.d | 6 +- test/fail_compilation/test15897.d | 4 +- test/fail_compilation/test15925.d | 22 +++++ 43 files changed, 210 insertions(+), 348 deletions(-) create mode 100644 changelog/import_deprecations.dd create mode 100644 test/compilable/checkimports1a.d create mode 100644 test/compilable/checkimports1b.d rename test/{fail_compilation => compilable}/imports/diag12598a.d (100%) delete mode 100644 test/compilable/test15925.d delete mode 100644 test/fail_compilation/checkimports1a.d delete mode 100644 test/fail_compilation/checkimports1b.d rename test/{compilable => fail_compilation}/imports/imp15925.d (100%) create mode 100644 test/fail_compilation/test15925.d diff --git a/changelog/import_deprecations.dd b/changelog/import_deprecations.dd new file mode 100644 index 000000000000..aeb75beed812 --- /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..306473d7b7b8 100644 --- a/docs/gen_man.d +++ b/docs/gen_man.d @@ -127,6 +127,9 @@ 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 bc579817c080..b7c968a6f563 100644 --- a/src/dmd/cli.d +++ b/src/dmd/cli.d @@ -607,10 +607,13 @@ dmd -cov -unittest myprog.d /// Representation of a CLI transition struct Transition { + enum Deprecated { no, yes} + 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 @@ -618,11 +621,11 @@ 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", Transition.Deprecated.yes), // @@@DEPRECATED_2019-12@@@. Transition("14246", "dtorfields", "dtorFields", "destruct fields of partially constructed objects"), Transition(null, "checkimports", "check10378", - "give deprecation messages about 10378 anomalies"), + "give deprecation messages about 10378 anomalies", Transition.Deprecated.yes), // @@@DEPRECATED_2019-12@@@. Transition("14488", "complex", "vcomplex", "give deprecation messages about all usages of complex or imaginary types"), Transition("16997", "intpromote", "fix16997", @@ -705,6 +708,9 @@ 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 3f4c7b0be9b7..7245071c9c13 100644 --- a/src/dmd/dscope.d +++ b/src/dmd/dscope.d @@ -479,19 +479,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); @@ -500,68 +487,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 (D) 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) @@ -602,6 +531,11 @@ struct Scope return cast(void*)s; } + Dsymbol scopesym = null; + // search for exact name ignoring visibility first + if (auto s = search(Loc.initial, 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 bacf0864477f..f12e0cadccee 100644 --- a/src/dmd/dsymbol.d +++ b/src/dmd/dsymbol.d @@ -699,6 +699,11 @@ 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.initial, ident, IgnoreErrors | IgnoreSymbolVisibility)) + return s; + return cast(Dsymbol)speller(ident.toChars(), &symbol_search_fp, idchars); } @@ -744,7 +749,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; @@ -1348,10 +1354,9 @@ 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 1b73a981a27e..a3c2ea4e2315 100644 --- a/src/dmd/dsymbolsem.d +++ b/src/dmd/dsymbolsem.d @@ -1468,7 +1468,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; @@ -3558,13 +3559,17 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor functionToBufferFull(cast(TypeFunction)(fd.type), &buf1, new Identifier(fd.toPrettyChars()), &hgs, null); - error(funcdecl.loc, "function `%s` does not override any function, did you mean to override `%s`?", - funcdeclToChars, buf1.peekString()); + error(funcdecl.loc, "function `%s` does not override any function, did you mean to override %s%s `%s`?", + funcdeclToChars, + s.ident == funcdecl.ident ? "non-visible ".ptr : "".ptr, + s.kind, buf1.peekString()); } else { - error(funcdecl.loc, "function `%s` does not override any function, did you mean to override %s `%s`?", - funcdeclToChars, s.kind, s.toPrettyChars()); + error(funcdecl.loc, "function `%s` does not override any function, did you mean to override %s%s `%s`?", + funcdeclToChars, + s.ident == funcdecl.ident ? "non-visible ".ptr : "".ptr, + s.kind, s.toPrettyChars()); errorSupplemental(funcdecl.loc, "Functions are the only declarations that may be overriden"); } } diff --git a/src/dmd/dtemplate.d b/src/dmd/dtemplate.d index 018d0d0ef51e..c8c73dd8dd19 100644 --- a/src/dmd/dtemplate.d +++ b/src/dmd/dtemplate.d @@ -6422,7 +6422,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/expressionsem.d b/src/dmd/expressionsem.d index cda2a382bea2..77c6aaa4a452 100644 --- a/src/dmd/expressionsem.d +++ b/src/dmd/expressionsem.d @@ -413,45 +413,12 @@ 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: @@ -2527,7 +2494,8 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor if (const n = importHint(exp.ident.toString())) exp.error("`%s` is not defined, perhaps `import %.*s;` is needed?", exp.ident.toChars(), cast(int)n.length, n.ptr); 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 @@ -10816,11 +10784,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) { @@ -11000,7 +10965,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 6e475694229e..138da2a40867 100644 --- a/src/dmd/globals.d +++ b/src/dmd/globals.d @@ -143,8 +143,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 fixAliasThis; // if the current scope has an alias this, check it before searching upper scopes diff --git a/src/dmd/globals.h b/src/dmd/globals.h index 336deae5481c..8a8286dd11fe 100644 --- a/src/dmd/globals.h +++ b/src/dmd/globals.h @@ -118,8 +118,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 e51cbb0b97bc..74526319f23a 100644 --- a/src/dmd/initsem.d +++ b/src/dmd/initsem.d @@ -139,7 +139,8 @@ extern(C++) Initializer initializerSemantic(Initializer init, Scope* sc, Type t, s = sd.search_correct(id); Loc initLoc = i.value[j].loc; if (s) - error(initLoc, "`%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(initLoc, "`%s` is not a member of `%s`", id.toChars(), sd.toChars()); return new ErrorInitializer(); diff --git a/src/dmd/mars.d b/src/dmd/mars.d index 8e70f9728a11..20af67cc6048 100644 --- a/src/dmd/mars.d +++ b/src/dmd/mars.d @@ -1742,7 +1742,17 @@ bool parseCommandLine(const ref Strings arguments, const size_t argc, ref Param 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, "-transition=`~t.bugzillaNumber ~` has been deprecated and no longer has any effect.");`; + else + buf ~= `params.`~t.paramName~` = true;`; + + buf ~= "break;"; + } } return buf; } @@ -1762,12 +1772,21 @@ bool parseCommandLine(const ref Strings arguments, const size_t argc, ref Param 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, "-transition=`~t.name~` has been deprecated and no longer has any effect.");`; + else + buf ~= `params.`~t.paramName~` = true;`; + + buf ~= "break;"; } return buf; } diff --git a/src/dmd/traits.d b/src/dmd/traits.d index 0bed755ecebe..116001bc6585 100644 --- a/src/dmd/traits.d +++ b/src/dmd/traits.d @@ -751,7 +751,7 @@ 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/src/dmd/typesem.d b/src/dmd/typesem.d index 631a5aabbdbd..793ab8e3b4b5 100644 --- a/src/dmd/typesem.d +++ b/src/dmd/typesem.d @@ -229,8 +229,8 @@ private void resolveHelper(TypeQualified mt, const ref Loc loc, Scope* sc, Dsymb 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) { @@ -309,9 +309,11 @@ private void resolveHelper(TypeQualified mt, const ref Loc loc, Scope* sc, Dsymb 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(), mt.toChars(), sm.kind(), sm.toChars()); + error(loc, "identifier `%s` of `%s` is not defined, did you mean %s %s `%s`?", + id.toChars(), mt.toChars(), s.ident == ident ? "non-visible ".ptr : "".ptr, sm.kind(), sm.toChars()); else error(loc, "identifier `%s` of `%s` is not defined", id.toChars(), mt.toChars()); } @@ -410,7 +412,8 @@ private void resolveHelper(TypeQualified mt, const ref Loc loc, Scope* sc, Dsymb if (const n = importHint(id.toString())) error(loc, "`%s` is not defined, perhaps `import %.*s;` ?", p, cast(int)n.length, n.ptr); 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 @@ -1966,7 +1969,8 @@ Expression getProperty(Type t, const ref Loc loc, Identifier ident, int flag) if (mt != Type.terror) { if (s) - error(loc, "no property `%s` for type `%s`, did you mean `%s`?", ident.toChars(), mt.toChars(), s.toPrettyChars()); + error(loc, "no property `%s` for type `%s`, did you mean %s%s `%s`?", + ident.toChars(), mt.toChars(), s.ident == ident ? "non-visible ".ptr : "".ptr, s.kind(), s.toChars()); else { if (ident == Id.call && mt.ty == Tclass) @@ -3522,31 +3526,9 @@ Expression dotExp(Type mt, Scope* sc, Expression e, Identifier ident, int flag) return e; } - Dsymbol searchSym() - { - int flags = sc.flags & SCOPE.ignoresymbolvisibility ? IgnoreSymbolVisibility : 0; - - Dsymbol sold = void; - if (global.params.bug10378 || global.params.check10378) - { - sold = mt.sym.search(e.loc, ident, flags); - if (!global.params.check10378) - return sold; - } - - auto s = mt.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; - } + int flags = sc.flags & SCOPE.ignoresymbolvisibility ? IgnoreSymbolVisibility : 0; + s = mt.sym.search(e.loc, ident, flags | SearchLocalsOnly | IgnorePrivateImports); - s = searchSym(); L1: if (!s) { @@ -3554,8 +3536,8 @@ Expression dotExp(Type mt, Scope* sc, Expression e, Identifier ident, int flag) } 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(mt, sc, e, ident, flag); } if (!s.isFuncDeclaration()) // because of overloading { @@ -3830,36 +3812,9 @@ Expression dotExp(Type mt, Scope* sc, Expression e, Identifier ident, int flag) return e; } - Dsymbol searchSym() - { - int flags = sc.flags & SCOPE.ignoresymbolvisibility ? IgnoreSymbolVisibility : 0; - Dsymbol sold = void; - if (global.params.bug10378 || global.params.check10378) - { - sold = mt.sym.search(e.loc, ident, flags | IgnoreSymbolVisibility); - if (!global.params.check10378) - return sold; - } + int flags = sc.flags & SCOPE.ignoresymbolvisibility ? IgnoreSymbolVisibility : 0; + s = mt.sym.search(e.loc, ident, flags | SearchLocalsOnly); - auto s = mt.sym.search(e.loc, ident, flags | SearchLocalsOnly); - if (!s && !(flags & IgnoreSymbolVisibility)) - { - s = mt.sym.search(e.loc, ident, flags | SearchLocalsOnly | IgnoreSymbolVisibility); - if (s && !(flags & IgnoreErrors)) - .deprecation(e.loc, "`%s` is not visible from class `%s`", s.toPrettyChars(), mt.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(); L1: if (!s) { @@ -4007,8 +3962,7 @@ Expression dotExp(Type mt, Scope* sc, Expression e, Identifier ident, int flag) } 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(mt, sc, e, ident, flag); } if (!s.isFuncDeclaration()) // because of overloading { diff --git a/test/compilable/checkimports1a.d b/test/compilable/checkimports1a.d new file mode 100644 index 000000000000..ba819199ec18 --- /dev/null +++ b/test/compilable/checkimports1a.d @@ -0,0 +1,12 @@ +// REQUIRED_ARGS: + +class C +{ + void f() + { + import imports.diag12598a; + lines ~= ""; + } + + string[] lines; +} diff --git a/test/compilable/checkimports1b.d b/test/compilable/checkimports1b.d new file mode 100644 index 000000000000..ba819199ec18 --- /dev/null +++ b/test/compilable/checkimports1b.d @@ -0,0 +1,12 @@ +// REQUIRED_ARGS: + +class C +{ + void f() + { + import imports.diag12598a; + lines ~= ""; + } + + string[] lines; +} diff --git a/test/fail_compilation/imports/diag12598a.d b/test/compilable/imports/diag12598a.d similarity index 100% rename from test/fail_compilation/imports/diag12598a.d rename to test/compilable/imports/diag12598a.d diff --git a/test/compilable/test15925.d b/test/compilable/test15925.d deleted file mode 100644 index 638444883258..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/checkimports1a.d b/test/fail_compilation/checkimports1a.d deleted file mode 100644 index 070b4bf11b6d..000000000000 --- a/test/fail_compilation/checkimports1a.d +++ /dev/null @@ -1,20 +0,0 @@ -// REQUIRED_ARGS: -transition=checkimports -de -/* -TEST_OUTPUT: ---- -fail_compilation/checkimports1a.d(16): Deprecation: local import search method found struct `imports.diag12598a.lines` instead of variable `checkimports1a.C.lines` ---- -*/ - - -// new lookup + information -class C -{ - void f() - { - import imports.diag12598a; - lines ~= ""; - } - - string[] lines; -} diff --git a/test/fail_compilation/checkimports1b.d b/test/fail_compilation/checkimports1b.d deleted file mode 100644 index 56e0f499d0fa..000000000000 --- a/test/fail_compilation/checkimports1b.d +++ /dev/null @@ -1,20 +0,0 @@ -// REQUIRED_ARGS: -transition=import -transition=checkimports -/* -TEST_OUTPUT: ---- -fail_compilation/checkimports1b.d(16): Deprecation: local import search method found struct `imports.diag12598a.lines` instead of variable `checkimports1b.C.lines` -fail_compilation/checkimports1b.d(16): Error: `lines` is a `struct` definition and cannot be modified ---- -*/ - -// old lookup + information -class C -{ - void f() - { - import imports.diag12598a; - lines ~= ""; - } - - string[] lines; -} diff --git a/test/fail_compilation/checkimports2c.d b/test/fail_compilation/checkimports2c.d index e18542034b23..71049074e8a4 100644 --- a/test/fail_compilation/checkimports2c.d +++ b/test/fail_compilation/checkimports2c.d @@ -1,23 +1,14 @@ -// REQUIRED_ARGS: -transition=checkimports -transition=import -de +// REQUIRED_ARGS: /* TEST_OUTPUT: --- - -fail_compilation/checkimports2c.d(28): Deprecation: local import search method found variable `imports.imp2.X` instead of variable `checkimports2c.X` -fail_compilation/checkimports2c.d(28): while evaluating: `static assert(2 == 2)` -fail_compilation/checkimports2c.d(34): Deprecation: local import search method found variable `imports.imp2.X` instead of nothing -fail_compilation/checkimports2c.d(34): while evaluating: `static assert(2 == 2)` -fail_compilation/checkimports2c.d(35): Deprecation: local import search method found variable `imports.imp2.Y` instead of nothing -fail_compilation/checkimports2c.d(35): while evaluating: `static assert(2 == 2)` -fail_compilation/checkimports2c.d(37): Deprecation: local import search method found variable `imports.imp2.X` instead of variable `checkimports2c.X` -fail_compilation/checkimports2c.d(37): while evaluating: `static assert(2 == 2)` -fail_compilation/checkimports2c.d(38): Deprecation: local import search method found variable `imports.imp2.Y` instead of variable `imports.imp1.Y` -fail_compilation/checkimports2c.d(38): while evaluating: `static assert(2 == 2)` +fail_compilation/checkimports2c.d(25): Error: no property `X` for type `checkimports2c.B`, did you mean non-visible variable `X`? +fail_compilation/checkimports2c.d(25): while evaluating: `static assert((B).X == 2)` +fail_compilation/checkimports2c.d(26): Error: no property `Y` for type `checkimports2c.B`, did you mean non-visible variable `Y`? +fail_compilation/checkimports2c.d(26): while evaluating: `static assert((B).Y == 2)` --- */ -// old lookup + information (the order of switches is reverse) - import imports.imp1; enum X = 0; @@ -25,15 +16,15 @@ enum X = 0; class B { import imports.imp2; - static assert(X == 2); // imp2.X --> .X (information) + static assert(X == 0); // .X int[Y] aa; // imp2.Y } class C : B { - static assert(B.X == 2); // imp2.X --> error (keep old lookup rule) - static assert(B.Y == 2); // imp2.Y --> error (keep old lookup rule) + static assert(B.X == 2); // imp2.X --> error (not visible from here) + static assert(B.Y == 2); // imp2.Y --> error (not visible from here) - static assert(X == 2); // imp2.X --> .X (information) - static assert(Y == 2); // imp2.Y --> imp1.Y (information) + static assert(X == 0); // .X + static assert(Y == 1); // imp1.Y } diff --git a/test/fail_compilation/diag10169.d b/test/fail_compilation/diag10169.d index d1636fce8aa0..eab3c455557f 100644 --- a/test/fail_compilation/diag10169.d +++ b/test/fail_compilation/diag10169.d @@ -1,8 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/diag10169.d(12): Deprecation: `imports.a10169.B.x` is not visible from module `diag10169` -fail_compilation/diag10169.d(12): Error: struct `imports.a10169.B` member `x` is not accessible +fail_compilation/diag10169.d(12): Error: `imports.a10169.B.x` is not visible from module `diag10169` +fail_compilation/diag10169.d(12): Error: no property `x` for type `B`, did you mean non-visible variable `x`? --- */ import imports.a10169; diff --git a/test/fail_compilation/diag5385.d b/test/fail_compilation/diag5385.d index 5d4e93678827..92e8beafdd0e 100644 --- a/test/fail_compilation/diag5385.d +++ b/test/fail_compilation/diag5385.d @@ -1,22 +1,18 @@ /* TEST_OUTPUT: --- -fail_compilation/diag5385.d(27): Deprecation: `imports.fail5385.C.privX` is not visible from module `diag5385` -fail_compilation/diag5385.d(27): Error: class `imports.fail5385.C` member `privX` is not accessible -fail_compilation/diag5385.d(28): Deprecation: `imports.fail5385.C.packX` is not visible from module `diag5385` -fail_compilation/diag5385.d(28): Error: class `imports.fail5385.C` member `packX` is not accessible -fail_compilation/diag5385.d(29): Deprecation: `imports.fail5385.C.privX2` is not visible from module `diag5385` -fail_compilation/diag5385.d(29): Error: class `imports.fail5385.C` member `privX2` is not accessible -fail_compilation/diag5385.d(30): Deprecation: `imports.fail5385.C.packX2` is not visible from module `diag5385` -fail_compilation/diag5385.d(30): Error: class `imports.fail5385.C` member `packX2` is not accessible -fail_compilation/diag5385.d(31): Deprecation: `imports.fail5385.S.privX` is not visible from module `diag5385` -fail_compilation/diag5385.d(31): Error: struct `imports.fail5385.S` member `privX` is not accessible -fail_compilation/diag5385.d(32): Deprecation: `imports.fail5385.S.packX` is not visible from module `diag5385` -fail_compilation/diag5385.d(32): Error: struct `imports.fail5385.S` member `packX` is not accessible -fail_compilation/diag5385.d(33): Deprecation: `imports.fail5385.S.privX2` is not visible from module `diag5385` -fail_compilation/diag5385.d(33): Error: struct `imports.fail5385.S` member `privX2` is not accessible -fail_compilation/diag5385.d(34): Deprecation: `imports.fail5385.S.packX2` is not visible from module `diag5385` -fail_compilation/diag5385.d(34): Error: struct `imports.fail5385.S` member `packX2` is not accessible +fail_compilation/diag5385.d(23): Error: no property `privX` for type `imports.fail5385.C`, did you mean non-visible variable `privX`? +fail_compilation/diag5385.d(24): Error: no property `packX` for type `imports.fail5385.C`, did you mean non-visible variable `packX`? +fail_compilation/diag5385.d(25): Error: no property `privX2` for type `imports.fail5385.C`, did you mean non-visible variable `privX2`? +fail_compilation/diag5385.d(26): Error: no property `packX2` for type `imports.fail5385.C`, did you mean non-visible variable `packX2`? +fail_compilation/diag5385.d(27): Error: `imports.fail5385.S.privX` is not visible from module `diag5385` +fail_compilation/diag5385.d(27): Error: no property `privX` for type `S`, did you mean non-visible variable `privX`? +fail_compilation/diag5385.d(28): Error: `imports.fail5385.S.packX` is not visible from module `diag5385` +fail_compilation/diag5385.d(28): Error: no property `packX` for type `S`, did you mean non-visible variable `packX`? +fail_compilation/diag5385.d(29): Error: `imports.fail5385.S.privX2` is not visible from module `diag5385` +fail_compilation/diag5385.d(29): Error: no property `privX2` for type `S`, did you mean non-visible variable `privX2`? +fail_compilation/diag5385.d(30): Error: `imports.fail5385.S.packX2` is not visible from module `diag5385` +fail_compilation/diag5385.d(30): Error: no property `packX2` for type `S`, did you mean non-visible variable `packX2`? --- */ diff --git a/test/fail_compilation/diag9191.d b/test/fail_compilation/diag9191.d index 2da3283a2e2e..ff6ac51bbbd7 100644 --- a/test/fail_compilation/diag9191.d +++ b/test/fail_compilation/diag9191.d @@ -1,10 +1,10 @@ /* TEST_OUTPUT: --- -fail_compilation/diag9191.d(16): Error: function `void diag9191.C1.aaa()` does not override any function, did you mean to override `void diag9191.B1.aa()`? +fail_compilation/diag9191.d(16): Error: function `void diag9191.C1.aaa()` does not override any function, did you mean to override function `void diag9191.B1.aa()`? fail_compilation/diag9191.d(21): Error: function `diag9191.C2.aaa` does not override any function -fail_compilation/diag9191.d(31): Error: function `void diag9191.C3.foo()` does not override any function, did you mean to override `void diag9191.B2._foo()`? -fail_compilation/diag9191.d(36): Error: function `void diag9191.C4.toStringa()` does not override any function, did you mean to override `string object.Object.toString()`? +fail_compilation/diag9191.d(31): Error: function `void diag9191.C3.foo()` does not override any function, did you mean to override function `void diag9191.B2._foo()`? +fail_compilation/diag9191.d(36): Error: function `void diag9191.C4.toStringa()` does not override any function, did you mean to override function `string object.Object.toString()`? --- */ diff --git a/test/fail_compilation/dip22a.d b/test/fail_compilation/dip22a.d index 1ba4e861dc2b..57e5558afea3 100644 --- a/test/fail_compilation/dip22a.d +++ b/test/fail_compilation/dip22a.d @@ -2,16 +2,14 @@ REQUIRED_ARGS: -de TEST_OUTPUT: --- -fail_compilation/dip22a.d(21): Deprecation: `imports.dip22a.Klass.bar` is not visible from module `dip22a` -fail_compilation/dip22a.d(21): Error: class `imports.dip22a.Klass` member `bar` is not accessible -fail_compilation/dip22a.d(22): Deprecation: `imports.dip22a.Struct.bar` is not visible from module `dip22a` -fail_compilation/dip22a.d(22): Error: struct `imports.dip22a.Struct` member `bar` is not accessible -fail_compilation/dip22a.d(23): Error: `imports.dip22a.bar` is not visible from module `dip22a` -fail_compilation/dip22a.d(23): Error: function `imports.dip22a.bar` is not accessible from module `dip22a` -fail_compilation/dip22a.d(24): Error: `imports.dip22a.Template!int.bar` is not visible from module `dip22a` -fail_compilation/dip22a.d(24): Error: function `imports.dip22a.Template!int.bar` is not accessible from module `dip22a` -fail_compilation/dip22a.d(25): Deprecation: `imports.dip22a.bar` is not visible from module `dip22a` -fail_compilation/dip22a.d(25): Error: function `imports.dip22a.bar` is not accessible from module `dip22a` +fail_compilation/dip22a.d(19): Error: no property `bar` for type `imports.dip22a.Klass`, did you mean non-visible function `bar`? +fail_compilation/dip22a.d(20): Error: `imports.dip22a.Struct.bar` is not visible from module `dip22a` +fail_compilation/dip22a.d(20): Error: no property `bar` for type `Struct`, did you mean non-visible function `bar`? +fail_compilation/dip22a.d(21): Error: `imports.dip22a.bar` is not visible from module `dip22a` +fail_compilation/dip22a.d(21): Error: undefined identifier `bar` in module `imports.dip22a`, did you mean non-visible function `bar`? +fail_compilation/dip22a.d(22): Error: `imports.dip22a.Template!int.bar` is not visible from module `dip22a` +fail_compilation/dip22a.d(22): Error: no property `bar` for type `void` +fail_compilation/dip22a.d(23): Error: no property `bar` for type `int` --- */ import imports.dip22a; diff --git a/test/fail_compilation/dip22e.d b/test/fail_compilation/dip22e.d index 8786b899253f..e4791099b2db 100644 --- a/test/fail_compilation/dip22e.d +++ b/test/fail_compilation/dip22e.d @@ -1,10 +1,8 @@ /* -REQUIRED_ARGS: -transition=checkimports -de +REQUIRED_ARGS: TEST_OUTPUT: --- -fail_compilation/dip22e.d(16): Deprecation: `imports.dip22d.foo` is not visible from module `dip22e` -fail_compilation/dip22e.d(16): Error: function `imports.dip22d.foo` is not accessible from module `dip22e` -fail_compilation/dip22e.d(17): Deprecation: local import search method found overloadset `dip22e.bar` (1 overloads) instead of function `imports.dip22e.bar` +fail_compilation/dip22e.d(14): Error: undefined identifier `foo`, did you mean non-visible function `foo`? --- */ diff --git a/test/fail_compilation/fail10528.d b/test/fail_compilation/fail10528.d index 1b26d1778c0f..ce4d22888efd 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: `a10528.S.c` is not visible from module `fail10528` +fail_compilation/fail10528.d(28): Error: no property `c` for type `S`, did you mean non-visible variable `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: no property `d` for type `a10528.C`, did you mean non-visible variable `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/fail_compilation/fail18093.d b/test/fail_compilation/fail18093.d index 4eb3663afc6d..900fb594348d 100644 --- a/test/fail_compilation/fail18093.d +++ b/test/fail_compilation/fail18093.d @@ -1,6 +1,6 @@ /* TEST_OUTPUT: --- -fail_compilation/fail18093.d(19): Error: function `void fail18093.GenericTransitiveVisitor!(ASTCodegen).GenericTransitiveVisitor.ParseVisitMethods!(ASTCodegen).visit()` does not override any function, did you mean to override `extern (C++) void fail18093.ParseTimeVisitor!(ASTCodegen).ParseTimeVisitor.visit()`? +fail_compilation/fail18093.d(19): Error: function `void fail18093.GenericTransitiveVisitor!(ASTCodegen).GenericTransitiveVisitor.ParseVisitMethods!(ASTCodegen).visit()` does not override any function, did you mean to override non-visible function `extern (C++) void fail18093.ParseTimeVisitor!(ASTCodegen).ParseTimeVisitor.visit()`? fail_compilation/fail18093.d(24): Error: mixin `fail18093.GenericTransitiveVisitor!(ASTCodegen).GenericTransitiveVisitor.ParseVisitMethods!(ASTCodegen)` error instantiating fail_compilation/fail18093.d(27): Error: template instance `fail18093.GenericTransitiveVisitor!(ASTCodegen)` error instantiating --- diff --git a/test/fail_compilation/fail18979.d b/test/fail_compilation/fail18979.d index 314c9671a936..7fa9a675ee3c 100644 --- a/test/fail_compilation/fail18979.d +++ b/test/fail_compilation/fail18979.d @@ -1,8 +1,9 @@ -// REQUIRED_ARGS: -de +// REQUIRED_ARGS: /* TEST_OUTPUT: --- -fail_compilation/fail18979.d(13): Deprecation: `imports.imp18979.Foo.__ctor(A)(A a)` is not visible from module `fail18979` +fail_compilation/fail18979.d(14): Error: `imports.imp18979.Foo.__ctor(A)(A a)` is not visible from module `fail18979` +fail_compilation/fail18979.d(14): Error: no property `__ctor` for type `Foo`, did you mean non-visible template `__ctor(A)(A a)`? --- */ diff --git a/test/fail_compilation/fail19209.d b/test/fail_compilation/fail19209.d index ceede5e0eed2..42e6f03a549c 100644 --- a/test/fail_compilation/fail19209.d +++ b/test/fail_compilation/fail19209.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/fail19209.d(16): Error: function `fail19209.Spammer.method()` does not override any function, did you mean to override variable `fail19209.Spam.method`? +fail_compilation/fail19209.d(16): Error: function `fail19209.Spammer.method()` does not override any function, did you mean to override non-visible variable `fail19209.Spam.method`? fail_compilation/fail19209.d(16): Functions are the only declarations that may be overriden --- */ diff --git a/test/fail_compilation/fail262.d b/test/fail_compilation/fail262.d index f59ca89d36d8..106bdd4ebd05 100644 --- a/test/fail_compilation/fail262.d +++ b/test/fail_compilation/fail262.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/fail262.d(23): Error: function `fail262.B.f` does not override any function +fail_compilation/fail262.d(23): Error: function `const void fail262.B.f()` does not override any function, did you mean to override non-visible function `shared const void fail262.A.f()`? --- */ diff --git a/test/fail_compilation/fail313.d b/test/fail_compilation/fail313.d index 81e6addd9704..a7654d070a96 100644 --- a/test/fail_compilation/fail313.d +++ b/test/fail_compilation/fail313.d @@ -1,11 +1,9 @@ /* TEST_OUTPUT: --- -fail_compilation/fail313.d(17): Error: module `imports.b313` is not accessible here, perhaps add `static import imports.b313;` -fail_compilation/fail313.d(24): Deprecation: `imports.a313.core` is not visible from module `test313` -fail_compilation/fail313.d(24): Error: package `core.stdc` is not accessible here -fail_compilation/fail313.d(24): Error: module `core.stdc.stdio` is not accessible here, perhaps add `static import core.stdc.stdio;` -fail_compilation/fail313.d(29): Error: package `imports.pkg313` is not accessible here, perhaps add `static import imports.pkg313;` +fail_compilation/fail313.d(15): Error: module `imports.b313` is not accessible here, perhaps add `static import imports.b313;` +fail_compilation/fail313.d(22): Error: undefined identifier `core`, did you mean non-visible import `core`? +fail_compilation/fail313.d(27): Error: package `imports.pkg313` is not accessible here, perhaps add `static import imports.pkg313;` --- */ module test313; diff --git a/test/fail_compilation/fail347.d b/test/fail_compilation/fail347.d index 737ece3f7ddc..93b733cdaf0d 100644 --- a/test/fail_compilation/fail347.d +++ b/test/fail_compilation/fail347.d @@ -2,7 +2,7 @@ TEST_OUTPUT: --- fail_compilation/fail347.d(21): Error: undefined identifier `bbr`, did you mean variable `bar`? -fail_compilation/fail347.d(22): Error: no property `ofo` for type `S`, did you mean `fail347.S.foo`? +fail_compilation/fail347.d(22): Error: no property `ofo` for type `S`, did you mean variable `foo`? fail_compilation/fail347.d(23): Error: undefined identifier `strlenx`, did you mean function `strlen`? --- */ diff --git a/test/fail_compilation/fail8631.d b/test/fail_compilation/fail8631.d index 4f5b0763d481..a23e798858a9 100644 --- a/test/fail_compilation/fail8631.d +++ b/test/fail_compilation/fail8631.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/fail8631.d(14): Error: function `shared const int fail8631.D.foo()` does not override any function, did you mean to override `immutable int fail8631.B.foo()`? +fail_compilation/fail8631.d(14): Error: function `shared const int fail8631.D.foo()` does not override any function, did you mean to override non-visible function `immutable int fail8631.B.foo()`? --- */ 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/lookup.d b/test/fail_compilation/lookup.d index f5ff0adde78e..9c5852d9a311 100644 --- a/test/fail_compilation/lookup.d +++ b/test/fail_compilation/lookup.d @@ -1,9 +1,9 @@ /* TEST_OUTPUT: --- -fail_compilation/lookup.d(23): Error: no property `X` for type `lookup.B` +fail_compilation/lookup.d(23): Error: no property `X` for type `lookup.B`, did you mean non-visible variable `X`? fail_compilation/lookup.d(23): while evaluating: `static assert((B).X == 0)` -fail_compilation/lookup.d(24): Error: no property `Y` for type `lookup.B` +fail_compilation/lookup.d(24): Error: no property `Y` for type `lookup.B`, did you mean non-visible variable `Y`? fail_compilation/lookup.d(24): while evaluating: `static assert((B).Y == 2)` --- */ diff --git a/test/fail_compilation/retref2.d b/test/fail_compilation/retref2.d index 50b43c013e80..ded96a698818 100644 --- a/test/fail_compilation/retref2.d +++ b/test/fail_compilation/retref2.d @@ -4,8 +4,8 @@ /* TEST_OUTPUT: --- -fail_compilation/retref2.d(21): Error: function `ref int retref2.D.foo(return ref int)` does not override any function, did you mean to override `ref int retref2.C.foo(ref int)`? -fail_compilation/retref2.d(22): Error: function `ref scope int retref2.D.bar() return` does not override any function, did you mean to override `ref int retref2.C.bar()`? +fail_compilation/retref2.d(21): Error: function `ref int retref2.D.foo(return ref int)` does not override any function, did you mean to override non-visible function `ref int retref2.C.foo(ref int)`? +fail_compilation/retref2.d(22): Error: function `ref scope int retref2.D.bar() return` does not override any function, did you mean to override non-visible function `ref int retref2.C.bar()`? --- */ diff --git a/test/fail_compilation/test13867.d b/test/fail_compilation/test13867.d index 36543f92ebe9..b28ab4012cc1 100644 --- a/test/fail_compilation/test13867.d +++ b/test/fail_compilation/test13867.d @@ -1,8 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/test13867.d(12): Error: function `void test13867.X.blah()` does not override any function, did you mean to override `extern (C++) void test13867.Base.blah()`? -fail_compilation/test13867.d(19): Error: function `void test13867.Z.blah()` does not override any function, did you mean to override `extern (C++) void test13867.Base.blah()`? +fail_compilation/test13867.d(12): Error: function `void test13867.X.blah()` does not override any function, did you mean to override non-visible function `extern (C++) void test13867.Base.blah()`? +fail_compilation/test13867.d(19): Error: function `void test13867.Z.blah()` does not override any function, did you mean to override non-visible function `extern (C++) void test13867.Base.blah()`? --- */ extern (C++) class Base { diff --git a/test/fail_compilation/test15785.d b/test/fail_compilation/test15785.d index 25a302f0fef0..cc7fd1f44bb7 100644 --- a/test/fail_compilation/test15785.d +++ b/test/fail_compilation/test15785.d @@ -2,10 +2,8 @@ /* TEST_OUTPUT: --- -fail_compilation/test15785.d(17): Deprecation: `imports.test15785.Base.foo` is not visible from module `test15785` -fail_compilation/test15785.d(17): Error: class `test15785.Derived` member `foo` is not accessible -fail_compilation/test15785.d(18): Deprecation: `imports.test15785.Base.bar` is not visible from module `test15785` -fail_compilation/test15785.d(18): Error: class `test15785.Derived` member `bar` is not accessible +fail_compilation/test15785.d(15): Error: no property `foo` for type `imports.test15785.Base`, did you mean non-visible function `foo`? +fail_compilation/test15785.d(16): Error: undefined identifier `bar`, did you mean non-visible function `bar`? --- */ import imports.test15785; diff --git a/test/fail_compilation/test15785b.d b/test/fail_compilation/test15785b.d index 2531945a9432..f4d6a154e239 100644 --- a/test/fail_compilation/test15785b.d +++ b/test/fail_compilation/test15785b.d @@ -3,9 +3,9 @@ /* TEST_OUTPUT: --- -fail_compilation/test15785b.d(15): Deprecation: `imports.test15785.Base.T` is not visible from module `test15785b` -fail_compilation/test15785b.d(16): Deprecation: `imports.test15785.Base.T` is not visible from module `test15785b` -fail_compilation/test15785b.d(17): Deprecation: `imports.test15785.IBase2.T` is not visible from module `test15785b` +fail_compilation/test15785b.d(15): Error: `imports.test15785.Base.T` is not visible from module `test15785b` +fail_compilation/test15785b.d(16): Error: `imports.test15785.Base.T` is not visible from module `test15785b` +fail_compilation/test15785b.d(17): Error: `imports.test15785.IBase2.T` is not visible from module `test15785b` --- */ import imports.test15785; diff --git a/test/fail_compilation/test15897.d b/test/fail_compilation/test15897.d index f8729519b13c..7295ba3335cf 100644 --- a/test/fail_compilation/test15897.d +++ b/test/fail_compilation/test15897.d @@ -1,8 +1,8 @@ -// REQUIRED_ARGS: -de +// REQUIRED_ARGS: /* TEST_OUTPUT: --- -fail_compilation/test15897.d(18): Deprecation: `test15897.Animal.create` is not visible from class `Cat` +fail_compilation/test15897.d(18): Error: no property `create` for type `imports.test15897.Cat`, did you mean non-visible function `create`? --- */ module test15897; diff --git a/test/fail_compilation/test15925.d b/test/fail_compilation/test15925.d new file mode 100644 index 000000000000..61e0bf8f41ae --- /dev/null +++ b/test/fail_compilation/test15925.d @@ -0,0 +1,22 @@ +/* +PERMUTE_ARGS: +TEST_OUTPUT: +--- +fail_compilation/test15925.d(21): Error: undefined identifier `X` +fail_compilation/test15925.d(21): while evaluating: `static assert(X == 1)` +--- + +https://issues.dlang.org/show_bug.cgi?id=15925 + +*/ + +mixin template Import() +{ + import imports.imp15925; +} + +class Foo +{ + mixin Import!(); + static assert(X == 1); +}