Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reason 3.6.2: refmt can break parentheses in some cases #2636

Closed
bryphe opened this issue Nov 9, 2020 · 2 comments
Closed

Reason 3.6.2: refmt can break parentheses in some cases #2636

bryphe opened this issue Nov 9, 2020 · 2 comments
Labels
Printer things that have to do with turning an AST into Reason code

Comments

@bryphe
Copy link
Contributor

bryphe commented Nov 9, 2020

Just saw there was a new release of @opam/reason at version 3.6.2 - figured I'd give it a test run!

It looks like there is a regression with refmt - in some cases, the parentheses can be removed too aggressively from an expression, for example:

fun
| [] => None
| [(child: node), ...rest] => ...

Gets refmt'd to:

fun
| [] => None
| [child: None, ...rest] => ...

Which then becomes a compilation error:

File "src/Components/Tabs.re", line 24, characters 18-19:
24 |           | [child: node, ..._] when i == index =>
                       ^
Error: Unclosed "(" (opened line 20, column 38)

Hit this in trying to upgrade Onivim here: onivim/oni2#2688

@jchavarri
Copy link
Contributor

jchavarri commented Apr 13, 2021

I ran into a very similar issue, not sure if the same but tracking here in case it helps.

In v3.7.0 from opam.

let foo =
  fun
  | (hey: baz) => ();

gets compiled into:

let foo =
  fun
  | hey: baz => ();

@davesnx davesnx added the Printer things that have to do with turning an AST into Reason code label Nov 16, 2022
@davesnx
Copy link
Member

davesnx commented Apr 6, 2023

This is fixed in the master branch, we will release it under 3.9.0

@davesnx davesnx closed this as completed Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Printer things that have to do with turning an AST into Reason code
Projects
None yet
Development

No branches or pull requests

3 participants