Skip to content

Commit c4af2eb

Browse files
committed
Support automatic conversion to uncurried via @@toUncurried and reformat
Add `@@toUncurried` to the file and reformat. The file will turn into uncurried syntax.
1 parent f912c44 commit c4af2eb

File tree

5 files changed

+42
-4
lines changed

5 files changed

+42
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
- Introduce experimental uncurried by default mode. Can be turned on mid-file by adding standalone annotation `@@uncurried`. For experimentation only. https://github.com/rescript-lang/rescript-compiler/pull/5796
1818

19+
- Adding `@@toUncurried` to the file and reformat will convert to uncurried syntax
20+
1921
#### :boom: Breaking Change
2022

2123
- Remove support for the legacy Reason syntax. Existing Reason code can be converted to ReScript syntax using ReScript 9 as follows:

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58330,7 +58330,16 @@ and printAttribute ?(standalone = false) ~state
5833058330
],
5833158331
Doc.hardLine )
5833258332
| _ ->
58333-
if id.txt = "uncurried" then state.uncurried_by_default <- true;
58333+
let id =
58334+
match id.txt with
58335+
| "uncurried" ->
58336+
state.uncurried_by_default <- true;
58337+
id
58338+
| "toUncurried" ->
58339+
state.uncurried_by_default <- true;
58340+
{id with txt = "uncurried"}
58341+
| _ -> id
58342+
in
5833458343
( Doc.group
5833558344
(Doc.concat
5833658345
[

lib/4.06.1/unstable/js_playground_compiler.ml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58330,7 +58330,16 @@ and printAttribute ?(standalone = false) ~state
5833058330
],
5833158331
Doc.hardLine )
5833258332
| _ ->
58333-
if id.txt = "uncurried" then state.uncurried_by_default <- true;
58333+
let id =
58334+
match id.txt with
58335+
| "uncurried" ->
58336+
state.uncurried_by_default <- true;
58337+
id
58338+
| "toUncurried" ->
58339+
state.uncurried_by_default <- true;
58340+
{id with txt = "uncurried"}
58341+
| _ -> id
58342+
in
5833458343
( Doc.group
5833558344
(Doc.concat
5833658345
[

lib/4.06.1/whole_compiler.ml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113325,7 +113325,16 @@ and printAttribute ?(standalone = false) ~state
113325113325
],
113326113326
Doc.hardLine )
113327113327
| _ ->
113328-
if id.txt = "uncurried" then state.uncurried_by_default <- true;
113328+
let id =
113329+
match id.txt with
113330+
| "uncurried" ->
113331+
state.uncurried_by_default <- true;
113332+
id
113333+
| "toUncurried" ->
113334+
state.uncurried_by_default <- true;
113335+
{id with txt = "uncurried"}
113336+
| _ -> id
113337+
in
113329113338
( Doc.group
113330113339
(Doc.concat
113331113340
[

res_syntax/src/res_printer.ml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5264,7 +5264,16 @@ and printAttribute ?(standalone = false) ~state
52645264
],
52655265
Doc.hardLine )
52665266
| _ ->
5267-
if id.txt = "uncurried" then state.uncurried_by_default <- true;
5267+
let id =
5268+
match id.txt with
5269+
| "uncurried" ->
5270+
state.uncurried_by_default <- true;
5271+
id
5272+
| "toUncurried" ->
5273+
state.uncurried_by_default <- true;
5274+
{id with txt = "uncurried"}
5275+
| _ -> id
5276+
in
52685277
( Doc.group
52695278
(Doc.concat
52705279
[

0 commit comments

Comments
 (0)