Skip to content

Commit bffacb0

Browse files
committed
Avoid generation of Curry with reverse application |>.
Reverse application`|>` is already formatted away, but this takes care of the issue before formatting.
1 parent 8144467 commit bffacb0

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
- Fix Deno compatibility issues on Windows. https://github.com/rescript-lang/rescript-compiler/pull/6850
4646
- Fix issue with infinite loops with type errors on recursive types. https://github.com/rescript-lang/rescript-compiler/pull/6867
4747
- Fix issue where using partial application `...` can generate code that uses `Curry` at runtime. https://github.com/rescript-lang/rescript-compiler/pull/6872
48+
- Avoid generation of `Curry` with reverse application `|>`. https://github.com/rescript-lang/rescript-compiler/pull/6876
4849

4950
#### :house: Internal
5051

jscomp/syntax/src/res_core.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2261,7 +2261,7 @@ and parse_binary_expr ?(context = OrdinaryExpr) ?a p prec =
22612261
when p.uncurried_config = Uncurried ->
22622262
{b with pexp_desc = Pexp_apply (fun_expr, args @ [(Nolabel, a)])}
22632263
| BarGreater, _ when p.uncurried_config = Uncurried ->
2264-
Ast_helper.Exp.apply ~loc b [(Nolabel, a)]
2264+
Ast_helper.Exp.apply ~loc ~attrs:[uncurried_app_attr] b [(Nolabel, a)]
22652265
| _ ->
22662266
Ast_helper.Exp.apply ~loc
22672267
(make_infix_operator p token start_pos end_pos)

jscomp/test/UncurriedAlways.js

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/test/UncurriedAlways.res

+6
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,9 @@ module PartialApplication = {
9090

9191
let fxyz = f3(~x=1, ~y=1, ~z=1, ...)
9292
}
93+
94+
let hello1 = (y, f) => f(y)
95+
96+
let hello2 = (y, f) => y |> f
97+
98+

0 commit comments

Comments
 (0)