reasonml / reason

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

Refmt unable to parse object type inheritance #2572

Closed yawaramin closed 4 years ago

yawaramin commented 4 years ago

E.g.:

$ npx bsb -version
7.1.1
$ npx bsrefmt --version
Reason 3.6.0 @ 8f71db0
$ echo 'type t = < a : int > type u = < t; b : string >' | npx bsrefmt --parse=ml
inheritance in object type are not supported before OCaml 4.06
Error happened when running command /Users/yawar/src/fullstack-reason/node_modules/.pnpm/registry.npmjs.org/bs-platform/7.1.1/node_modules/bs-platform/lib/refmt.exe with args [ '--parse=ml' ]

Same issue with Reason 3.6.0 @ 59339f6 installed in an Esy project using OCaml 4.08.

anmonteiro commented 4 years ago

This is fixed as of the 4.08 AST upgrade:

$ echo 'type t = < a : int > type u = < t; b : string >' | ../_build/default/reason/src/refmt/refmt_impl.exe --parse ml
type t = {. a: int};
type u = {
  .
  ...t,
  b: string,
};