Skip to content

Confusing error message with mismatched optional labeled argument #6944

Open
@glennsl

Description

@glennsl
let f: (~foo: int=?) => unit = (~foo) => ()

This yields the error:

This function should have type (~foo: int=?) => unit
  but its first argument is labelled ~foo

Seeing as the argument is labeled ~foo in both signature and implementation, the error message is a bit misleading. It should say that it should be optional.

Additionally, the error for the converse is this:

This function should have type (~foo: int) => unit
  but its first argument is labelled ?foo

which reveals OCaml syntax.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions