Skip to content

Static DIM reabstractions don't need to be final? #83189

Open
@MichalStrehovsky

Description

@MichalStrehovsky

@BrzVlad pointed me to this passing test:

.method private hidebysig virtual abstract
static int32 Func(int32 a) cil managed
{
.override method int32 I1::Func(int32)
} // end of I4Reabstract::Func

Notice that this is an .override marked static abstract virtual. Notably there's no final. This means we create a new slot that someone could individually override (on top of the method we're overriding). Is this intentional?

If this was a non-static default interface methods we enforce that these are always marked final. If they aren't, the runtime will throw TypeLoadException "Method implementation on an interface 'X' from assembly 'Y' must be a final method.".

FWIW, attempting to actually override this method currently throws a MissingMethodException (for a method that exists, whatever that means), and Roslyn does emit these as final, so it should be safe to enforce it here too, unless it's intentional.

Cc @davidwrighton @trylek

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions