diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2021-01-11 10:53:18 +0100 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2021-01-11 12:21:03 +0100 |
commit | 928e96bbe98bafff18f11a7351cf89592967b061 (patch) | |
tree | d6a7b3082fec5da6bb9465ab4050a3470d18ab60 | |
parent | 300a3ce5c5695eb1a7c0476e9d1b45420a463248 (diff) | |
download | gcc-928e96bbe98bafff18f11a7351cf89592967b061.zip gcc-928e96bbe98bafff18f11a7351cf89592967b061.tar.gz gcc-928e96bbe98bafff18f11a7351cf89592967b061.tar.bz2 |
d: Remove visibility and lookup deprecation
The deprecation phase for access checks is finished.
The `-ftransition=import` and `-ftransition=checkimports` switches no
longer have an effect and are now removed. Symbols that are not visible
in a particular scope will no longer be found by the compiler.
Reviewed-on: https://github.com/dlang/dmd/pull/12124
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd 2d3d13748.
* d-lang.cc (d_handle_option): Remove OPT_ftransition_checkimports and
OPT_ftransition_import.
* gdc.texi (Warnings): Remove documentation for -ftransition=import
and -ftransition=checkimports.
* lang.opt (ftransition=checkimports): Remove.
(ftransition=import): Remove.
69 files changed, 246 insertions, 543 deletions
diff --git a/gcc/d/d-lang.cc b/gcc/d/d-lang.cc index 7b34209..72dcb71 100644 --- a/gcc/d/d-lang.cc +++ b/gcc/d/d-lang.cc @@ -551,10 +551,6 @@ d_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value, global.params.vcomplex = value; break; - case OPT_ftransition_checkimports: - global.params.check10378 = value; - break; - case OPT_ftransition_complex: global.params.vcomplex = value; break; @@ -572,10 +568,6 @@ d_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value, global.params.vfield = value; break; - case OPT_ftransition_import: - global.params.bug10378 = value; - break; - case OPT_ftransition_nogc: global.params.vgc = value; break; diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index 435bf31..4f7f7a8 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -1,4 +1,4 @@ -cb1106ad5bea4293cd302b0ba1f3ce08905d40fe +2d3d137489f030395d06cb664087fd1a35bccabe The first line of this file holds the git revision number of the last merge done from the dlang/dmd repository. diff --git a/gcc/d/dmd/access.c b/gcc/d/dmd/access.c index 1a7238a..63f46c6 100644 --- a/gcc/d/dmd/access.c +++ b/gcc/d/dmd/access.c @@ -342,16 +342,9 @@ bool checkAccess(Loc loc, Scope *sc, Expression *e, Declaration *d) return false; } if (!e) - { - if ((d->prot().kind == Prot::private_ && d->getAccessModule() != sc->_module) || - (d->prot().kind == Prot::package_ && !hasPackageAccess(sc, d))) - { - error(loc, "%s %s is not accessible from module %s", - d->kind(), d->toPrettyChars(), sc->_module->toChars()); - return true; - } - } - else if (e->type->ty == Tclass) + return false; + + if (e->type->ty == Tclass) { // Do access check ClassDeclaration *cd = (ClassDeclaration *)(((TypeClass *)e->type)->sym); @@ -386,7 +379,7 @@ bool checkAccess(Loc loc, Scope *sc, Expression *e, Declaration *d) * (see Bugzilla 313). * */ -bool checkAccess(Loc loc, Scope *sc, Package *p) +bool checkAccess(Scope *sc, Package *p) { if (sc->_module == p) return false; @@ -395,11 +388,7 @@ bool checkAccess(Loc loc, Scope *sc, Package *p) if (sc->scopesym && sc->scopesym->isPackageAccessible(p, Prot(Prot::private_))) return false; } - const char *name = p->toPrettyChars(); - if (p->isPkgMod == PKGmodule || p->isModule()) - deprecation(loc, "%s %s is not accessible here, perhaps add 'static import %s;'", p->kind(), name, name); - else - deprecation(loc, "%s %s is not accessible here", p->kind(), name); + return true; } diff --git a/gcc/d/dmd/dscope.c b/gcc/d/dmd/dscope.c index 32caf7d..72dc089 100644 --- a/gcc/d/dmd/dscope.c +++ b/gcc/d/dmd/dscope.c @@ -453,47 +453,12 @@ Dsymbol *Scope::search(Loc loc, Identifier *ident, Dsymbol **pscopesym, int flag if (this->flags & SCOPEignoresymbolvisibility) flags |= IgnoreSymbolVisibility; - Dsymbol *sold = NULL; - if (global.params.bug10378 || global.params.check10378) - { - sold = searchScopes(this, loc, ident, pscopesym, flags | IgnoreSymbolVisibility); - if (!global.params.check10378) - return sold; - - if (ident == Id::dollar) // Bugzilla 15825 - return sold; - - // Search both ways - } - // First look in local scopes Dsymbol *s = searchScopes(this, loc, ident, pscopesym, flags | SearchLocalsOnly); if (!s) { // Second look in imported modules s = searchScopes(this, loc, ident, pscopesym, 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(this, loc, ident, pscopesym, flags | SearchLocalsOnly | IgnoreSymbolVisibility); - if (!s) - s = searchScopes(this, loc, ident, pscopesym, flags | SearchImportsOnly | IgnoreSymbolVisibility); - - if (s && !(flags & IgnoreErrors)) - ::deprecation(loc, "%s is not visible from module %s", s->toPrettyChars(), _module->toChars()); - } - } - - if (global.params.check10378) - { - Dsymbol *snew = s; - if (sold != snew) - deprecation10378(loc, sold, snew); - if (global.params.bug10378) - s = sold; } return s; } @@ -607,7 +572,7 @@ structalign_t Scope::alignment() * one with a close spelling. */ -void *scope_search_fp(void *arg, const char *seed, int* cost) +static void *scope_search_fp(void *arg, const char *seed, int* cost) { //printf("scope_search_fp('%s')\n", seed); @@ -640,45 +605,15 @@ void *scope_search_fp(void *arg, const char *seed, int* cost) return (void*)s; } -void Scope::deprecation10378(Loc loc, Dsymbol *sold, Dsymbol *snew) -{ - // Bugzilla 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 = NULL; - OverloadSet *osnew = NULL; - if (sold && (osold = sold->isOverloadSet()) != NULL && - snew && (osnew = snew->isOverloadSet()) != NULL && - osold->a.length == osnew->a.length) - return; - - OutBuffer buf; - buf.writestring("local import search method found "); - if (osold) - buf.printf("%s %s (%d overloads)", sold->kind(), sold->toPrettyChars(), (int)osold->a.length); - 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(), (int)osnew->a.length); - else if (snew) - buf.printf("%s %s", snew->kind(), snew->toPrettyChars()); - else - buf.writestring("nothing"); - - deprecation(loc, "%s", buf.peekChars()); -} - Dsymbol *Scope::search_correct(Identifier *ident) { if (global.gag) return NULL; // don't do it for speculative compiles; too time consuming + Dsymbol *scopesym = NULL; + // search for exact name first + if (Dsymbol *s = search(Loc(), ident, &scopesym, IgnoreErrors)) + return s; return (Dsymbol *)speller(ident->toChars(), &scope_search_fp, this, idchars); } diff --git a/gcc/d/dmd/dsymbol.c b/gcc/d/dmd/dsymbol.c index 5b4fad4..293484c 100644 --- a/gcc/d/dmd/dsymbol.c +++ b/gcc/d/dmd/dsymbol.c @@ -531,7 +531,9 @@ Dsymbol *Dsymbol::search_correct(Identifier *ident) { if (global.gag) return NULL; // don't do it for speculative compiles; too time consuming - + // search for exact name first + if (Dsymbol *s = search(Loc(), ident, IgnoreErrors)) + return s; return (Dsymbol *)speller(ident->toChars(), &symbol_search_fp, (void *)this, idchars); } @@ -1094,7 +1096,7 @@ Dsymbol *ScopeDsymbol::search(const Loc &loc, Identifier *ident, int flags) if ((flags & IgnorePrivateImports) && prots[i] == Prot::private_) continue; - int sflags = flags & (IgnoreErrors | IgnoreAmbiguous | IgnoreSymbolVisibility); // remember these in recursive searches + int sflags = flags & (IgnoreErrors | IgnoreAmbiguous); // remember these in recursive searches Dsymbol *ss = (*importedScopes)[i]; //printf("\tscanning import '%s', prots = %d, isModule = %p, isImport = %p\n", ss->toChars(), prots[i], ss->isModule(), ss->isImport()); @@ -1108,9 +1110,7 @@ Dsymbol *ScopeDsymbol::search(const Loc &loc, Identifier *ident, int flags) { if (flags & SearchImportsOnly) continue; - // compatibility with -transition=import (Bugzilla 15925) - // SearchLocalsOnly should always get set for new lookup rules - sflags |= (flags & SearchLocalsOnly); + sflags |= SearchLocalsOnly; } /* Don't find private members if ss is a module @@ -1190,19 +1190,6 @@ Dsymbol *ScopeDsymbol::search(const Loc &loc, Identifier *ident, int flags) a = mergeOverloadSet(ident, a, s); s = a; } - - // TODO: remove once private symbol visibility has been deprecated - if (!(flags & IgnoreErrors) && s->prot().kind == Prot::private_ && - !s->isOverloadable() && !s->parent->isTemplateMixin() && !s->parent->isNspace()) - { - AliasDeclaration *ad; - // accessing private selective and renamed imports is - // deprecated by restricting the symbol visibility - if (s->isImport() || ((ad = s->isAliasDeclaration()) != NULL && ad->_import != NULL)) - {} - else - error(loc, "%s %s is private", s->kind(), s->toPrettyChars()); - } //printf("\tfound in imports %s.%s\n", toChars(), s.toChars()); return s; } diff --git a/gcc/d/dmd/expression.c b/gcc/d/dmd/expression.c index 395dc56..3314d0c 100644 --- a/gcc/d/dmd/expression.c +++ b/gcc/d/dmd/expression.c @@ -677,7 +677,7 @@ static Dsymbol *searchScopes(Scope *sc, Loc loc, Identifier *ident, int flags) * Find symbol in accordance with the UFCS name look up rule */ -Expression *searchUFCS(Scope *sc, UnaExp *ue, Identifier *ident) +static Expression *searchUFCS(Scope *sc, UnaExp *ue, Identifier *ident) { //printf("searchUFCS(ident = %s)\n", ident->toChars()); Loc loc = ue->loc; @@ -687,46 +687,13 @@ Expression *searchUFCS(Scope *sc, UnaExp *ue, Identifier *ident) if (sc->flags & SCOPEignoresymbolvisibility) flags |= IgnoreSymbolVisibility; - Dsymbol *sold = NULL; - if (global.params.bug10378 || global.params.check10378) - { - sold = searchScopes(sc, loc, ident, flags | IgnoreSymbolVisibility); - if (!global.params.check10378) - { - s = sold; - goto Lsearchdone; - } - } - // First look in local scopes s = searchScopes(sc, loc, ident, flags | SearchLocalsOnly); if (!s) { // Second look in imported modules s = searchScopes(sc, loc, ident, 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(sc, loc, ident, flags | SearchLocalsOnly | IgnoreSymbolVisibility); - if (!s) - s = searchScopes(sc, loc, ident, flags | SearchImportsOnly | IgnoreSymbolVisibility); - if (s) - ::deprecation(loc, "%s is not visible from module %s", s->toPrettyChars(), sc->_module->toChars()); - } - } - if (global.params.check10378) - { - Dsymbol *snew = s; - if (sold != 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/gcc/d/dmd/expression.h b/gcc/d/dmd/expression.h index d84878f..15a4d87 100644 --- a/gcc/d/dmd/expression.h +++ b/gcc/d/dmd/expression.h @@ -58,7 +58,7 @@ struct Symbol; // back end symbol Expression *resolveProperties(Scope *sc, Expression *e); Expression *resolvePropertiesOnly(Scope *sc, Expression *e1); bool checkAccess(Loc loc, Scope *sc, Expression *e, Declaration *d); -bool checkAccess(Loc loc, Scope *sc, Package *p); +bool checkAccess(Scope *sc, Package *p); Expression *build_overload(Loc loc, Scope *sc, Expression *ethis, Expression *earg, Dsymbol *d); Dsymbol *search_function(ScopeDsymbol *ad, Identifier *funcid); void expandTuples(Expressions *exps); diff --git a/gcc/d/dmd/expressionsem.c b/gcc/d/dmd/expressionsem.c index ecafd9d..a4ff0b4 100644 --- a/gcc/d/dmd/expressionsem.c +++ b/gcc/d/dmd/expressionsem.c @@ -43,6 +43,7 @@ bool checkAccess(AggregateDeclaration *ad, Loc loc, Scope *sc, Dsymbol *smember) bool checkNestedRef(Dsymbol *s, Dsymbol *p); bool checkFrameAccess(Loc loc, Scope *sc, AggregateDeclaration *ad, size_t istart = 0); bool symbolIsVisible(Module *mod, Dsymbol *s); +bool symbolIsVisible(Scope *sc, Dsymbol *s); VarDeclaration *copyToTemp(StorageClass stc, const char *name, Expression *e); Expression *extractSideEffect(Scope *sc, const char *name, Expression **e0, Expression *e, bool alwaysCopy = false); Type *getTypeInfoType(Loc loc, Type *t, Scope *sc); @@ -331,7 +332,7 @@ public: /* See if the symbol was a member of an enclosing 'with' */ WithScopeSymbol *withsym = scopesym->isWithScopeSymbol(); - if (withsym && withsym->withstate->wthis) + if (withsym && withsym->withstate->wthis && symbolIsVisible(sc, s)) { /* Disallow shadowing */ @@ -368,9 +369,20 @@ public: { if (withsym) { - Declaration *d = s->isDeclaration(); - if (d) - checkAccess(exp->loc, sc, NULL, d); + if (withsym->withstate->exp->type->ty != Tvoid) + { + // with (exp)' is a type expression + // or 's' is not visible there (for error message) + e = new TypeExp(exp->loc, withsym->withstate->exp->type); + } + else + { + // 'with (exp)' is a Package/Module + e = withsym->withstate->exp; + } + e = new DotIdExp(exp->loc, e, exp->ident); + result = semantic(e, sc); + return; } /* If f is really a function template, @@ -8374,17 +8386,18 @@ Expression *semanticY(DotIdExp *exp, Scope *sc, int flag) */ if (s && !(sc->flags & SCOPEignoresymbolvisibility) && !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 + s = NULL; + } + if (s) + { + Package *p = s->isPackage(); + if (p && checkAccess(sc, p)) + { + s = NULL; + } } if (s) { - if (Package *p = s->isPackage()) - checkAccess(exp->loc, sc, p); - // if 's' is a tuple variable, the tuple is returned. s = s->toAlias(); @@ -8555,8 +8568,14 @@ 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()); + { + if (s->isPackage()) + exp->error("undefined identifier `%s` in %s `%s`, perhaps add `static import %s;`", + exp->ident->toChars(), ie->sds->kind(), ie->sds->toPrettyChars(), s->toPrettyChars()); + else + 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()); + } else exp->error("undefined identifier '%s' in %s '%s'", exp->ident->toChars(), ie->sds->kind(), ie->sds->toPrettyChars()); diff --git a/gcc/d/dmd/globals.h b/gcc/d/dmd/globals.h index 502bae2..6e65d86 100644 --- a/gcc/d/dmd/globals.h +++ b/gcc/d/dmd/globals.h @@ -126,8 +126,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 vsafe; // use enhanced @safe checking unsigned cplusplus; // version of C++ name mangling to support bool showGaggedErrors; // print gagged errors anyway diff --git a/gcc/d/dmd/mtype.c b/gcc/d/dmd/mtype.c index ceee70a..cc8eb22 100644 --- a/gcc/d/dmd/mtype.c +++ b/gcc/d/dmd/mtype.c @@ -6996,8 +6996,8 @@ void TypeQualified::resolveHelper(Loc loc, Scope *sc, Dsymbol *sm = s->searchX(loc, sc, id); if (sm && !(sc->flags & SCOPEignoresymbolvisibility) && !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) { @@ -7965,29 +7965,6 @@ Dsymbol *TypeStruct::toDsymbol(Scope *) return sym; } -static Dsymbol *searchSymStruct(Scope *sc, Dsymbol *sym, Expression *e, Identifier *ident) -{ - int flags = sc->flags & SCOPEignoresymbolvisibility ? IgnoreSymbolVisibility : 0; - Dsymbol *sold = NULL; - if (global.params.bug10378 || global.params.check10378) - { - sold = sym->search(e->loc, ident, flags); - if (!global.params.check10378) - return sold; - } - - Dsymbol *s = sym->search(e->loc, ident, flags | SearchLocalsOnly); - if (global.params.check10378) - { - Dsymbol *snew = s; - if (sold != snew) - Scope::deprecation10378(e->loc, sold, snew); - if (global.params.bug10378) - s = sold; - } - return s; -} - Expression *TypeStruct::dotExp(Scope *sc, Expression *e, Identifier *ident, int flag) { Dsymbol *s; @@ -8038,7 +8015,8 @@ Expression *TypeStruct::dotExp(Scope *sc, Expression *e, Identifier *ident, int return e; } - s = searchSymStruct(sc, sym, e, ident); + const int flags = sc->flags & SCOPEignoresymbolvisibility ? IgnoreSymbolVisibility : 0; + s = sym->search(e->loc, ident, flags | IgnorePrivateImports); L1: if (!s) { @@ -8046,8 +8024,7 @@ L1: } if (!(sc->flags & SCOPEignoresymbolvisibility) && !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 { @@ -8524,35 +8501,6 @@ Dsymbol *TypeClass::toDsymbol(Scope *) return sym; } -static Dsymbol *searchSymClass(Scope *sc, Dsymbol *sym, Expression *e, Identifier *ident) -{ - int flags = sc->flags & SCOPEignoresymbolvisibility ? IgnoreSymbolVisibility : 0; - Dsymbol *sold = NULL; - if (global.params.bug10378 || global.params.check10378) - { - sold = sym->search(e->loc, ident, flags | IgnoreSymbolVisibility); - if (!global.params.check10378) - return sold; - } - - Dsymbol *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) - { - Dsymbol *snew = s; - if (sold != snew) - Scope::deprecation10378(e->loc, sold, snew); - if (global.params.bug10378) - s = sold; - } - return s; -} - Expression *TypeClass::dotExp(Scope *sc, Expression *e, Identifier *ident, int flag) { Dsymbol *s; @@ -8606,7 +8554,9 @@ Expression *TypeClass::dotExp(Scope *sc, Expression *e, Identifier *ident, int f return e; } - s = searchSymClass(sc, sym, e, ident); + int flags = sc->flags & SCOPEignoresymbolvisibility ? IgnoreSymbolVisibility : 0; + s = sym->search(e->loc, ident, flags | IgnorePrivateImports); + L1: if (!s) { @@ -8754,8 +8704,7 @@ L1: } if (!(sc->flags & SCOPEignoresymbolvisibility) && !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 { diff --git a/gcc/d/dmd/parse.c b/gcc/d/dmd/parse.c index 2664af2..bae3448 100644 --- a/gcc/d/dmd/parse.c +++ b/gcc/d/dmd/parse.c @@ -644,7 +644,6 @@ Dsymbols *Parser::parseDeclDefs(int once, Dsymbol **pLastDecl, PrefixAttributes case TOKdeprecated: { - Expression *e = NULL; if (StorageClass _stc = parseDeprecatedAttribute(this, &pAttrs->depmsg)) { stc = _stc; diff --git a/gcc/d/dmd/scope.h b/gcc/d/dmd/scope.h index b22823f..7e1b634 100644 --- a/gcc/d/dmd/scope.h +++ b/gcc/d/dmd/scope.h @@ -144,7 +144,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/gcc/d/dmd/traits.c b/gcc/d/dmd/traits.c index 46b7d96..5fd4b48 100644 --- a/gcc/d/dmd/traits.c +++ b/gcc/d/dmd/traits.c @@ -933,7 +933,7 @@ Expression *semanticTraits(TraitsExp *e, Scope *sc) return dimError(e, 1, dim); Scope *sc2 = sc->push(); - sc2->flags = sc->flags | SCOPEnoaccesscheck; + sc2->flags = sc->flags | SCOPEnoaccesscheck | SCOPEignoresymbolvisibility; bool ok = TemplateInstance::semanticTiargs(e->loc, sc2, e->args, 1); sc2->pop(); if (!ok) diff --git a/gcc/d/gdc.texi b/gcc/d/gdc.texi index 7f4906d..e727848 100644 --- a/gcc/d/gdc.texi +++ b/gcc/d/gdc.texi @@ -634,8 +634,6 @@ Report additional information about D language changes identified by @table @samp @item all List information on all language changes. -@item checkimports -Give deprecation messages about @option{-ftransition=import} anomalies. @item complex List all usages of complex or imaginary types. @item dip1000 @@ -644,14 +642,6 @@ Implements @uref{http://wiki.dlang.org/DIP1000} (experimental). Implements @uref{http://wiki.dlang.org/DIP25} (experimental). @item field List all non-mutable fields which occupy an object instance. -@item import -Tells the compiler to revert to using an old lookup behavior for resolving -unqualified symbol names, where this was done in a single pass, ignoring -any protection attributes. The default name lookup strategy is to use two -passes, the first ignoring imported declarations, and the second only -looking at imports. The protection (@code{private}, @code{package}, -@code{protected}) of symbols is also enforced to resolve any conflicts -between private and public symbols. @item nogc List all hidden GC allocations. @item tls diff --git a/gcc/d/lang.opt b/gcc/d/lang.opt index 6c8dfbf..62e9f8e 100644 --- a/gcc/d/lang.opt +++ b/gcc/d/lang.opt @@ -289,10 +289,6 @@ ftransition=all D RejectNegative List information on all language changes. -ftransition=checkimports -D RejectNegative -Give deprecation messages about -ftransition=import anomalies. - ftransition=complex D RejectNegative List all usages of complex or imaginary types. @@ -309,10 +305,6 @@ ftransition=field D RejectNegative List all non-mutable fields which occupy an object instance. -ftransition=import -D RejectNegative -Revert to single phase name lookup. - ftransition=nogc D RejectNegative List all hidden GC allocations. diff --git a/gcc/testsuite/gdc.test/compilable/checkimports3.d b/gcc/testsuite/gdc.test/compilable/checkimports3.d new file mode 100644 index 0000000..770b382 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/checkimports3.d @@ -0,0 +1,12 @@ +/* +REQUIRED_ARGS: -de +EXTRA_FILES: imports/checkimports3a.d imports/checkimports3b.d imports/checkimports3c.d +*/ +import imports.checkimports3a; +import imports.checkimports3b; +import imports.checkimports3c; + +void test() +{ + foo(); +} diff --git a/gcc/testsuite/gdc.test/compilable/ddoc14633.d b/gcc/testsuite/gdc.test/compilable/ddoc14633.d index 759287c..af39633 100644 --- a/gcc/testsuite/gdc.test/compilable/ddoc14633.d +++ b/gcc/testsuite/gdc.test/compilable/ddoc14633.d @@ -1,12 +1,6 @@ // PERMUTE_ARGS: // REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -w -o- -/* -TEST_OUTPUT: ---- ---- -*/ - /** Blah Params: T = some type diff --git a/gcc/testsuite/gdc.test/compilable/deprecate14283.d b/gcc/testsuite/gdc.test/compilable/deprecate14283.d index 9c82add..e91db64 100644 --- a/gcc/testsuite/gdc.test/compilable/deprecate14283.d +++ b/gcc/testsuite/gdc.test/compilable/deprecate14283.d @@ -1,11 +1,5 @@ // REQUIRED_ARGS: -dw // PERMUTE_ARGS: -/* -TEST_OUTPUT: ---- ---- -*/ - class C { void bug() diff --git a/gcc/testsuite/gdc.test/compilable/diag11066.d b/gcc/testsuite/gdc.test/compilable/diag11066.d index 3d93831..598ff85 100644 --- a/gcc/testsuite/gdc.test/compilable/diag11066.d +++ b/gcc/testsuite/gdc.test/compilable/diag11066.d @@ -1,10 +1,4 @@ // REQUIRED_ARGS: -w -profile -/* -TEST_OUTPUT: ---- ---- -*/ - void main() { string s; diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag12598.d b/gcc/testsuite/gdc.test/compilable/diag12598.d index 236692d..8f98188 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag12598.d +++ b/gcc/testsuite/gdc.test/compilable/diag12598.d @@ -1,9 +1,6 @@ /* -REQUIRED_ARGS: -transition=import -TEST_OUTPUT: ---- -fail_compilation/diag12598.d(14): Error: struct 'lines' is a type, not an lvalue ---- +REQUIRED_ARGS: +EXTRA_FILES: imports/diag12598a.d */ class C diff --git a/gcc/testsuite/gdc.test/compilable/diag3243.d b/gcc/testsuite/gdc.test/compilable/diag3243.d index b25d0bb..7d034d8 100644 --- a/gcc/testsuite/gdc.test/compilable/diag3243.d +++ b/gcc/testsuite/gdc.test/compilable/diag3243.d @@ -1,11 +1,5 @@ // REQUIRED_ARGS: -vtls // PERMUTE_ARGS: -/* -TEST_OUTPUT: ---- ---- -*/ - template T() { static this() {} diff --git a/gcc/testsuite/gdc.test/compilable/dip22d.d b/gcc/testsuite/gdc.test/compilable/dip22d.d new file mode 100644 index 0000000..1becf0c --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/dip22d.d @@ -0,0 +1,10 @@ +/* +REQUIRED_ARGS: +*/ + +// https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP22.md + +import imports.dip22d; +import imports.dip22e; + +Foo foo; diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3a.d b/gcc/testsuite/gdc.test/compilable/imports/checkimports3a.d index 85e6cd8..85e6cd8 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3a.d +++ b/gcc/testsuite/gdc.test/compilable/imports/checkimports3a.d diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3b.d b/gcc/testsuite/gdc.test/compilable/imports/checkimports3b.d index 37ea7ae..37ea7ae 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3b.d +++ b/gcc/testsuite/gdc.test/compilable/imports/checkimports3b.d diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3c.d b/gcc/testsuite/gdc.test/compilable/imports/checkimports3c.d index 93b4ac5..93b4ac5 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/imports/checkimports3c.d +++ b/gcc/testsuite/gdc.test/compilable/imports/checkimports3c.d diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/diag12598a.d b/gcc/testsuite/gdc.test/compilable/imports/diag12598a.d index dee0054..dee0054 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/imports/diag12598a.d +++ b/gcc/testsuite/gdc.test/compilable/imports/diag12598a.d diff --git a/gcc/testsuite/gdc.test/compilable/imports/dip22d.d b/gcc/testsuite/gdc.test/compilable/imports/dip22d.d new file mode 100644 index 0000000..9f80442 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/dip22d.d @@ -0,0 +1,5 @@ +module imports.dip22d; + +private struct Foo {} +private void foo() {} +private void bar() {} diff --git a/gcc/testsuite/gdc.test/compilable/imports/dip22e.d b/gcc/testsuite/gdc.test/compilable/imports/dip22e.d new file mode 100644 index 0000000..3464e60 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/dip22e.d @@ -0,0 +1,4 @@ +module imports.dip22e; + +public struct Foo {} +public void bar(int) {} diff --git a/gcc/testsuite/gdc.test/compilable/test12567a.d b/gcc/testsuite/gdc.test/compilable/test12567a.d index 53cc377..464c840 100644 --- a/gcc/testsuite/gdc.test/compilable/test12567a.d +++ b/gcc/testsuite/gdc.test/compilable/test12567a.d @@ -1,10 +1,5 @@ // REQUIRED_ARGS: // PERMUTE_ARGS: -/* -TEST_OUTPUT: ---- ---- -*/ deprecated module test12567a; diff --git a/gcc/testsuite/gdc.test/compilable/test12567b.d b/gcc/testsuite/gdc.test/compilable/test12567b.d index 2e37d31..9b9d7e1 100644 --- a/gcc/testsuite/gdc.test/compilable/test12567b.d +++ b/gcc/testsuite/gdc.test/compilable/test12567b.d @@ -1,10 +1,5 @@ // REQUIRED_ARGS: // PERMUTE_ARGS: -/* -TEST_OUTPUT: ---- ---- -*/ deprecated("message") module test12567b; diff --git a/gcc/testsuite/gdc.test/compilable/test12567d.d b/gcc/testsuite/gdc.test/compilable/test12567d.d index 512f0b7..ee7bc29 100644 --- a/gcc/testsuite/gdc.test/compilable/test12567d.d +++ b/gcc/testsuite/gdc.test/compilable/test12567d.d @@ -1,10 +1,5 @@ // REQUIRED_ARGS: -d // PERMUTE_ARGS: -/* -TEST_OUTPUT: ---- ---- -*/ import imports.a12567; void main() { foo(); } diff --git a/gcc/testsuite/gdc.test/compilable/test12567e.d b/gcc/testsuite/gdc.test/compilable/test12567e.d index 14c72bc..2e74cf7 100644 --- a/gcc/testsuite/gdc.test/compilable/test12567e.d +++ b/gcc/testsuite/gdc.test/compilable/test12567e.d @@ -1,7 +1,2 @@ // REQUIRED_ARGS: -o- -/* -TEST_OUTPUT: ---- ---- -*/ deprecated("a" ~ "b") module fail12567; diff --git a/gcc/testsuite/gdc.test/compilable/test13053.d b/gcc/testsuite/gdc.test/compilable/test13053.d index 3f8b421..ddd4c90 100644 --- a/gcc/testsuite/gdc.test/compilable/test13053.d +++ b/gcc/testsuite/gdc.test/compilable/test13053.d @@ -1,10 +1,4 @@ // PERMUTE_ARGS: -w -wi -/* -TEST_OUTPUT: ---- ---- -*/ - @system: struct S diff --git a/gcc/testsuite/gdc.test/compilable/test14375.d b/gcc/testsuite/gdc.test/compilable/test14375.d index 30206d8..ccff8d5 100644 --- a/gcc/testsuite/gdc.test/compilable/test14375.d +++ b/gcc/testsuite/gdc.test/compilable/test14375.d @@ -1,8 +1,4 @@ -/* -TEST_OUTPUT: ---- ---- - */ +// https://issues.dlang.org/show_bug.cgi?id=14375 interface IKeysAPI(string greetings) { static assert(greetings == "Hello world", greetings); } diff --git a/gcc/testsuite/gdc.test/compilable/test15785.d b/gcc/testsuite/gdc.test/compilable/test15785.d index c8ad240..483c080 100644 --- a/gcc/testsuite/gdc.test/compilable/test15785.d +++ b/gcc/testsuite/gdc.test/compilable/test15785.d @@ -1,10 +1,5 @@ // REQUIRED_ARGS: -de // PERMUTE_ARGS: -/* -TEST_OUTPUT: ---- ---- -*/ import imports.test15785; class Derived : Base, IBase2 diff --git a/gcc/testsuite/gdc.test/compilable/test15856.d b/gcc/testsuite/gdc.test/compilable/test15856.d index b61d1c4..8a5c425 100644 --- a/gcc/testsuite/gdc.test/compilable/test15856.d +++ b/gcc/testsuite/gdc.test/compilable/test15856.d @@ -1,4 +1,4 @@ -// REQUIRED_ARGS: -transition=checkimports -de +// REQUIRED_ARGS: -de // PERMUTE_ARGS: /* TEST_PUTPUT: diff --git a/gcc/testsuite/gdc.test/compilable/test15925.d b/gcc/testsuite/gdc.test/compilable/test15925.d deleted file mode 100644 index 871af4e..0000000 --- a/gcc/testsuite/gdc.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/gcc/testsuite/gdc.test/compilable/test17791.d b/gcc/testsuite/gdc.test/compilable/test17791.d index 3244c12..cfd0244 100644 --- a/gcc/testsuite/gdc.test/compilable/test17791.d +++ b/gcc/testsuite/gdc.test/compilable/test17791.d @@ -1,9 +1,4 @@ -/* -REQUIRED_ARGS: -de -TEST_OUTPUT: ---- ---- -*/ +// REQUIRED_ARGS: -de deprecated("A deprecated class") { class DepClass { diff --git a/gcc/testsuite/gdc.test/compilable/test7815.d b/gcc/testsuite/gdc.test/compilable/test7815.d index 405d9fc..631c020 100644 --- a/gcc/testsuite/gdc.test/compilable/test7815.d +++ b/gcc/testsuite/gdc.test/compilable/test7815.d @@ -1,10 +1,4 @@ // REQUIRED_ARGS: -o- -/* -TEST_OUTPUT: ---- ---- -*/ - mixin template Helpers() { static if (is(Flags!Move)) diff --git a/gcc/testsuite/gdc.test/compilable/testcheckimports.d b/gcc/testsuite/gdc.test/compilable/testcheckimports.d index 328b8a9..ee9764a 100644 --- a/gcc/testsuite/gdc.test/compilable/testcheckimports.d +++ b/gcc/testsuite/gdc.test/compilable/testcheckimports.d @@ -1,9 +1,5 @@ -// REQUIRED_ARGS: -transition=checkimports -de -/* -TEST_OUTPUT: ---- ---- -*/ +// REQUIRED_ARGS: +// EXTRA_FILES: imports/test15857a.d imports/test15857b.d imports/test15857c.d // https://issues.dlang.org/show_bug.cgi?id=15825 diff --git a/gcc/testsuite/gdc.test/compilable/warn3882.d b/gcc/testsuite/gdc.test/compilable/warn3882.d index bf824b8..d981a47 100644 --- a/gcc/testsuite/gdc.test/compilable/warn3882.d +++ b/gcc/testsuite/gdc.test/compilable/warn3882.d @@ -1,10 +1,4 @@ // PERMUTE_ARGS: -w -wi -debug -/* -TEST_OUTPUT: ---- ---- -*/ - @safe pure nothrow void strictVoidReturn(T)(T x) {} @safe pure nothrow void nonstrictVoidReturn(T)(ref T x) {} diff --git a/gcc/testsuite/gdc.test/fail_compilation/checkimports1a.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports1a.d deleted file mode 100644 index a27ddea..0000000 --- a/gcc/testsuite/gdc.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/gcc/testsuite/gdc.test/fail_compilation/checkimports1b.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports1b.d deleted file mode 100644 index 60d3ae8..0000000 --- a/gcc/testsuite/gdc.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: struct 'lines' is a type, not an lvalue ---- -*/ - -// old lookup + information -class C -{ - void f() - { - import imports.diag12598a; - lines ~= ""; - } - - string[] lines; -} diff --git a/gcc/testsuite/gdc.test/fail_compilation/checkimports1c.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports1c.d deleted file mode 100644 index f6587ef..0000000 --- a/gcc/testsuite/gdc.test/fail_compilation/checkimports1c.d +++ /dev/null @@ -1,20 +0,0 @@ -// REQUIRED_ARGS: -transition=checkimports -transition=import -/* -TEST_OUTPUT: ---- -fail_compilation/checkimports1c.d(16): Deprecation: local import search method found struct imports.diag12598a.lines instead of variable checkimports1c.C.lines -fail_compilation/checkimports1c.d(16): Error: struct 'lines' is a type, not an lvalue ---- -*/ - -// old lookup + information (the order of switches is reverse) -class C -{ - void f() - { - import imports.diag12598a; - lines ~= ""; - } - - string[] lines; -} diff --git a/gcc/testsuite/gdc.test/fail_compilation/checkimports2a.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports2a.d index 567a308..abec424 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/checkimports2a.d +++ b/gcc/testsuite/gdc.test/fail_compilation/checkimports2a.d @@ -1,16 +1,11 @@ -// REQUIRED_ARGS: -transition=checkimports +// REQUIRED_ARGS: /* TEST_OUTPUT: --- -fail_compilation/checkimports2a.d(26): Deprecation: local import search method found variable imports.imp2.X instead of variable checkimports2a.X -fail_compilation/checkimports2a.d(32): Deprecation: local import search method found variable imports.imp2.X instead of nothing -fail_compilation/checkimports2a.d(32): Error: no property 'X' for type 'checkimports2a.B' -fail_compilation/checkimports2a.d(32): while evaluating: `static assert((B).X == 0)` -fail_compilation/checkimports2a.d(33): Deprecation: local import search method found variable imports.imp2.Y instead of nothing -fail_compilation/checkimports2a.d(33): Error: no property 'Y' for type 'checkimports2a.B' -fail_compilation/checkimports2a.d(33): while evaluating: `static assert((B).Y == 2)` -fail_compilation/checkimports2a.d(35): Deprecation: local import search method found variable imports.imp2.X instead of variable checkimports2a.X -fail_compilation/checkimports2a.d(36): Deprecation: local import search method found variable imports.imp2.Y instead of variable imports.imp1.Y +fail_compilation/checkimports2a.d(27): Error: no property `X` for type `checkimports2a.B`, did you mean `imports.imp2.X`? +fail_compilation/checkimports2a.d(27): while evaluating: `static assert((B).X == 0)` +fail_compilation/checkimports2a.d(28): Error: no property `Y` for type `checkimports2a.B`, did you mean `imports.imp2.Y`? +fail_compilation/checkimports2a.d(28): while evaluating: `static assert((B).Y == 2)` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/checkimports2b.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports2b.d index 4f52521..8b99fdc 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/checkimports2b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/checkimports2b.d @@ -1,17 +1,8 @@ -// REQUIRED_ARGS: -transition=import -transition=checkimports -de +// REQUIRED_ARGS: /* TEST_OUTPUT: --- -fail_compilation/checkimports2b.d(27): Deprecation: local import search method found variable imports.imp2.X instead of variable checkimports2b.X -fail_compilation/checkimports2b.d(27): while evaluating: `static assert(2 == 2)` -fail_compilation/checkimports2b.d(33): Deprecation: local import search method found variable imports.imp2.X instead of nothing -fail_compilation/checkimports2b.d(33): while evaluating: `static assert(2 == 2)` -fail_compilation/checkimports2b.d(34): Deprecation: local import search method found variable imports.imp2.Y instead of nothing -fail_compilation/checkimports2b.d(34): while evaluating: `static assert(2 == 2)` -fail_compilation/checkimports2b.d(36): Deprecation: local import search method found variable imports.imp2.X instead of variable checkimports2b.X -fail_compilation/checkimports2b.d(36): while evaluating: `static assert(2 == 2)` -fail_compilation/checkimports2b.d(37): Deprecation: local import search method found variable imports.imp2.Y instead of variable imports.imp1.Y -fail_compilation/checkimports2b.d(37): while evaluating: `static assert(2 == 2)` +fail_compilation/checkimports2b.d(18): Error: static assert: `0 == 2` is false --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/checkimports2c.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports2c.d index f56da9c..4208dcdf 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/checkimports2c.d +++ b/gcc/testsuite/gdc.test/fail_compilation/checkimports2c.d @@ -1,18 +1,8 @@ -// 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(18): Error: static assert: `0 == 2` is false --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/checkimports3.d b/gcc/testsuite/gdc.test/fail_compilation/checkimports3.d deleted file mode 100644 index e9d44a7..0000000 --- a/gcc/testsuite/gdc.test/fail_compilation/checkimports3.d +++ /dev/null @@ -1,15 +0,0 @@ -/* -REQUIRED_ARGS: -transition=checkimports -de -TEST_OUTPUT: ---- -fail_compilation/checkimports3.d(14): Deprecation: local import search method found overloadset checkimports3.foo (3 overloads) instead of overloadset checkimports3.foo (2 overloads) ---- -*/ -import imports.checkimports3a; -import imports.checkimports3b; -import imports.checkimports3c; - -void test() -{ - foo(); -} diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10169.d b/gcc/testsuite/gdc.test/fail_compilation/diag10169.d index 2a9714d..3c35b66 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag10169.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag10169.d @@ -1,8 +1,7 @@ /* 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(11): Error: no property `x` for type `B`, did you mean `imports.a10169.B.x`? --- */ import imports.a10169; diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag5385.d b/gcc/testsuite/gdc.test/fail_compilation/diag5385.d index 131659c..7c81b16 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag5385.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag5385.d @@ -1,22 +1,14 @@ /* 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(19): Error: no property `privX` for type `imports.fail5385.C`, did you mean `imports.fail5385.C.privX`? +fail_compilation/diag5385.d(20): Error: no property `packX` for type `imports.fail5385.C`, did you mean `imports.fail5385.C.packX`? +fail_compilation/diag5385.d(21): Error: no property `privX2` for type `imports.fail5385.C`, did you mean `imports.fail5385.C.privX2`? +fail_compilation/diag5385.d(22): Error: no property `packX2` for type `imports.fail5385.C`, did you mean `imports.fail5385.C.packX2`? +fail_compilation/diag5385.d(23): Error: no property `privX` for type `S`, did you mean `imports.fail5385.S.privX`? +fail_compilation/diag5385.d(24): Error: no property `packX` for type `S`, did you mean `imports.fail5385.S.packX`? +fail_compilation/diag5385.d(25): Error: no property `privX2` for type `S`, did you mean `imports.fail5385.S.privX2`? +fail_compilation/diag5385.d(26): Error: no property `packX2` for type `S`, did you mean `imports.fail5385.S.packX2`? --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/dip22a.d b/gcc/testsuite/gdc.test/fail_compilation/dip22a.d index 7497b42..5bd2b5b 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/dip22a.d +++ b/gcc/testsuite/gdc.test/fail_compilation/dip22a.d @@ -1,17 +1,12 @@ /* -REQUIRED_ARGS: -de +REQUIRED_ARGS: 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(16): Error: no property `bar` for type `imports.dip22a.Klass`, did you mean `imports.dip22a.Klass.bar`? +fail_compilation/dip22a.d(17): Error: no property `bar` for type `Struct`, did you mean `imports.dip22a.Struct.bar`? +fail_compilation/dip22a.d(18): Error: undefined identifier `bar` in module `imports.dip22a`, did you mean function `bar`? +fail_compilation/dip22a.d(19): Error: no property `bar` for type `void` +fail_compilation/dip22a.d(20): Error: no property `bar` for type `int` --- */ import imports.dip22a; diff --git a/gcc/testsuite/gdc.test/fail_compilation/dip22b.d b/gcc/testsuite/gdc.test/fail_compilation/dip22b.d index 7aca88c..9520180 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/dip22b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/dip22b.d @@ -1,8 +1,8 @@ /* -REQUIRED_ARGS: -de +REQUIRED_ARGS: TEST_OUTPUT: --- -fail_compilation/dip22b.d(12): Deprecation: pkg.dip22c.Foo is not visible from module dip22 +fail_compilation/dip22b.d(12): Error: undefined identifier `Foo`, did you mean variable `foo`? --- */ module pkg.dip22; diff --git a/gcc/testsuite/gdc.test/fail_compilation/dip22d.d b/gcc/testsuite/gdc.test/fail_compilation/dip22d.d deleted file mode 100644 index dd1b8ef..0000000 --- a/gcc/testsuite/gdc.test/fail_compilation/dip22d.d +++ /dev/null @@ -1,12 +0,0 @@ -/* -REQUIRED_ARGS: -transition=import -TEST_OUTPUT: ---- -fail_compilation/dip22d.d(12): Error: imports.dip22d.Foo at fail_compilation/imports/dip22d.d(3) conflicts with imports.dip22e.Foo at fail_compilation/imports/dip22e.d(3) -fail_compilation/dip22d.d(12): Error: module dip22d struct imports.dip22d.Foo is private ---- -*/ -import imports.dip22d; -import imports.dip22e; - -Foo foo; diff --git a/gcc/testsuite/gdc.test/fail_compilation/dip22e.d b/gcc/testsuite/gdc.test/fail_compilation/dip22e.d index f82d8e7..b1411b2 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/dip22e.d +++ b/gcc/testsuite/gdc.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 (2 overloads) instead of function imports.dip22e.bar +fail_compilation/dip22e.d(14): Error: undefined identifier `foo`, did you mean struct `Foo`? --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail10528.d b/gcc/testsuite/gdc.test/fail_compilation/fail10528.d index c05a29a..067e83c 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail10528.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail10528.d @@ -1,18 +1,14 @@ /* 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(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(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` +fail_compilation/fail10528.d(19): Error: undefined identifier `a` +fail_compilation/fail10528.d(20): Error: undefined identifier `a` in module `a10528`, did you mean variable `a`? +fail_compilation/fail10528.d(22): Error: undefined identifier `b` +fail_compilation/fail10528.d(23): Error: undefined identifier `b` in module `a10528`, did you mean enum member `b`? +fail_compilation/fail10528.d(25): Error: no property `c` for type `S`, did you mean `a10528.S.c`? +fail_compilation/fail10528.d(26): Error: no property `c` for type `S`, did you mean `a10528.S.c`? +fail_compilation/fail10528.d(28): Error: no property `d` for type `a10528.C`, did you mean `a10528.C.d`? +fail_compilation/fail10528.d(29): Error: no property `d` for type `a10528.C`, did you mean `a10528.C.d`? --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail262.d b/gcc/testsuite/gdc.test/fail_compilation/fail262.d index 93e6af0..6d15e1a 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail262.d +++ b/gcc/testsuite/gdc.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 `shared const void fail262.A.f()`? --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail313.d b/gcc/testsuite/gdc.test/fail_compilation/fail313.d index 8f11001..a2c2890 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail313.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail313.d @@ -2,11 +2,9 @@ REQUIRED_ARGS: -de TEST_OUTPUT: --- -fail_compilation/fail313.d(18): Deprecation: module imports.b313 is not accessible here, perhaps add 'static import imports.b313;' -fail_compilation/fail313.d(25): Deprecation: imports.a313.core is not visible from module test313 -fail_compilation/fail313.d(25): Deprecation: package core.stdc is not accessible here -fail_compilation/fail313.d(25): Deprecation: module core.stdc.stdio is not accessible here, perhaps add 'static import core.stdc.stdio;' -fail_compilation/fail313.d(30): Deprecation: package imports.pkg313 is not accessible here, perhaps add 'static import imports.pkg313;' +fail_compilation/fail313.d(15): Error: undefined identifier `b313` in package `imports`, perhaps add `static import imports.b313;` +fail_compilation/fail313.d(22): Error: undefined identifier `core` +fail_compilation/fail313.d(27): Error: undefined identifier `pkg313` in package `imports`, perhaps add `static import imports.pkg313;` --- */ module test313; diff --git a/gcc/testsuite/gdc.test/compilable/imports/imp15925.d b/gcc/testsuite/gdc.test/fail_compilation/imports/imp15925.d index c9d537a..c9d537a 100644 --- a/gcc/testsuite/gdc.test/compilable/imports/imp15925.d +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/imp15925.d diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/imp21353.d b/gcc/testsuite/gdc.test/fail_compilation/imports/imp21353.d new file mode 100644 index 0000000..e498b64 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/imp21353.d @@ -0,0 +1,7 @@ +module imports.imp21353; + +struct A { int x; } + +struct B { import imports.imp21353 : A; } + +private struct P { } diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test15117a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test15117a.d new file mode 100644 index 0000000..9daf6f1 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test15117a.d @@ -0,0 +1,9 @@ +module imports.test15117a; + +struct AssertResult {} + +auto test_usr_1() +{ + // 2. generate TyepInfoStructDeclaration + auto x = typeid(AssertResult); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/lookup.d b/gcc/testsuite/gdc.test/fail_compilation/lookup.d index 0bb5385..aedb44e 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/lookup.d +++ b/gcc/testsuite/gdc.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 `imports.imp2.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 `imports.imp2.Y`? fail_compilation/lookup.d(24): while evaluating: `static assert((B).Y == 2)` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test143.d b/gcc/testsuite/gdc.test/fail_compilation/test143.d index 1a1ed70..c95ecc1 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test143.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test143.d @@ -4,7 +4,7 @@ /* TEST_OUTPUT: --- -fail_compilation/test143.d(20): Error: undefined identifier `x` +fail_compilation/test143.d(19): Error: undefined identifier `x` --- */ module test143; diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15117.d b/gcc/testsuite/gdc.test/fail_compilation/test15117.d new file mode 100644 index 0000000..e6ce3b5 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test15117.d @@ -0,0 +1,30 @@ +// REQUIRED_ARGS: -o- +// PERMUTE_ARGS: +// COMPILED_IMPORTS: imports/test15117a.d +/* +TEST_OUTPUT: +--- +fail_compilation/test15177.d-mixin-20(20): Error: `imports.test15117a.object` is not visible from module `test15177` +fail_compilation/test15177.d(29): Error: template instance `test15177.RunApiTest!()` error instantiating +--- +*/ + +import users = imports.test15117a; + +void RunApiTest(T...)() +{ + foreach (name; __traits(allMembers, users)) + { + // 3. list the name of TyepInfoStructDeclaration, + // but it's just internal symbol and invisible. + mixin("alias func = users . " ~ name ~ ";"); + } +} + +void main() +{ + // 1. run semantic3 of users.test_usr_1 + users.test_usr_1(); + + RunApiTest!(); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15785.d b/gcc/testsuite/gdc.test/fail_compilation/test15785.d index b35e510..474076f 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test15785.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test15785.d @@ -2,12 +2,11 @@ /* 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(16): Error: no property `foo` for type `imports.test15785.Base`, did you mean `imports.test15785.Base.foo`? +fail_compilation/test15785.d(17): Error: undefined identifier `bar` --- */ + import imports.test15785; class Derived : Base diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15785b.d b/gcc/testsuite/gdc.test/fail_compilation/test15785b.d index 1613617..e09b4bf 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test15785b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test15785b.d @@ -1,11 +1,11 @@ -// REQUIRED_ARGS: -de +// REQUIRED_ARGS: // PERMUTE_ARGS: /* 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/gcc/testsuite/gdc.test/fail_compilation/test15897.d b/gcc/testsuite/gdc.test/fail_compilation/test15897.d index 19c65b4..aa22c10 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test15897.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test15897.d @@ -2,7 +2,7 @@ /* 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` --- */ module test15897; diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15925.d b/gcc/testsuite/gdc.test/fail_compilation/test15925.d new file mode 100644 index 0000000..9359859 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test15925.d @@ -0,0 +1,19 @@ +/* REQUIRED_ARGS: +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); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/test21353.d b/gcc/testsuite/gdc.test/fail_compilation/test21353.d new file mode 100644 index 0000000..0f22fe7 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test21353.d @@ -0,0 +1,26 @@ +/* +EXTRA_FILES: imports/imp21353.d +TEST_OUTPUT: +--- +fail_compilation/test21353.d(19): Error: no property `A` for type `imports.imp21353.B` +fail_compilation/test21353.d(20): Error: no property `A` for type `imports.imp21353.B` +fail_compilation/test21353.d(21): Error: no property `A` for type `imports.imp21353.B` +fail_compilation/test21353.d(23): Error: undefined identifier `P` in module `imports.imp21353` +fail_compilation/test21353.d(24): Error: undefined identifier `P` in module `imports.imp21353` +--- +*/ + +// https://issues.dlang.org/show_bug.cgi?id=21353 + +import imports.imp21353; + +void main() +{ + B.A; + with (B) { A(0); } + with (B()) { A(0); } // fixed + + imports.imp21353.P(); + with (imports.imp21353) { P(); } // fixed +} + diff --git a/gcc/testsuite/gdc.test/fail_compilation/test314.d b/gcc/testsuite/gdc.test/fail_compilation/test314.d index 3dea03f..eb3f07d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test314.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test314.d @@ -1,11 +1,11 @@ /* -REQUIRED_ARGS: -de +REQUIRED_ARGS: TEST_OUTPUT: --- -fail_compilation/test314.d(19): Deprecation: imports.a314.renamed is not visible from module test314 -fail_compilation/test314.d(20): Deprecation: imports.a314.bug is not visible from module test314 -fail_compilation/test314.d(22): Deprecation: imports.b314.renamedpkg is not visible from module test314 -fail_compilation/test314.d(23): Deprecation: imports.b314.bugpkg is not visible from module test314 +fail_compilation/test314.d(19): Error: undefined identifier `renamed` +fail_compilation/test314.d(20): Error: undefined identifier `bug` +fail_compilation/test314.d(22): Error: undefined identifier `renamedpkg` +fail_compilation/test314.d(23): Error: undefined identifier `bugpkg` --- */ |