Skip to content

Ignore @uncurry attribute in uncurried mode. #6869

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
Jul 10, 2024
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
- Make compiler libs ready for uncurried mode. https://github.com/rescript-lang/rescript-compiler/pull/6861
- Make tests ready for uncurried mode. https://github.com/rescript-lang/rescript-compiler/pull/6862
- Make gentype tests uncurried. https://github.com/rescript-lang/rescript-compiler/pull/6866
- Ignore `@uncurry` attribute in uncurried mode, to avoid generating calls to `Curry` at runtime. https://github.com/rescript-lang/rescript-compiler/pull/6869

#### :nail_care: Polish

- Make the `--help` arg be prioritized in the CLI, so correctly prints help message and skip other commands. https://github.com/rescript-lang/rescript-compiler/pull/6667
Expand Down
5 changes: 4 additions & 1 deletion jscomp/frontend/ast_attributes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,10 @@ let iter_process_bs_string_int_unwrap_uncurry (attrs : t) =
| "int" -> assign `Int attr
| "ignore" -> assign `Ignore attr
| "unwrap" -> assign `Unwrap attr
| "uncurry" -> assign (`Uncurry (Ast_payload.is_single_int payload)) attr
| "uncurry" ->
if !Config.uncurried = Uncurried then
Used_attributes.mark_used_attribute attr
else assign (`Uncurry (Ast_payload.is_single_int payload)) attr
| _ -> ());
!st

Expand Down
4 changes: 3 additions & 1 deletion jscomp/test/build.ninja

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions jscomp/test/ignore_uncurry_attribute.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions jscomp/test/ignore_uncurry_attribute.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@@uncurried

external map1: (array<'a>, @uncurry ('a => 'b)) => array<'b> = "map"
let map1 = map1

external map2: (array<'a>, ('a => 'b)) => array<'b> = "map"
let map2 = map2
16 changes: 16 additions & 0 deletions jscomp/test/keep_uncurry_attribute.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions jscomp/test/keep_uncurry_attribute.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
external map1: (array<'a>, @uncurry ('a => 'b)) => array<'b> = "map"
let map1 = map1

external map2: (array<'a>, ('a => 'b)) => array<'b> = "map"
let map2 = map2