global.params.vcomplex = value;
break;
- case OPT_ftransition_checkimports:
- global.params.check10378 = value;
- break;
-
case OPT_ftransition_complex:
global.params.vcomplex = value;
break;
global.params.vfield = value;
break;
- case OPT_ftransition_import:
- global.params.bug10378 = value;
- break;
-
case OPT_ftransition_nogc:
global.params.vgc = value;
break;
-cb1106ad5bea4293cd302b0ba1f3ce08905d40fe
+2d3d137489f030395d06cb664087fd1a35bccabe
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
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);
* (see Bugzilla 313).
*
*/
-bool checkAccess(Loc loc, Scope *sc, Package *p)
+bool checkAccess(Scope *sc, Package *p)
{
if (sc->_module == p)
return false;
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;
}
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;
}
* 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);
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);
}
{
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);
}
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());
{
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
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;
}
* 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;
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);
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);
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);
/* 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
*/
{
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,
*/
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();
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());
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
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)
{
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;
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)
{
}
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
{
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;
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)
{
}
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
{
case TOKdeprecated:
{
- Expression *e = NULL;
if (StorageClass _stc = parseDeprecatedAttribute(this, &pAttrs->depmsg))
{
stc = _stc;
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);
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)
@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
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
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.
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.
--- /dev/null
+/*
+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();
+}
// PERMUTE_ARGS:
// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -w -o-
-/*
-TEST_OUTPUT:
----
----
-*/
-
/** Blah
Params:
T = some type
// REQUIRED_ARGS: -dw
// PERMUTE_ARGS:
-/*
-TEST_OUTPUT:
----
----
-*/
-
class C
{
void bug()
// REQUIRED_ARGS: -w -profile
-/*
-TEST_OUTPUT:
----
----
-*/
-
void main()
{
string s;
--- /dev/null
+/*
+REQUIRED_ARGS:
+EXTRA_FILES: imports/diag12598a.d
+*/
+
+class C
+{
+ void f()
+ {
+ import imports.diag12598a;
+ lines ~= "";
+ }
+
+ string[] lines;
+}
+
+void main()
+{
+}
// REQUIRED_ARGS: -vtls
// PERMUTE_ARGS:
-/*
-TEST_OUTPUT:
----
----
-*/
-
template T()
{
static this() {}
--- /dev/null
+/*
+REQUIRED_ARGS:
+*/
+
+// https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP22.md
+
+import imports.dip22d;
+import imports.dip22e;
+
+Foo foo;
--- /dev/null
+void foo() {}
--- /dev/null
+private void foo(int) {}
--- /dev/null
+void foo(string) {}
--- /dev/null
+module imports.diag12598a;
+
+struct lines { }
--- /dev/null
+module imports.dip22d;
+
+private struct Foo {}
+private void foo() {}
+private void bar() {}
--- /dev/null
+module imports.dip22e;
+
+public struct Foo {}
+public void bar(int) {}
+++ /dev/null
-enum X = 1;
// REQUIRED_ARGS:
// PERMUTE_ARGS:
-/*
-TEST_OUTPUT:
----
----
-*/
deprecated
module test12567a;
// REQUIRED_ARGS:
// PERMUTE_ARGS:
-/*
-TEST_OUTPUT:
----
----
-*/
deprecated("message")
module test12567b;
// REQUIRED_ARGS: -d
// PERMUTE_ARGS:
-/*
-TEST_OUTPUT:
----
----
-*/
import imports.a12567;
void main() { foo(); }
// REQUIRED_ARGS: -o-
-/*
-TEST_OUTPUT:
----
----
-*/
deprecated("a" ~ "b") module fail12567;
// PERMUTE_ARGS: -w -wi
-/*
-TEST_OUTPUT:
----
----
-*/
-
@system:
struct S
-/*
-TEST_OUTPUT:
----
----
- */
+// https://issues.dlang.org/show_bug.cgi?id=14375
interface IKeysAPI(string greetings) {
static assert(greetings == "Hello world", greetings);
}
// REQUIRED_ARGS: -de
// PERMUTE_ARGS:
-/*
-TEST_OUTPUT:
----
----
-*/
import imports.test15785;
class Derived : Base, IBase2
-// REQUIRED_ARGS: -transition=checkimports -de
+// REQUIRED_ARGS: -de
// PERMUTE_ARGS:
/*
TEST_PUTPUT:
+++ /dev/null
-/* 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);
-}
-/*
-REQUIRED_ARGS: -de
-TEST_OUTPUT:
----
----
-*/
+// REQUIRED_ARGS: -de
deprecated("A deprecated class") {
class DepClass
{
// REQUIRED_ARGS: -o-
-/*
-TEST_OUTPUT:
----
----
-*/
-
mixin template Helpers()
{
static if (is(Flags!Move))
-// 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
// PERMUTE_ARGS: -w -wi -debug
-/*
-TEST_OUTPUT:
----
----
-*/
-
@safe pure nothrow void strictVoidReturn(T)(T x) {}
@safe pure nothrow void nonstrictVoidReturn(T)(ref T x) {}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 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;
-}
-// 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)`
---
*/
-// 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
---
*/
-// 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
---
*/
+++ /dev/null
-/*
-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();
-}
/*
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;
+++ /dev/null
-/*
-REQUIRED_ARGS: -transition=import
-TEST_OUTPUT:
----
-fail_compilation/diag12598.d(14): Error: struct 'lines' is a type, not an lvalue
----
-*/
-
-class C
-{
- void f()
- {
- import imports.diag12598a;
- lines ~= "";
- }
-
- string[] lines;
-}
-
-void main()
-{
-}
/*
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`?
---
*/
/*
-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;
/*
-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;
+++ /dev/null
-/*
-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;
/*
-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`?
---
*/
/*
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`?
---
*/
/*
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()`?
---
*/
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;
+++ /dev/null
-void foo() {}
+++ /dev/null
-private void foo(int) {}
+++ /dev/null
-void foo(string) {}
+++ /dev/null
-module imports.diag12598a;
-
-struct lines { }
--- /dev/null
+enum X = 1;
--- /dev/null
+module imports.imp21353;
+
+struct A { int x; }
+
+struct B { import imports.imp21353 : A; }
+
+private struct P { }
--- /dev/null
+module imports.test15117a;
+
+struct AssertResult {}
+
+auto test_usr_1()
+{
+ // 2. generate TyepInfoStructDeclaration
+ auto x = typeid(AssertResult);
+}
/*
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)`
---
*/
/*
TEST_OUTPUT:
---
-fail_compilation/test143.d(20): Error: undefined identifier `x`
+fail_compilation/test143.d(19): Error: undefined identifier `x`
---
*/
module test143;
--- /dev/null
+// 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!();
+}
/*
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
-// 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;
/*
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;
--- /dev/null
+/* 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);
+}
--- /dev/null
+/*
+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
+}
+
/*
-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`
---
*/