Skip to content

Invoking a static abstract member on the interface type itself is not rejected #19231

@zvmsbackend

Description

@zvmsbackend

It now passes type checking to invoke a static abstract member on the interface type itself, which leads to a System.BadImageFormatException at runtime as the method body is empty.

Repro steps

type IName =
    static abstract Name : string

IName.Name

Expected behavior

Compiler should emit an error for such nonsensical use of static abstract members.

Actual behavior

An exception System.BadImageFormatException: Bad IL format. is raised.

Known workarounds

Do not write such code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingArea-Compiler-CodeGenIlxGen, ilwrite and things at the backendBug

    Type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions