Skip to content

Commit 7b0e7e5

Browse files
committed
Support uncurried in PPX V3.
1 parent bb3f249 commit 7b0e7e5

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ These are only breaking changes for unformatted code.
7070
- Process `@set` annotation for field update as generating an uncurried function https://github.com/rescript-lang/rescript-compiler/pull/5846
7171
- Treat uncurried application of primitives like curried application, which produces better output https://github.com/rescript-lang/rescript-compiler/pull/5851
7272
- New internal representation for uncurried functions using built-in type `function$<fun_type, arity>` this avoids having to declare all the possible arities ahead of time https://github.com/rescript-lang/rescript-compiler/pull/5870
73+
- PPX V3: allow uncurried `make` function and treat it like a curried one https://github.com/rescript-lang/rescript-compiler/pull/6081
7374

7475
# 10.1.4
7576

res_syntax/src/reactjs_jsx_v3.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,7 @@ let jsxMapper ~config =
597597
match List.filter React_jsx_common.hasAttr pval_attributes with
598598
| [] -> [item]
599599
| [_] ->
600+
let pval_type = React_jsx_common.extractUncurried pval_type in
600601
let rec getPropTypes types ({ptyp_loc; ptyp_desc} as fullType) =
601602
match ptyp_desc with
602603
| Ptyp_arrow (name, type_, ({ptyp_desc = Ptyp_arrow _} as rest))
@@ -648,6 +649,7 @@ let jsxMapper ~config =
648649
let emptyLoc = Location.in_file fileName in
649650
let mapBinding binding =
650651
if React_jsx_common.hasAttrOnBinding binding then
652+
let binding = React_jsx_common.removeArity binding in
651653
let bindingLoc = binding.pvb_loc in
652654
let bindingPatLoc = binding.pvb_pat.ppat_loc in
653655
let binding =
@@ -1031,6 +1033,7 @@ let jsxMapper ~config =
10311033
match List.filter React_jsx_common.hasAttr pval_attributes with
10321034
| [] -> [item]
10331035
| [_] ->
1036+
let pval_type = React_jsx_common.extractUncurried pval_type in
10341037
let rec getPropTypes types ({ptyp_loc; ptyp_desc} as fullType) =
10351038
match ptyp_desc with
10361039
| Ptyp_arrow (name, type_, ({ptyp_desc = Ptyp_arrow _} as rest))

0 commit comments

Comments
 (0)