Bug 22668 – Deprecation when a deprecated method overrides another deprecated method
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-01-12T13:45:25Z
Last change time
2022-01-14T17:44:28Z
Keywords
pull
Assigned to
No Owner
Creator
moonlightsentinel
Comments
Comment #0 by moonlightsentinel — 2022-01-12T13:45:25Z
DMD issues deprecation warnings when a deprecated method overrides another deprecated method.
Example:
class A
{
deprecated void foo() {}
}
class B
{
deprecated override void foo() {}
// onlineapp.d(8): Deprecation: `onlineapp.B.foo` is overriding the deprecated method `onlineapp.A.foo`
// onlineapp.d(8): Deprecation: `onlineapp.B.foo` cannot be marked as `deprecated` because it is overriding a function in the base class
}
There's no good reason to reject that code given that both methods acknowledge that `foo` is deprecated. This is especially bad when a library wants to deprecate a method that is implemented by several different classes - the deprecation warnings should then appear in the user code but are currently triggered inside of the library.
Comment #1 by dlang-bot — 2022-01-14T15:16:25Z
@MoonlightSentinel created dlang/dmd pull request #13533 "Fix 22668 - Don't errors when a deprecated method overrides another one" fixing this issue:
- Fix 22668 - Don't errors when a deprecated method overrides another one
Because both declarations acknowledge that the declaration is deprecated.
This is especially important for libraries that provide a collection of
classes and want to deprecate certain method throughout the entire
class hierarchy.
https://github.com/dlang/dmd/pull/13533
Comment #2 by dlang-bot — 2022-01-14T17:44:28Z
dlang/dmd pull request #13533 "Fix 22668 - Don't error when a deprecated method overrides another one" was merged into master:
- eb9c1b9c071620f7f19a34401af4bf165de3cad6 by MoonlightSentinel:
Fix 22668 - Don't errors when a deprecated method overrides another one
Because both declarations acknowledge that the declaration is deprecated.
This is especially important for libraries that provide a collection of
classes and want to deprecate certain method throughout the entire
class hierarchy.
https://github.com/dlang/dmd/pull/13533