mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
Improve @__future
deprecation message (#16447)
Show location of base method. Remove duplicate content in compilable/future.d.
This commit is contained in:
parent
5eb71e950e
commit
b5ddf51ea8
3 changed files with 6 additions and 49 deletions
|
@ -742,7 +742,10 @@ void funcDeclarationSemantic(Scope* sc, FuncDeclaration funcdecl)
|
|||
{
|
||||
if (fdv.isFuture())
|
||||
{
|
||||
deprecation(funcdecl.loc, "`@__future` base class method `%s` is being overridden by `%s`; rename the latter", fdv.toPrettyChars(), funcdecl.toPrettyChars());
|
||||
deprecation(funcdecl.loc, "method `%s` implicitly overrides `@__future` base class method; rename the former",
|
||||
funcdecl.toPrettyChars());
|
||||
deprecationSupplemental(fdv.loc, "base method `%s` defined here",
|
||||
fdv.toPrettyChars());
|
||||
// Treat 'this' as an introducing function, giving it a separate hierarchy in the vtbl[]
|
||||
goto Lintro;
|
||||
}
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
/* PERMUTE_ARGS:
|
||||
* TEST_OUTPUT:
|
||||
---
|
||||
compilable/future.d(15): Deprecation: `@__future` base class method `future.A.msg` is being overridden by `future.B.msg`; rename the latter
|
||||
---
|
||||
*/
|
||||
|
||||
class A
|
||||
{
|
||||
@__future char msg() { return 'a'; }
|
||||
}
|
||||
|
||||
class B : A
|
||||
{
|
||||
char msg() { return 'b'; }
|
||||
}
|
||||
|
||||
class C : B
|
||||
{
|
||||
override char msg() { return 'c'; }
|
||||
}
|
||||
|
||||
class D : A
|
||||
{
|
||||
override char msg() { return 'd'; }
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
auto a = new A();
|
||||
assert(a.msg() == 'a');
|
||||
auto b = new B();
|
||||
assert(b.msg() == 'b');
|
||||
auto c = new C();
|
||||
assert(c.msg() == 'c');
|
||||
auto d = new D();
|
||||
assert(d.msg() == 'd');
|
||||
|
||||
assert(b.A.msg() == 'a');
|
||||
|
||||
auto ba = cast(A)b;
|
||||
assert(ba.msg() == 'a');
|
||||
|
||||
auto da = cast(A)d;
|
||||
assert(da.msg() == 'd');
|
||||
return 0;
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
/* PERMUTE_ARGS:
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
runnable/future.d(15): Deprecation: `@__future` base class method `future.A.msg` is being overridden by `future.B.msg`; rename the latter
|
||||
runnable/future.d(16): Deprecation: method `future.B.msg` implicitly overrides `@__future` base class method; rename the former
|
||||
runnable/future.d(11): base method `future.A.msg` defined here
|
||||
---
|
||||
*/
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue