csharplang
csharplang copied to clipboard
[Proposal]: Show obsolete errors from overrides
Show obsolete errors from overrides
- Specification: None yet.
- Discussion: https://github.com/dotnet/csharplang/discussions/8937
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.