Skip to content

Commit c8da619

Browse files
committed
Make gentype tests uncurried.
1 parent 5e08eed commit c8da619

22 files changed

+169
-101
lines changed

jscomp/gentype/TranslateTypeExprFromTypes.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ let translate_constr ~config ~params_translation ~(path : Path.t) ~type_env =
119119
{param_translation with type_ = Array (param_translation.type_, Mutable)}
120120
| ["ImmutableArray"; "t"], [param_translation] ->
121121
{param_translation with type_ = Array (param_translation.type_, Immutable)}
122-
| ["Pervasives"; "ref"], [param_translation] ->
122+
| [("Pervasives" | "PervasivesU"); "ref"], [param_translation] ->
123123
{
124124
dependencies = param_translation.dependencies;
125125
type_ =

jscomp/gentype_tests/typescript-react-example/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/gentype_tests/typescript-react-example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"lint": "biome check src"
1111
},
1212
"dependencies": {
13-
"@rescript/react": "^0.12.0",
13+
"@rescript/react": "^0.12.2",
1414
"react": "^18.2.0",
1515
"react-dom": "^18.2.0"
1616
},

jscomp/gentype_tests/typescript-react-example/rescript.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"subdirs": true
2525
}
2626
],
27-
"uncurried": false,
27+
"uncurried": true,
2828
"package-specs": {
2929
"module": "esmodule",
3030
"in-source": true

jscomp/gentype_tests/typescript-react-example/src/CreateErrorHandler1.res.js

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/gentype_tests/typescript-react-example/src/Docstrings.res.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/gentype_tests/typescript-react-example/src/ErrorHandler.res.js

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/gentype_tests/typescript-react-example/src/Hooks.gen.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,13 @@ export const WithRename_componentWithRenamedArgs: React.ComponentType<{
6969
readonly cb: cb
7070
}> = HooksJS.WithRename.componentWithRenamedArgs as any;
7171

72-
export const WithRef_makeWithRef: (_1:{ readonly vehicle: vehicle }, _2:(null | undefined | any)) => JSX.Element = HooksJS.WithRef.makeWithRef as any;
72+
export const WithRef_makeWithRef: (_1:{ readonly vehicle: vehicle }) => (_1:(null | undefined | any)) => JSX.Element = HooksJS.WithRef.makeWithRef as any;
7373

7474
export type testForwardRef_Props = { readonly vehicle: vehicle };
7575

7676
export const testForwardRef: React.ComponentType<{ readonly vehicle: vehicle }> = HooksJS.testForwardRef as any;
7777

78-
export type ForwardRef_input_Props = { readonly r: r };
79-
80-
export const ForwardRef_input: React.ComponentType<{ readonly r: r }> = HooksJS.ForwardRef.input as any;
78+
export const ForwardRef_input: (_1:r) => JSX.Element = HooksJS.ForwardRef.input as any;
8179

8280
export type Poly_polymorphicComponent_Props<T1> = { readonly p: [vehicle, T1] };
8381

@@ -130,11 +128,11 @@ export const WithRename: { componentWithRenamedArgs: React.ComponentType<{
130128
readonly cb: cb
131129
}> } = HooksJS.WithRename as any;
132130

133-
export const ForwardRef: { input: React.ComponentType<{ readonly r: r }> } = HooksJS.ForwardRef as any;
131+
export const ForwardRef: { input: (_1:r) => JSX.Element } = HooksJS.ForwardRef as any;
134132

135133
export const Fun: { functionReturningReactElement: React.ComponentType<{ readonly name: string }> } = HooksJS.Fun as any;
136134

137-
export const WithRef: { makeWithRef: (_1:{ readonly vehicle: vehicle }, _2:(null | undefined | any)) => JSX.Element } = HooksJS.WithRef as any;
135+
export const WithRef: { makeWithRef: (_1:{ readonly vehicle: vehicle }) => (_1:(null | undefined | any)) => JSX.Element } = HooksJS.WithRef as any;
138136

139137
export const WithChildren: { aComponentWithChildren: React.ComponentType<{ readonly children: React.ReactNode; readonly vehicle: vehicle }> } = HooksJS.WithChildren as any;
140138

jscomp/gentype_tests/typescript-react-example/src/Hooks.res

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ module WithRef = {
8888
}
8989
}
9090

91-
@genType let testForwardRef = React.forwardRef(WithRef.makeWithRef)
91+
@genType let testForwardRef = React.forwardRef( (x,y) => WithRef.makeWithRef(x)(y))
9292

9393
type r = {x: string}
9494

9595
module ForwardRef = {
96-
@genType @react.component
97-
let input = React.forwardRef((~r, (), ref) =>
96+
@genType
97+
let input = React.forwardRef((r, ref) =>
9898
<div ref={Obj.magic(ref)}> {React.string(r.x)} </div>
9999
)
100100
}

jscomp/gentype_tests/typescript-react-example/src/Hooks.res.js

Lines changed: 12 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/gentype_tests/typescript-react-example/src/ImmutableArray.res

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ module Array = {
4444
let rangeBy = (x, y, ~step) => Array.rangeBy(x, y, ~step)->toT
4545

4646
let makeByU = (c, f) => Array.makeByU(c, f)->toT
47-
let makeBy = (c, f) => Array.makeBy(c, f)->toT
47+
let makeBy = (c, f) => Array.makeBy(c, x => f(x))->toT
4848

4949
let makeByAndShuffleU = (c, f) => Array.makeByAndShuffleU(c, f)->toT
50-
let makeByAndShuffle = (c, f) => Array.makeByAndShuffle(c, f)->toT
50+
let makeByAndShuffle = (c, f) => Array.makeByAndShuffle(c, x => f(x))->toT
5151

5252
let zip = (a1, a2) => Array.zip(fromT(a1), fromT(a2))->toTp
5353

5454
let zipByU = (a1, a2, f) => Array.zipByU(fromT(a1), fromT(a2), f)->toT
55-
let zipBy = (a1, a2, f) => Array.zipBy(fromT(a1), fromT(a2), f)->toT
55+
let zipBy = (a1, a2, f) => Array.zipBy(fromT(a1), fromT(a2), (x,y) => f(x, y))->toT
5656

5757
let unzip = a => Array.unzip(a->fromTp)->toT2
5858

@@ -67,52 +67,52 @@ module Array = {
6767
let copy = a => Array.copy(a->fromT)->toT
6868

6969
let forEachU = (a, f) => Array.forEachU(a->fromT, f)
70-
let forEach = (a, f) => Array.forEach(a->fromT, f)
70+
let forEach = (a, f) => Array.forEach(a->fromT, x => f(x))
7171

7272
let mapU = (a, f) => Array.mapU(a->fromT, f)->toT
73-
let map = (a, f) => Array.map(a->fromT, f)->toT
73+
let map = (a, f) => Array.map(a->fromT, x => f(x))->toT
7474

7575
let keepWithIndexU = (a, f) => Array.keepWithIndexU(a->fromT, f)->toT
76-
let keepWithIndex = (a, f) => Array.keepWithIndex(a->fromT, f)->toT
76+
let keepWithIndex = (a, f) => Array.keepWithIndex(a->fromT, (x,y) =>f(x,y))->toT
7777

7878
let keepMapU = (a, f) => Array.keepMapU(a->fromT, f)->toT
79-
let keepMap = (a, f) => Array.keepMap(a->fromT, f)->toT
79+
let keepMap = (a, f) => Array.keepMap(a->fromT, x => f(x))->toT
8080

8181
let forEachWithIndexU = (a, f) => Array.forEachWithIndexU(a->fromT, f)
82-
let forEachWithIndex = (a, f) => Array.forEachWithIndex(a->fromT, f)
82+
let forEachWithIndex = (a, f) => Array.forEachWithIndex(a->fromT, (x,y) => f(x,y))
8383

8484
let mapWithIndexU = (a, f) => Array.mapWithIndexU(a->fromT, f)->toT
85-
let mapWithIndex = (a, f) => Array.mapWithIndex(a->fromT, f)->toT
85+
let mapWithIndex = (a, f) => Array.mapWithIndex(a->fromT, (x,y) => f(x,y))->toT
8686

8787
let partitionU = (a, f) => Array.partitionU(a->fromT, f)->toT2
88-
let partition = (a, f) => Array.partition(a->fromT, f)->toT2
88+
let partition = (a, f) => Array.partition(a->fromT, x => f(x))->toT2
8989

9090
let reduceU = (a, b, f) => Array.reduceU(a->fromT, b, f)
91-
let reduce = (a, b, f) => Array.reduce(a->fromT, b, f)
91+
let reduce = (a, b, f) => Array.reduce(a->fromT, b, (x,y) => f(x,y))
9292

9393
let reduceReverseU = (a, b, f) => Array.reduceReverseU(a->fromT, b, f)
94-
let reduceReverse = (a, b, f) => Array.reduceReverse(a->fromT, b, f)
94+
let reduceReverse = (a, b, f) => Array.reduceReverse(a->fromT, b, (x,y) => f(x,y))
9595

9696
let reduceReverse2U = (a1, a2, c, f) => Array.reduceReverse2U(fromT(a1), fromT(a2), c, f)
97-
let reduceReverse2 = (a1, a2, c, f) => Array.reduceReverse2(fromT(a1), fromT(a2), c, f)
97+
let reduceReverse2 = (a1, a2, c, f) => Array.reduceReverse2(fromT(a1), fromT(a2), c, (x,y,z) => f(x,y,z))
9898

9999
let someU = (a, f) => Array.someU(a->fromT, f)
100-
let some = (a, f) => Array.some(a->fromT, f)
100+
let some = (a, f) => Array.some(a->fromT, x => f(x))
101101

102102
let everyU = (a, f) => Array.everyU(a->fromT, f)
103-
let every = (a, f) => Array.every(a->fromT, f)
103+
let every = (a, f) => Array.every(a->fromT, x => f(x))
104104

105105
let every2U = (a1, a2, f) => Array.every2U(fromT(a1), fromT(a2), f)
106-
let every2 = (a1, a2, f) => Array.every2(fromT(a1), fromT(a2), f)
106+
let every2 = (a1, a2, f) => Array.every2(fromT(a1), fromT(a2), (x,y) => f(x,y))
107107

108108
let some2U = (a1, a2, f) => Array.some2U(fromT(a1), fromT(a2), f)
109-
let some2 = (a1, a2, f) => Array.some2(fromT(a1), fromT(a2), f)
109+
let some2 = (a1, a2, f) => Array.some2(fromT(a1), fromT(a2), (x,y) => f(x,y))
110110

111111
let cmpU = (a1, a2, f) => Array.cmpU(fromT(a1), fromT(a2), f)
112-
let cmp = (a1, a2, f) => Array.cmp(fromT(a1), fromT(a2), f)
112+
let cmp = (a1, a2, f) => Array.cmp(fromT(a1), fromT(a2), (x,y) => f(x,y))
113113

114114
let eqU = (a1, a2, f) => Array.eqU(fromT(a1), fromT(a2), f)
115-
let eq = (a1, a2, f) => Array.eq(fromT(a1), fromT(a2), f)
115+
let eq = (a1, a2, f) => Array.eq(fromT(a1), fromT(a2), (x,y) => f(x,y))
116116
}
117117

118118
include Array

0 commit comments

Comments
 (0)