Skip to content

Commit

Permalink
Merge pull request #3580 from WalterBright/err-msgs
Browse files Browse the repository at this point in the history
minor error message improvements
  • Loading branch information
MartinNowak committed May 25, 2014
2 parents 7595051 + 414a1e8 commit a38d877
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/func.c
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,8 @@ void FuncDeclaration::semantic(Scope *sc)

doesoverride = true;
if (!isOverride())
::deprecation(loc, "overriding base class function without using override attribute is deprecated (%s overrides %s)", toPrettyChars(), fdv->toPrettyChars());
::deprecation(loc, "implicitly overriding base class method %s with %s deprecated; add 'override' attribute",
fdv->toPrettyChars(), toPrettyChars());

if (fdc->toParent() == parent)
{
Expand Down
2 changes: 1 addition & 1 deletion src/mtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -3102,7 +3102,7 @@ Expression *TypeBasic::getProperty(Loc loc, Identifier *ident, int flag)
case Tcomplex80:
case Timaginary80:
case Tfloat80:
deprecation(loc, "min property is deprecated, use min_normal instead");
deprecation(loc, ".min property is deprecated, use .min_normal instead");
goto Lmin_normal;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -3151,7 +3151,7 @@ Statement *SwitchStatement::semantic(Scope *sc)
{ hasNoDefault = 1;

if (!isFinal && !body->isErrorStatement())
deprecation("non-final switch statement without a default is deprecated; add 'default: assert(0);' or 'default: break;'");
deprecation("switch statement without a default is deprecated; use 'final switch' or add 'default: assert(0);' or add 'default: break;'");

// Generate runtime error if the default is hit
Statements *a = new Statements();
Expand Down
9 changes: 8 additions & 1 deletion src/toobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,14 @@ void ClassDeclaration::toObjFile(bool multiobj)
{
TypeFunction *tf = (TypeFunction *)fd->type;
if (tf->ty == Tfunction)
deprecation("use of %s%s hidden by %s is deprecated. Use 'alias %s.%s %s;' to introduce base class overload set.", fd->toPrettyChars(), Parameter::argsTypesToChars(tf->parameters, tf->varargs), toChars(), fd->parent->toChars(), fd->toChars(), fd->toChars());
deprecation("use of %s%s hidden by %s is deprecated; use 'alias %s = %s.%s;' to introduce base class overload set",
fd->toPrettyChars(),
Parameter::argsTypesToChars(tf->parameters, tf->varargs),
toChars(),

fd->toChars(),
fd->parent->toChars(),
fd->toChars());
else
deprecation("use of %s hidden by %s is deprecated", fd->toPrettyChars(), toChars());
s = rtlsym[RTLSYM_DHIDDENFUNC];
Expand Down
2 changes: 1 addition & 1 deletion test/compilable/diag10768.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
TEST_OUTPUT:
---
compilable/diag10768.d(36): Deprecation: overriding base class function without using override attribute is deprecated (diag10768.Foo.frop overrides diag10768.Frop.frop)
compilable/diag10768.d(36): Deprecation: implicitly overriding base class method diag10768.Frop.frop with diag10768.Foo.frop deprecated; add 'override' attribute
---
*/

Expand Down
2 changes: 1 addition & 1 deletion test/fail_compilation/diag6373.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
REQUIRED_ARGS: -de
TEST_OUTPUT:
---
fail_compilation/diag6373.d(7): Deprecation: class diag6373.Bar use of diag6373.Foo.method(double x) hidden by Bar is deprecated. Use 'alias Foo.method method;' to introduce base class overload set.
fail_compilation/diag6373.d(7): Deprecation: class diag6373.Bar use of diag6373.Foo.method(double x) hidden by Bar is deprecated; use 'alias method = Foo.method;' to introduce base class overload set
---
*/

Expand Down
2 changes: 1 addition & 1 deletion test/fail_compilation/fail287.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
TEST_OUTPUT:
---
fail_compilation/fail287.d(14): Error: had 299 cases which is more than 256 cases in case range
fail_compilation/fail287.d(12): Deprecation: non-final switch statement without a default is deprecated; add 'default: assert(0);' or 'default: break;'
fail_compilation/fail287.d(12): Deprecation: switch statement without a default is deprecated; use 'final switch' or add 'default: assert(0);' or add 'default: break;'
---
*/

Expand Down
2 changes: 1 addition & 1 deletion test/fail_compilation/fail329.d
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail329.d(39): Deprecation: overriding base class function without using override attribute is deprecated (fail329.B.foo overrides fail329.A.foo)
fail_compilation/fail329.d(39): Deprecation: implicitly overriding base class method fail329.A.foo with fail329.B.foo deprecated; add 'override' attribute
fail_compilation/fail329.d(29): Error: variable fail329.A.foo.__ensure.result cannot modify result 'result' in contract
---
*/
Expand Down
2 changes: 1 addition & 1 deletion test/fail_compilation/fail52.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
TEST_OUTPUT:
---
fail_compilation/fail52.d(11): Error: class fail52.C circular inheritance
fail_compilation/fail52.d(10): Deprecation: overriding base class function without using override attribute is deprecated (fail52.B.g overrides fail52.C.g)
fail_compilation/fail52.d(10): Deprecation: implicitly overriding base class method fail52.C.g with fail52.B.g deprecated; add 'override' attribute
---
*/

Expand Down

0 comments on commit a38d877

Please sign in to comment.