mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
riden should be ridden (#15309)
This commit is contained in:
parent
299f25a71c
commit
a0d3c94edf
10 changed files with 18 additions and 18 deletions
|
@ -80,7 +80,7 @@ extern (C++) /* CT */ BE canThrow(Expression e, FuncDeclaration func, bool mustN
|
||||||
if (!f.isDtorDeclaration())
|
if (!f.isDtorDeclaration())
|
||||||
errorSupplementalInferredAttr(f, 10, false, STC.nothrow_);
|
errorSupplementalInferredAttr(f, 10, false, STC.nothrow_);
|
||||||
|
|
||||||
e.checkOverridenDtor(null, f, dd => dd.type.toTypeFunction().isnothrow, "not nothrow");
|
e.checkOverriddenDtor(null, f, dd => dd.type.toTypeFunction().isnothrow, "not nothrow");
|
||||||
}
|
}
|
||||||
else if (func)
|
else if (func)
|
||||||
{
|
{
|
||||||
|
|
|
@ -429,7 +429,7 @@ dmd -cov -unittest myprog.d
|
||||||
q"{$(P Enables "include imports" mode, where the compiler will include imported
|
q"{$(P Enables "include imports" mode, where the compiler will include imported
|
||||||
modules in the compilation, as if they were given on the command line. By default, when
|
modules in the compilation, as if they were given on the command line. By default, when
|
||||||
this option is enabled, all imported modules are included except those in
|
this option is enabled, all imported modules are included except those in
|
||||||
druntime/phobos. This behavior can be overriden by providing patterns via `-i=<pattern>`.
|
druntime/phobos. This behavior can be overridden by providing patterns via `-i=<pattern>`.
|
||||||
A pattern of the form `-i=<package>` is an "inclusive pattern", whereas a pattern
|
A pattern of the form `-i=<package>` is an "inclusive pattern", whereas a pattern
|
||||||
of the form `-i=-<package>` is an "exclusive pattern". Inclusive patterns will include
|
of the form `-i=-<package>` is an "exclusive pattern". Inclusive patterns will include
|
||||||
all module's whose names match the pattern, whereas exclusive patterns will exclude them.
|
all module's whose names match the pattern, whereas exclusive patterns will exclude them.
|
||||||
|
@ -439,14 +439,14 @@ dmd -cov -unittest myprog.d
|
||||||
|
|
||||||
$(P The default behavior of excluding druntime/phobos is accomplished by internally adding a
|
$(P The default behavior of excluding druntime/phobos is accomplished by internally adding a
|
||||||
set of standard exclusions, namely, `-i=-std -i=-core -i=-etc -i=-object`. Note that these
|
set of standard exclusions, namely, `-i=-std -i=-core -i=-etc -i=-object`. Note that these
|
||||||
can be overriden with `-i=std -i=core -i=etc -i=object`.)
|
can be overridden with `-i=std -i=core -i=etc -i=object`.)
|
||||||
|
|
||||||
$(P When a module matches multiple patterns, matches are prioritized by their component length, where
|
$(P When a module matches multiple patterns, matches are prioritized by their component length, where
|
||||||
a match with more components takes priority (i.e. pattern `foo.bar.baz` has priority over `foo.bar`).)
|
a match with more components takes priority (i.e. pattern `foo.bar.baz` has priority over `foo.bar`).)
|
||||||
|
|
||||||
$(P By default modules that don't match any pattern will be included. However, if at
|
$(P By default modules that don't match any pattern will be included. However, if at
|
||||||
least one inclusive pattern is given, then modules not matching any pattern will
|
least one inclusive pattern is given, then modules not matching any pattern will
|
||||||
be excluded. This behavior can be overriden by usig `-i=.` to include by default or `-i=-.` to
|
be excluded. This behavior can be overridden by usig `-i=.` to include by default or `-i=-.` to
|
||||||
exclude by default.)
|
exclude by default.)
|
||||||
|
|
||||||
$(P Note that multiple `-i=...` options are allowed, each one adds a pattern.)}"
|
$(P Note that multiple `-i=...` options are allowed, each one adds a pattern.)}"
|
||||||
|
|
|
@ -275,7 +275,7 @@ private struct MatcherNode
|
||||||
* -i=-foo // include everything except modules that match "foo*"
|
* -i=-foo // include everything except modules that match "foo*"
|
||||||
* -i=foo // only include modules that match "foo*" (exclude everything else)
|
* -i=foo // only include modules that match "foo*" (exclude everything else)
|
||||||
* ---
|
* ---
|
||||||
* Note that this default behavior can be overriden using the '.' module pattern. i.e.
|
* Note that this default behavior can be overridden using the '.' module pattern. i.e.
|
||||||
* ---
|
* ---
|
||||||
* -i=-foo,-. // this excludes everything
|
* -i=-foo,-. // this excludes everything
|
||||||
* -i=foo,. // this includes everything except the default exclusions (-std,-core,-etc.-object)
|
* -i=foo,. // this includes everything except the default exclusions (-std,-core,-etc.-object)
|
||||||
|
|
|
@ -3963,13 +3963,13 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
|
||||||
hgs.fullQual = true;
|
hgs.fullQual = true;
|
||||||
|
|
||||||
// https://issues.dlang.org/show_bug.cgi?id=23745
|
// https://issues.dlang.org/show_bug.cgi?id=23745
|
||||||
// If the potentially overriden function contains errors,
|
// If the potentially overridden function contains errors,
|
||||||
// inform the user to fix that one first
|
// inform the user to fix that one first
|
||||||
if (fd.errors)
|
if (fd.errors)
|
||||||
{
|
{
|
||||||
error(funcdecl.loc, "function `%s` does not override any function, did you mean to override `%s`?",
|
error(funcdecl.loc, "function `%s` does not override any function, did you mean to override `%s`?",
|
||||||
funcdecl.toChars(), fd.toPrettyChars());
|
funcdecl.toChars(), fd.toPrettyChars());
|
||||||
errorSupplemental(fd.loc, "Function `%s` contains errors in its declaration, therefore it cannot be correctly overriden",
|
errorSupplemental(fd.loc, "Function `%s` contains errors in its declaration, therefore it cannot be correctly overridden",
|
||||||
fd.toPrettyChars());
|
fd.toPrettyChars());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3985,7 +3985,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
|
||||||
{
|
{
|
||||||
error(funcdecl.loc, "function `%s` does not override any function, did you mean to override %s `%s`?",
|
error(funcdecl.loc, "function `%s` does not override any function, did you mean to override %s `%s`?",
|
||||||
funcdeclToChars, s.kind, s.toPrettyChars());
|
funcdeclToChars, s.kind, s.toPrettyChars());
|
||||||
errorSupplemental(funcdecl.loc, "Functions are the only declarations that may be overriden");
|
errorSupplemental(funcdecl.loc, "Functions are the only declarations that may be overridden");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -2450,7 +2450,7 @@ public:
|
||||||
{
|
{
|
||||||
debug (Debug_DtoH) mixin(traceVisit!e);
|
debug (Debug_DtoH) mixin(traceVisit!e);
|
||||||
|
|
||||||
// Valid in most cases, others should be overriden below
|
// Valid in most cases, others should be overridden below
|
||||||
// to use the appropriate operators (:: and ->)
|
// to use the appropriate operators (:: and ->)
|
||||||
buf.writestring(e.toString());
|
buf.writestring(e.toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1242,7 +1242,7 @@ extern (C++) abstract class Expression : ASTNode
|
||||||
if (!f.isDtorDeclaration())
|
if (!f.isDtorDeclaration())
|
||||||
errorSupplementalInferredAttr(f, /*max depth*/ 10, /*deprecation*/ false, STC.pure_);
|
errorSupplementalInferredAttr(f, /*max depth*/ 10, /*deprecation*/ false, STC.pure_);
|
||||||
|
|
||||||
checkOverridenDtor(sc, f, dd => dd.type.toTypeFunction().purity != PURE.impure, "impure");
|
checkOverriddenDtor(sc, f, dd => dd.type.toTypeFunction().purity != PURE.impure, "impure");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -1261,7 +1261,7 @@ extern (C++) abstract class Expression : ASTNode
|
||||||
* check = current check (e.g. whether it's pure)
|
* check = current check (e.g. whether it's pure)
|
||||||
* checkName = the kind of check (e.g. `"pure"`)
|
* checkName = the kind of check (e.g. `"pure"`)
|
||||||
*/
|
*/
|
||||||
extern (D) final void checkOverridenDtor(Scope* sc, FuncDeclaration f,
|
extern (D) final void checkOverriddenDtor(Scope* sc, FuncDeclaration f,
|
||||||
scope bool function(DtorDeclaration) check, const string checkName
|
scope bool function(DtorDeclaration) check, const string checkName
|
||||||
) {
|
) {
|
||||||
auto dd = f.isDtorDeclaration();
|
auto dd = f.isDtorDeclaration();
|
||||||
|
@ -1314,7 +1314,7 @@ extern (C++) abstract class Expression : ASTNode
|
||||||
field.loc.errorSupplemental(" - %s %s", field.type.toChars(), field.toChars());
|
field.loc.errorSupplemental(" - %s %s", field.type.toChars(), field.toChars());
|
||||||
|
|
||||||
if (fieldSd.dtor.isGenerated())
|
if (fieldSd.dtor.isGenerated())
|
||||||
checkOverridenDtor(sc, fieldSd.dtor, check, checkName);
|
checkOverriddenDtor(sc, fieldSd.dtor, check, checkName);
|
||||||
else
|
else
|
||||||
fieldSd.dtor.loc.errorSupplemental(" %.*s `%s.~this` is declared here",
|
fieldSd.dtor.loc.errorSupplemental(" %.*s `%s.~this` is declared here",
|
||||||
cast(int) checkName.length, checkName.ptr, fieldSd.toChars());
|
cast(int) checkName.length, checkName.ptr, fieldSd.toChars());
|
||||||
|
@ -1505,7 +1505,7 @@ extern (C++) abstract class Expression : ASTNode
|
||||||
errorSupplementalInferredAttr(f, /*max depth*/ 10, /*deprecation*/ false, STC.safe);
|
errorSupplementalInferredAttr(f, /*max depth*/ 10, /*deprecation*/ false, STC.safe);
|
||||||
.errorSupplemental(f.loc, "`%s` is declared here", prettyChars);
|
.errorSupplemental(f.loc, "`%s` is declared here", prettyChars);
|
||||||
|
|
||||||
checkOverridenDtor(sc, f, dd => dd.type.toTypeFunction().trust > TRUST.system, "@system");
|
checkOverriddenDtor(sc, f, dd => dd.type.toTypeFunction().trust > TRUST.system, "@system");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1569,7 +1569,7 @@ extern (C++) abstract class Expression : ASTNode
|
||||||
f.errorSupplementalInferredAttr(/*max depth*/ 10, /*deprecation*/ false, STC.nogc);
|
f.errorSupplementalInferredAttr(/*max depth*/ 10, /*deprecation*/ false, STC.nogc);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkOverridenDtor(sc, f, dd => dd.type.toTypeFunction().isnogc, "non-@nogc");
|
checkOverriddenDtor(sc, f, dd => dd.type.toTypeFunction().isnogc, "non-@nogc");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1605,7 +1605,7 @@ private struct FuncDeclSem3
|
||||||
sc = s;
|
sc = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Checks that the overriden functions (if any) have in contracts if
|
/* Checks that the overridden functions (if any) have in contracts if
|
||||||
* funcdecl has an in contract.
|
* funcdecl has an in contract.
|
||||||
*/
|
*/
|
||||||
void checkInContractOverrides()
|
void checkInContractOverrides()
|
||||||
|
|
|
@ -30,7 +30,7 @@ struct HasDtor
|
||||||
~this() {}
|
~this() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The user-defined dtor is overriden by a generated dtor calling both
|
// The user-defined dtor is overridden by a generated dtor calling both
|
||||||
// - HasDtor.~this
|
// - HasDtor.~this
|
||||||
// - Strict.~this
|
// - Strict.~this
|
||||||
struct Strict
|
struct Strict
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
TEST_OUTPUT:
|
TEST_OUTPUT:
|
||||||
---
|
---
|
||||||
fail_compilation/fail19209.d(16): Error: function `fail19209.Spammer.method()` does not override any function, did you mean to override variable `fail19209.Spam.method`?
|
fail_compilation/fail19209.d(16): Error: function `fail19209.Spammer.method()` does not override any function, did you mean to override variable `fail19209.Spam.method`?
|
||||||
fail_compilation/fail19209.d(16): Functions are the only declarations that may be overriden
|
fail_compilation/fail19209.d(16): Functions are the only declarations that may be overridden
|
||||||
---
|
---
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ TEST_OUTPUT:
|
||||||
---
|
---
|
||||||
fail_compilation/fail23745.d(21): Error: undefined identifier `UndefinedType`
|
fail_compilation/fail23745.d(21): Error: undefined identifier `UndefinedType`
|
||||||
fail_compilation/fail23745.d(14): Error: function `fun` does not override any function, did you mean to override `fail23745.A.fun`?
|
fail_compilation/fail23745.d(14): Error: function `fun` does not override any function, did you mean to override `fail23745.A.fun`?
|
||||||
fail_compilation/fail23745.d(21): Function `fail23745.A.fun` contains errors in its declaration, therefore it cannot be correctly overriden
|
fail_compilation/fail23745.d(21): Function `fail23745.A.fun` contains errors in its declaration, therefore it cannot be correctly overridden
|
||||||
---
|
---
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue