-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[metadata] Skip null vtable entries when checking covariant return overrides #76323
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
Conversation
When there are covariant return overrides, we check the vtable slot in every
parent class for signature compatability with the proposed override.
However if one of the ancestor classes is abstract, it could have an
abstract override for hte method:
class Base {
public virtual Base Method() => this;
}
public abstract Intermediate : Base {
public override abstract Base Method();
}
public Leaf : Intermediate {
public override Leaf Method() => this;
}
In this case when we're checking that Leaf.Method is compatible with
the vtable slot in Intermediate, we will see a null method (since
Intermediate is abstract). In such cases we can skip over the class
and continue with its parent.
Fixes
dotnet#76312
|
I think we should backport this for net7 and net6 |
|
/azp run runtime-extra-platforms |
|
/backport to release/7.0 |
|
Started backporting to release/7.0: https://github.com/dotnet/runtime/actions/runs/3146190259 |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/backport to release/6.0 |
|
Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/3146255970 |
|
I think it's an infra problem, not my PR... |
When there are covariant return overrides, we check the vtable slot in every parent class for signature compatibility with the proposed override.
However if one of the ancestor classes is abstract, it could have an abstract override for the method:
In this case when we're checking that
Leaf.Methodis compatible with the vtable slot inIntermediate, we will see a null method (sinceIntermediate.Methodis abstract). In such cases we can skip over the class and continue with its parent.Fixes
#76312