reasonml / reason

Simple, fast & type safe code that leverages the JavaScript & OCaml ecosystems
http://reasonml.github.io
MIT License
10.08k stars 425 forks source link

Merlin infers wrong types for labelled optional arguments in 5.2 #2737

Open jchavarri opened 1 month ago

jchavarri commented 1 month ago

@anmonteiro and myself have been debugging some issues that surfaced in reason-react test suite when upgrading to 5.2: https://github.com/reasonml/reason-react/pull/833.

It seems that when using 3.11.0 with OCaml 5.2, the type signature inferred from a function like:

let t = (~foo=0, ()) => foo;

The inferred type signature in merlin / lsp will be:

(~foo: int, unit) => int

when it should be:

(~foo: int=?, unit) => int

Some of the things we've gathered: