www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22668] New: Deprecation when a deprecated method overrides

https://issues.dlang.org/show_bug.cgi?id=22668

          Issue ID: 22668
           Summary: Deprecation when a deprecated method overrides another
                    deprecated method
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: moonlightsentinel disroot.org

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.

--
Jan 12 2022