Skip to content

Fix printing of uncurried application when the lhs is a function defi… #6084

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

Merged
merged 1 commit into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ These are only breaking changes for unformatted code.
- Fix issue with integer overflow check https://github.com/rescript-lang/rescript-compiler/pull/6028
- Make internal encoding of locations aware of unicode https://github.com/rescript-lang/rescript-compiler/pull/6073
- Fix issue where `foo(x,_)` in uncurried mode would generate a curried function https://github.com/rescript-lang/rescript-compiler/pull/6082
- Fix printing of uncurried application when the lhs is a function definition https://github.com/rescript-lang/rescript-compiler/pull/6084

#### :nail_care: Polish

Expand Down
1 change: 1 addition & 0 deletions res_syntax/src/res_parens.ml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ let callExpr expr =
| Pexp_try _ | Pexp_while _ | Pexp_for _ | Pexp_ifthenelse _ );
} ->
Parenthesized
| _ when Ast_uncurried.exprIsUncurriedFun expr -> Parenthesized
| _ when ParsetreeViewer.hasAwaitAttribute expr.pexp_attributes ->
Parenthesized
| _ -> Nothing)
Expand Down
6 changes: 6 additions & 0 deletions res_syntax/tests/printer/expr/UncurriedByDefault.res
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ let t4 = (. type a b) => (l: list<a>, x: a) => list{x, ...l}
let t5 = (type a b) => (. l: list<a>, x: a) => list{x, ...l}
let t6 = (. type a b) => (. l: list<a>, x: a) => list{x, ...l}

let () = (x => ignore(x))(3)
let () = ((. x) => ignore(x))(. 3)

@@uncurried.swap

let cApp = foo(. 3)
Expand Down Expand Up @@ -115,3 +118,6 @@ let t0 = (type a b, l: list<a>, x: a) => list{x, ...l}
let t1 = (. type a b, l: list<a>, x: a) => list{x, ...l}
let t2 = (type a b, . l: list<a>, x: a) => list{x, ...l}
let t3 = (. type a b, . l: list<a>, x: a) => list{x, ...l}

let () = (x => ignore(x))(3)
let () = ((. x) => ignore(x))(. 3)
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ let t4 = (type a b, l: list<a>, x: a) => list{x, ...l}
let t5 = (. type a b, l: list<a>, x: a) => list{x, ...l}
let t6 = (. type a b, l: list<a>, x: a) => list{x, ...l}

let () = (x => ignore(x))(3)
let () = ((. x) => ignore(x))(. 3)

@@uncurried.swap

let cApp = foo(. 3)
Expand Down Expand Up @@ -115,3 +118,6 @@ let t0 = (type a b, l: list<a>, x: a) => list{x, ...l}
let t1 = (. type a b, l: list<a>, x: a) => list{x, ...l}
let t2 = (. type a b, l: list<a>, x: a) => list{x, ...l}
let t3 = (. type a b, l: list<a>, x: a) => list{x, ...l}

let () = (x => ignore(x))(3)
let () = ((. x) => ignore(x))(. 3)