blob: c9da34dbfa73d549bc768cb559ad43c6ba441b07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
// https://issues.dlang.org/show_bug.cgi?id=22668
// Overrides with same deprecated'ness are allowed
class SameParent
{
deprecated void foo() {}
void foo(int) {}
void bar(int) {}
deprecated void bar() {}
}
class SameChild : SameParent
{
deprecated override void foo() {}
override void foo(int) {}
override void bar(int) {}
deprecated override void bar() {}
}
/**
Only the parent declaration is deprecated
TEST_OUTPUT:
----
compilable/deprecated_override.d(44): Deprecation: `deprecated_override.IntroducingChild.foo` is overriding the deprecated method `deprecated_override.IntroducingParent.foo`
compilable/deprecated_override.d(48): Deprecation: `deprecated_override.IntroducingChild.bar` is overriding the deprecated method `deprecated_override.IntroducingParent.bar`
----
**/
class IntroducingParent
{
deprecated void foo() {}
void foo(int) {}
void bar(int) {}
deprecated void bar() {}
}
class IntroducingChild : IntroducingParent
{
override void foo() {}
override void foo(int) {}
override void bar(int) {}
override void bar() {}
}
// Unrelated to this path but should this error as well?
class IntroducingGrandchild : IntroducingChild
{
override void foo() {}
override void foo(int) {}
override void bar(int) {}
override void bar() {}
}
/**
Only the overriding declaration is deprecated
TEST_OUTPUT:
----
compilable/deprecated_override.d(83): Deprecation: `deprecated_override.OverrideChild.foo` cannot be marked as `deprecated` because it is overriding a function in the base class
compilable/deprecated_override.d(87): Deprecation: `deprecated_override.OverrideChild.bar` cannot be marked as `deprecated` because it is overriding a function in the base class
----
**/
class OverrideParent
{
void foo() {}
void foo(int) {}
void bar(int) {}
void bar() {}
}
class OverrideChild : OverrideParent
{
deprecated override void foo() {}
override void foo(int) {}
override void bar(int) {}
deprecated override void bar() {}
}
class OverrideGrandChild : OverrideChild
{
deprecated override void foo() {}
override void foo(int) {}
override void bar(int) {}
deprecated override void bar() {}
}
|