Skip to content

Weird error message for incorrect default arg type #8387

@cknitt

Description

@cknitt
let f = (~test: option<int>=42) => ()

gives

We've found a bug for you!
  /.../fixtures/optional_default_arg_type_mismatch.res:1:29-30

  1 │ let f = (~test: option<int>=42) => ()
  2 │

  This has type: int
  But this switch is expected to return: option<int>

  All branches in a switch must return the same type.
  To fix this, change your branch to return the expected type.

However, there is no switch visible to the user here.

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