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

rescript@11.0.0-alpha.2 Formatter removes brackets that breaks compiler #6141

Closed
DZakh opened this issue Apr 13, 2023 · 7 comments
Closed

rescript@11.0.0-alpha.2 Formatter removes brackets that breaks compiler #6141

DZakh opened this issue Apr 13, 2023 · 7 comments
Milestone

Comments

@DZakh
Copy link
Member

DZakh commented Apr 13, 2023

I'm trying to update rescript-struct, and it compiled with rescript@11.0.0-alpha.2 without a problem, but after running rescript format -all, it removed some brackets from the code, which broke the compiler. Here is the commit with removed brackets DZakh/rescript-schema@0bad028

@cristianoc
Copy link
Collaborator

Thanks for the report. Can you add a self-contained example?

@cristianoc cristianoc added this to the v11.0 milestone Apr 13, 2023
@DZakh
Copy link
Member Author

DZakh commented Apr 13, 2023

Looks like the issue only with functions using (.)

Or with "uncurried": true in bsconig.

@cristianoc
Copy link
Collaborator

cristianoc commented Apr 13, 2023

let foo = (. ()) => ()
let fn = (_x): ((. unit) => unit) => foo
let fooC = () => ()
let fnC = (_x): ((unit) => unit) => fooC

parens in ret type annotation of fn, but not fnC, are not printed in pretty printing

@cristianoc
Copy link
Collaborator

let a = ((. ()) => "foo")->Ok
let aC = (() => "foo")->Ok

The parens are not printed in a but are printed in aC.

@DZakh
Copy link
Member Author

DZakh commented Apr 13, 2023

Yes, but:

let fn = (): ((. unit) => unit) => (. ()) => ()
// Formatted to
let fn = (): (. unit) => unit => (. ()) => ()
let fn = (): (unit => unit) => ignore
// Everything works fine

Add "uncurried": true

let fn = (): (unit => unit) => ignore
// Formatted to
let fn = (): unit => unit => ignore

image

cristianoc added a commit that referenced this issue Apr 13, 2023
@cristianoc
Copy link
Collaborator

@DZakh check this: #6143
Anything missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants