rescript-compiler icon indicating copy to clipboard operation
rescript-compiler copied to clipboard

Weird reformatting when placing line comment before spread syntax

Open ryyppy opened this issue 2 years ago • 0 comments

Example before reformatting (Playground link):

type t = {
  foo: string,
  bar: string,
}

let a: t = {
  foo: "test",
  bar: "test",
}

let b = {
  // PROBLEM: This comment moves after the "..." when reformatted.
  ...a,
  bar: "foo"
}

After reformatting:

type t = {
  foo: string,
  bar: string,
}

let a: t = {
  foo: "test",
  bar: "test",
}

let b = {
  ...// PROBLEM: This comment moves after the "..." when reformatted.
  a,
  bar: "foo",
}

To my surprise, this code still compiles. Nonetheless I think the comment should stay in the same place when formatting.

ryyppy avatar Dec 04 '23 12:12 ryyppy