Skip to content

Improve error reporting: No abstract method matching implementation #1232

@isaacabraham

Description

@isaacabraham

What

The following code leads to the resulting error message: -

type IInterface =
    abstract MyFunction : int * int -> unit
    abstract SomeOtherFunction : int * int -> unit

let x = { new IInterface with member this.MtFunction (i,j) = () }

error FS0767: The member 'MtFunction' does not correspond to any abstract or virtual method available to override or implement

Why

The error message is correct and clearly explains why the error has occurred. However, it does not provide any further guidance as to how best to fix the warning e.g. - if there is a typo as the above example.

How

The error message should also contain any likely abstract methods that are likely matches for what the user supplied e.g.

error FS0767: The member 'MtFunction' does not correspond to any abstract or virtual method available to override or implement. Did you mean one of the following?

   MyFunction
   SomeOtherFunction

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions