Skip to content

Static abstract method on class or abstract class yields internal error #17044

@brianrourkeboll

Description

@brianrourkeboll

Declaring a static abstract method on an abstract class fails with an internal error that does not surface in the tooling (VS or Ionide).

Repro steps

  1. Define a static abstract member in an abstract class.
  2. The tooling shows no errors, but attempting to build yields an internal error.
#nowarn "3535"

[<AbstractClass>]
type A () =
    static abstract M : unit -> unit

type B () =
    inherit A ()
    static member M () = printfn "99"

B.M ()
error FS0193: internal error: Unable to load one or more of the requested types.
Virtual Static Method.
Virtual Static Method.

A similar error happens for regular classes:

#nowarn "3535"

type A () =
    static abstract M : unit -> unit
error FS0193: internal error: Unable to load one or more of the requested types.
Abstract method in non-abstract class.

Expected behavior

I would expect an error message that explicitly disallowed static abstract methods in classes and abstract classes. I would also expect this message to show in the IDE.

Actual behavior

An internal error is raised in the compiler, and no error message is shown in the IDE.

Known workarounds

N/A.

Related information

This happens on current main (and probably earlier versions).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions