Skip to content

Object expressions don't work with IWSAMs #16213

Closed

Description

@vzarytovskii
type IOperation =
        static abstract member Execute: unit -> unit

let _ =
    { new IOperation with
        static member Execute() = ()
        //member _.Execute() = ()
    }

Results in internal exception.

Should provide meaningful message instead, or parse error.

Activity

  1. added this to the Backlog milestone on Nov 1, 2023
  2. edgarfgp commented on Nov 1, 2023

    @edgarfgp
    Contributor

    This will be great to fix too :)

  3. vzarytovskii commented on Nov 1, 2023

    @vzarytovskii
    MemberAuthor

    Well, it works with member Foo() = (without _ or static). But to fix it we'll need to change expressions we use (likely), which may affect a bunch of other things.

    The fix should be easy, however, might affect a bunch more things.

  4. vzarytovskii commented on Nov 1, 2023

    @vzarytovskii
    MemberAuthor

    Nvm it's irrelevant issue, since static method implementation doesn't make much sense in object expressions, can't access it from instance.

  5. 0101 commented on Nov 1, 2023

    @0101
    Contributor

    Well it still shouldn't cause an internal exception when someone writes it, rather give a proper diagnostic.

  6. edgarfgp commented on Nov 1, 2023

    @edgarfgp
    Contributor

    Well it still shouldn't cause an internal exception when someone writes it, rather give a proper diagnostic.

    Agreed. We can add a similar diagnostic that https://github.com/dotnet/fsharp/pull/14555/files. Happy to help with this :)

  7. vzarytovskii commented on Nov 1, 2023

    @vzarytovskii
    MemberAuthor

    Well it still shouldn't cause an internal exception when someone writes it, rather give a proper diagnostic.

    Only in debug = we don't care.

  8. vzarytovskii commented on Nov 1, 2023

    @vzarytovskii
    MemberAuthor

    I actually believe in release it'll be a proper diagnostic.

  9. edgarfgp commented on Nov 1, 2023

    @edgarfgp
    Contributor

    Just tried :

    dotnet run -c Release
    Program.fs(19,27): error FS0073: internal error: unexpected member binding ConsoleApp1.fsproj]

  10. vzarytovskii commented on Nov 1, 2023

    @vzarytovskii
    MemberAuthor

    Just tried :

    dotnet run -c Release

    Program.fs(19,27): error FS0073: internal error: un

    expected member binding ConsoleApp1.fsproj]

    Hm, I swear I tested it just before leaving the office and it was telling me something about unexpected leyword or something.

    Alright then, we should just provide something meaningful.

  11. edgarfgp commented on Nov 10, 2023

    @edgarfgp
    Contributor

    Reopening this to provide a meaningful error message ?

  12. edgarfgp commented on Nov 10, 2023

    @edgarfgp
    Contributor

    Will raise a PR to fix this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions