Skip to content

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

Closed

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).

Activity

  1. added this to the Backlog milestone on Apr 15, 2024
  2. edgarfgp commented on Apr 15, 2024

    @edgarfgp
    Contributor

    I think I have fix for this in a local branch somewhere 😅. Will try and raise a PR during the week if it is still available .

  3. abonie commented on Apr 15, 2024

    @abonie
    Member

    Static abstract should be disallowed in abstract classes and only allowed in interfaces. But internal error is a bug for sure.

  4. added
    Impact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.
    Area-Compiler-CheckingType checking, attributes and all aspects of logic checking
    and removed on Apr 15, 2024
  5. changed the title [-]Static abstract method on abstract class yields internal error[/-] [+]Static abstract method on class or abstract class yields internal error[/+] on Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions