Skip to content

Regression in optional args typecheck #8385

@cknitt

Description

@cknitt

In ReScript 13.0.0-alpha.3, this does not compile correctly anymore:

module type Test = {
  @react.component
  let make: (~test: int=?) => React.element
}

module A: Test = {
  @react.component
  let make = (~test: option<int>=42) => {
    React.null
  }
}

It gives the error message:

This has type: int
  But it's expected to have type: option<int>

In earlier ReScript versions, it compiled fine.

(The real-world code where I extracted this simplified example from had a .res and a .resi, but for easier testing in the playground I used module type / module to be able to test with a single file.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions