Skip to content

Commit a5c7568

Browse files
committed
Fix printing of uncurried application when the lhs is a function definition.
1 parent b140da1 commit a5c7568

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ These are only breaking changes for unformatted code.
5858
- Fix issue with integer overflow check https://github.com/rescript-lang/rescript-compiler/pull/6028
5959
- Make internal encoding of locations aware of unicode https://github.com/rescript-lang/rescript-compiler/pull/6073
6060
- Fix issue where `foo(x,_)` in uncurried mode would generate a curried function https://github.com/rescript-lang/rescript-compiler/pull/6082
61+
- Fix printing of uncurried application when the lhs is a function definition https://github.com/rescript-lang/rescript-compiler/pull/6084
6162

6263
#### :nail_care: Polish
6364

res_syntax/src/res_parens.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ let callExpr expr =
5555
| Pexp_try _ | Pexp_while _ | Pexp_for _ | Pexp_ifthenelse _ );
5656
} ->
5757
Parenthesized
58+
| _ when Ast_uncurried.exprIsUncurriedFun expr -> Parenthesized
5859
| _ when ParsetreeViewer.hasAwaitAttribute expr.pexp_attributes ->
5960
Parenthesized
6061
| _ -> Nothing)

res_syntax/tests/printer/expr/UncurriedByDefault.res

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ let t4 = (. type a b) => (l: list<a>, x: a) => list{x, ...l}
5757
let t5 = (type a b) => (. l: list<a>, x: a) => list{x, ...l}
5858
let t6 = (. type a b) => (. l: list<a>, x: a) => list{x, ...l}
5959

60+
let () = (x => ignore(x))(3)
61+
let () = ((. x) => ignore(x))(. 3)
62+
6063
@@uncurried.swap
6164

6265
let cApp = foo(. 3)
@@ -115,3 +118,6 @@ let t0 = (type a b, l: list<a>, x: a) => list{x, ...l}
115118
let t1 = (. type a b, l: list<a>, x: a) => list{x, ...l}
116119
let t2 = (type a b, . l: list<a>, x: a) => list{x, ...l}
117120
let t3 = (. type a b, . l: list<a>, x: a) => list{x, ...l}
121+
122+
let () = (x => ignore(x))(3)
123+
let () = ((. x) => ignore(x))(. 3)

res_syntax/tests/printer/expr/expected/UncurriedByDefault.res.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ let t4 = (type a b, l: list<a>, x: a) => list{x, ...l}
5757
let t5 = (. type a b, l: list<a>, x: a) => list{x, ...l}
5858
let t6 = (. type a b, l: list<a>, x: a) => list{x, ...l}
5959

60+
let () = (x => ignore(x))(3)
61+
let () = ((. x) => ignore(x))(. 3)
62+
6063
@@uncurried.swap
6164

6265
let cApp = foo(. 3)
@@ -115,3 +118,6 @@ let t0 = (type a b, l: list<a>, x: a) => list{x, ...l}
115118
let t1 = (. type a b, l: list<a>, x: a) => list{x, ...l}
116119
let t2 = (. type a b, l: list<a>, x: a) => list{x, ...l}
117120
let t3 = (. type a b, l: list<a>, x: a) => list{x, ...l}
121+
122+
let () = (x => ignore(x))(3)
123+
let () = ((. x) => ignore(x))(. 3)

0 commit comments

Comments
 (0)