reasonml / reason

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

line comment above open prints incorrectly #2625

Closed TheSpyder closed 1 year ago

TheSpyder commented 4 years ago

Input file:

let myFunction = () => {
  // this will break
  open List;

  let list = ["1", "2"];
  list |> iter(print_endline);
};

Output of refmt Test.re:

let myFunction = () => {
  open // this will break
       List;

  let list = ["1", "2"];
  list |> iter(print_endline);
};

After running refmt a second time on the above output:

let myFunction = () => {
  open List; // this will break

  let list = ["1", "2"];
  list |> iter(print_endline);
};

This doesn't happen on the bsrefmt shipped with ReScript, or reason 3.5.2 from opam. I can reproduce it on reason 3.6.0 from opam, as well as 3.6.0 from esy and 3.6.0 from reason-repacked.

davesnx commented 1 year ago

This is fixed in 3.9.0