reason icon indicating copy to clipboard operation
reason copied to clipboard

refmt pushes pipe inside else branch

Open sorawee opened this issue 7 years ago • 2 comments

Consider:

if (true) {
  false
} else {
  true
} |> Js.log;

After refmted, this becomes:

if (true) {
  false
} else {
  true |> Js.log;
}

which is certainly not what I want.

sorawee avatar Jul 26 '18 18:07 sorawee

The example in this issue seems to be parsed differently than:

(if (true) {
  false
} else {
  true
}) |> Js.log;

anmonteiro avatar Jul 26 '18 19:07 anmonteiro

This happens because we accept

$ refmt
if (foo) bar else baz

if (foo) {bar} else {baz};

anmonteiro avatar Jul 07 '24 23:07 anmonteiro