Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal]: Show obsolete errors from overrides #8938

Open
333fred opened this issue Dec 26, 2024 · 0 comments
Open

[Proposal]: Show obsolete errors from overrides #8938

333fred opened this issue Dec 26, 2024 · 0 comments
Assignees
Milestone

Comments

@333fred
Copy link
Member

333fred commented Dec 26, 2024

Show obsolete errors from overrides

Summary

Today, when an override of a virtual member adds Obsolete, we do not warn that the method is obsoleted when the derived type is statically known as the receiver. For example:

abstract class Base
{
    public abstract void M();
}

class Derived : Base
{
    [Obsolete]
    public override void M() => throw null;

    public void M2()
    {
        M(); // No warning
    }
}

This is something that we can detect at warn about.

Design meetings

@333fred 333fred added this to the Backlog milestone Dec 26, 2024
@333fred 333fred self-assigned this Dec 26, 2024
@dotnet dotnet locked and limited conversation to collaborators Dec 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant