Skip to content

Improve Error Reporting: Internal error with badly defined anonymous record #6872

@isaacabraham

Description

@isaacabraham

This caught me out today - the error message is not only misleading but shows as an "internal error" in the compiler.

Repro steps
Enter the following code in a script or code file:

type ContactMethod =
    | Telephone of telephoneNumber:string
    | Address of {| Line1 : string; Line 2 : string; Postcode : string |}

Expected behavior
Did you notice the error? There's a space between Line and 2. I would expect the same error as for a "full" record:

error FS0010: Unexpected integer literal in field declaration. Expected ':' or other token

And the red squiggly is directly underneath the 2.

Actual behavior
You get the error internal error: empty tuple type with a red squiggly underneath the entire anonymous record definition. This had me stumped for probably 2 or 3 minutes.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions