Skip to content

Commit d9c70e4

Browse files
committed
Remove @@uncurried.swap, which was never public.
1 parent 4fd2dca commit d9c70e4

23 files changed

+121
-326
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
- Make gentype tests uncurried. https://github.com/rescript-lang/rescript-compiler/pull/6866
6363
- Ignore `@uncurry` attribute in uncurried mode, to avoid generating calls to `Curry` at runtime. https://github.com/rescript-lang/rescript-compiler/pull/6869
6464
- Avoid generating calls to Curry when adjusting arity of uncurried functions. https://github.com/rescript-lang/rescript-compiler/pull/6870
65+
- Remove `@@uncurried.swap`, which was used for internal tests. https://github.com/rescript-lang/rescript-compiler/pull/6875
6566

6667
#### :nail_care: Polish
6768

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +0,0 @@
1-
2-
We've found a bug for you!
3-
/.../fixtures/c_for_u_in_u_mode.res:5:5-8:1
4-
5-
3 │ module Foo: {
6-
4 │ let add: (int, int) => int
7-
5 │ } = {
8-
6 │  @@uncurried.swap
9-
7 │  let add = (. a, b) => a + b
10-
8 │ }
11-
9 │
12-
13-
Signature mismatch:
14-
Modules do not match:
15-
{
16-
let add: (int, int) => int
17-
}
18-
is not included in
19-
{
20-
let add: (int, int) => int
21-
}
22-
Values do not match:
23-
let add: (int, int) => int (curried)
24-
is not included in
25-
let add: (int, int) => int (uncurried)
26-
/.../fixtures/c_for_u_in_u_mode.res:4:3-28:
27-
Expected declaration
28-
/.../fixtures/c_for_u_in_u_mode.res:7:7-9:
29-
Actual declaration
Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +0,0 @@
1-
2-
We've found a bug for you!
3-
/.../fixtures/u_for_c_in_u_mode.res:6:5-8:1
4-
5-
4 │ @@uncurried.swap
6-
5 │ let add: (. int, int) => int
7-
6 │ } = {
8-
7 │  let add = (a, b) => a + b
9-
8 │ }
10-
9 │
11-
12-
Signature mismatch:
13-
Modules do not match:
14-
{
15-
let add: (int, int) => int
16-
}
17-
is not included in
18-
{
19-
let add: (int, int) => int
20-
}
21-
Values do not match:
22-
let add: (int, int) => int (uncurried)
23-
is not included in
24-
let add: (int, int) => int (curried)
25-
/.../fixtures/u_for_c_in_u_mode.res:5:3-30:
26-
Expected declaration
27-
/.../fixtures/u_for_c_in_u_mode.res:7:7-9:
28-
Actual declaration

jscomp/build_tests/super_errors/fixtures/c_for_u_in_u_mode.res

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33
module Foo: {
44
let add: (int, int) => int
55
} = {
6-
@@uncurried.swap
76
let add = (. a, b) => a + b
87
}

jscomp/build_tests/super_errors/fixtures/u_for_c_in_u_mode.res

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@@uncurried
22

33
module Foo: {
4-
@@uncurried.swap
54
let add: (. int, int) => int
65
} = {
76
let add = (a, b) => a + b

jscomp/ext/config.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let bs_only = ref true
1111

1212
let unsafe_empty_array = ref false
1313

14-
type uncurried = Legacy | Uncurried | Swap
14+
type uncurried = Legacy | Uncurried
1515
let uncurried = ref Legacy
1616

1717
and cmi_magic_number = "Caml1999I022"

jscomp/ext/config.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ val cmt_magic_number : string
4242

4343
val print_config : out_channel -> unit
4444

45-
type uncurried = Legacy | Uncurried | Swap
45+
type uncurried = Legacy | Uncurried
4646
val uncurried : uncurried ref

jscomp/syntax/src/res_core.ml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6670,9 +6670,6 @@ and parse_standalone_attribute p =
66706670
let attr_id = parse_attribute_id ~start_pos p in
66716671
let attr_id =
66726672
match attr_id.txt with
6673-
| "uncurried.swap" ->
6674-
p.uncurried_config <- Config.Swap;
6675-
attr_id
66766673
| "uncurried" ->
66776674
p.uncurried_config <- Config.Uncurried;
66786675
attr_id

jscomp/syntax/src/res_printer.ml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5559,9 +5559,6 @@ and print_attribute ?(standalone = false) ~state
55595559
| _ ->
55605560
let id =
55615561
match id.txt with
5562-
| "uncurried.swap" ->
5563-
state.uncurried_config <- Config.Swap;
5564-
id
55655562
| "uncurried" ->
55665563
state.uncurried_config <- Config.Uncurried;
55675564
id

jscomp/syntax/src/res_uncurried.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
(* For parsing *)
22
let from_dotted ~dotted = function
33
| Config.Legacy -> dotted
4-
| Swap -> not dotted
54
| Uncurried -> true
65

76
(* For printing *)
87
let get_dotted ~uncurried = function
98
| Config.Legacy -> uncurried
10-
| Swap -> not uncurried
119
| Uncurried -> false

jscomp/syntax/tests/parsing/grammar/expressions/UncurriedByDefault.res

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ type callback1 = (. ReactEvent.Mouse.t) => unit as 'callback
5858
type callback2 = (. ReactEvent.Mouse.t) => (unit as 'u)
5959
type callback3 = ((. ReactEvent.Mouse.t) => unit) as 'callback
6060

61-
@@uncurried.swap
62-
6361
let cApp = foo(. 3)
6462
let uApp = foo(3)
6563

jscomp/syntax/tests/parsing/grammar/expressions/expected/UncurriedByDefault.res.txt

Lines changed: 70 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -86,89 +86,88 @@ type nonrec callback2 =
8686
(ReactEvent.Mouse.t -> unit as 'u, [ `Has_arity1 ]) function$
8787
type nonrec callback3 =
8888
(ReactEvent.Mouse.t -> unit, [ `Has_arity1 ]) function$ as 'callback
89-
[@@@uncurried.swap ]
90-
let cApp = foo 3
91-
let uApp = ((foo 3)[@res.uapp ])
92-
let cFun x = 3
93-
let uFun = ((Function$ (fun x -> 3))[@res.arity 1])
94-
let mixFun a =
89+
let cApp = ((foo 3)[@res.uapp ])
90+
let uApp = foo 3
91+
let cFun = ((Function$ (fun x -> 3))[@res.arity 1])
92+
let uFun x = 3
93+
let mixFun =
9594
((Function$
96-
(fun b ->
97-
fun c ->
98-
((fun d ->
99-
fun e ->
100-
fun f -> fun g -> ((Function$ (fun h -> 4))[@res.arity 1]))
101-
[@res.braces ])))
102-
[@res.arity 2])
103-
let bracesFun = ((Function$ (fun x -> ((fun y -> x + y)[@res.braces ])))
95+
(fun a ->
96+
((fun b ->
97+
fun c ->
98+
((Function$
99+
(fun d ->
100+
fun e ->
101+
fun f ->
102+
((Function$ (fun g -> ((fun h -> 4)[@res.braces ])))
103+
[@res.arity 1])))
104+
[@res.arity 3]))
105+
[@res.braces ])))
104106
[@res.arity 1])
105-
let cFun2 x y = 3
106-
let uFun2 = ((Function$ (fun x -> fun y -> 3))[@res.arity 2])
107-
let cFun2Dots x y = 3
108-
type nonrec cTyp = string -> int
109-
type nonrec uTyp = (string -> int, [ `Has_arity1 ]) function$
107+
let bracesFun x = ((Function$ (fun y -> x + y))[@res.arity 1])
108+
let cFun2 = ((Function$ (fun x -> fun y -> 3))[@res.arity 2])
109+
let uFun2 x y = 3
110+
let cFun2Dots =
111+
((Function$ (fun x -> ((Function$ (fun y -> 3))[@res.arity 1])))
112+
[@res.arity 1])
113+
type nonrec cTyp = (string -> int, [ `Has_arity1 ]) function$
114+
type nonrec uTyp = string -> int
110115
type nonrec mixTyp =
111-
string ->
112-
(string ->
116+
(string ->
117+
string ->
113118
string ->
114-
string ->
115-
string ->
116-
string -> string -> (string -> int, [ `Has_arity1 ]) function$,
117-
[ `Has_arity2 ]) function$
118-
type nonrec bTyp = (string -> string -> int, [ `Has_arity1 ]) function$
119-
type nonrec cTyp2 = string -> string -> int
120-
type nonrec uTyp2 = (string -> string -> int, [ `Has_arity2 ]) function$
121-
type nonrec cu = unit -> int
122-
type nonrec cp = unit -> int
123-
type nonrec cuu = unit -> unit -> int
124-
type nonrec cpu = unit -> unit -> int
125-
type nonrec cup = unit -> unit -> int
126-
type nonrec cpp = unit -> unit -> int
127-
type nonrec cu2 = unit -> unit -> unit
128-
type nonrec cp2 = unit -> unit -> unit
129-
type nonrec uu = (unit -> int, [ `Has_arity1 ]) function$
130-
type nonrec up = (unit -> int, [ `Has_arity1 ]) function$
131-
type nonrec uuu =
119+
(string -> string -> string -> string -> string -> int,
120+
[ `Has_arity4 ]) function$,
121+
[ `Has_arity1 ]) function$
122+
type nonrec bTyp = string -> (string -> int, [ `Has_arity1 ]) function$
123+
type nonrec cTyp2 = (string -> string -> int, [ `Has_arity2 ]) function$
124+
type nonrec uTyp2 = string -> string -> int
125+
type nonrec cu = (unit -> int, [ `Has_arity1 ]) function$
126+
type nonrec cp = (unit -> int, [ `Has_arity1 ]) function$
127+
type nonrec cuu =
132128
(unit -> (unit -> int, [ `Has_arity1 ]) function$, [ `Has_arity1 ])
133129
function$
134-
type nonrec upu =
130+
type nonrec cpu =
135131
(unit -> (unit -> int, [ `Has_arity1 ]) function$, [ `Has_arity1 ])
136132
function$
137-
type nonrec uup =
133+
type nonrec cup =
138134
(unit -> (unit -> int, [ `Has_arity1 ]) function$, [ `Has_arity1 ])
139135
function$
140-
type nonrec upp =
136+
type nonrec cpp =
141137
(unit -> (unit -> int, [ `Has_arity1 ]) function$, [ `Has_arity1 ])
142138
function$
143-
type nonrec uu2 = (unit -> unit -> unit, [ `Has_arity2 ]) function$
144-
type nonrec up2 = (unit -> unit -> unit, [ `Has_arity2 ]) function$
145-
type nonrec cnested = (string -> unit) -> unit
146-
type nonrec unested =
139+
type nonrec cu2 = (unit -> unit -> unit, [ `Has_arity2 ]) function$
140+
type nonrec cp2 = (unit -> unit -> unit, [ `Has_arity2 ]) function$
141+
type nonrec uu = unit -> int
142+
type nonrec up = unit -> int
143+
type nonrec uuu = unit -> unit -> int
144+
type nonrec upu = unit -> unit -> int
145+
type nonrec uup = unit -> unit -> int
146+
type nonrec upp = unit -> unit -> int
147+
type nonrec uu2 = unit -> unit -> unit
148+
type nonrec up2 = unit -> unit -> unit
149+
type nonrec cnested =
147150
((string -> unit, [ `Has_arity1 ]) function$ -> unit, [ `Has_arity1 ])
148151
function$
149-
let pipe1 = 3 |.u f
150-
let (uannpoly : ('a -> string, [ `Has_arity1 ]) function$) = xx
151-
let (uannint : (int -> string, [ `Has_arity1 ]) function$) = xx
152-
let _ = ((Function$ ((fun x -> 34)[@att ]))[@res.arity 1])
153-
let _ = ((Function$ ((fun x -> 34)[@res.async ][@att ]))[@res.arity 1])
154-
let _ = ((preserveAttr ((Function$ ((fun x -> 34)[@att ]))[@res.arity 1]))
155-
[@res.uapp ])
156-
let _ =
157-
((preserveAttr ((Function$ ((fun x -> 34)[@res.async ][@att ]))
158-
[@res.arity 1]))
159-
[@res.uapp ])
160-
let t0 (type a) (type b) =
152+
type nonrec unested = (string -> unit) -> unit
153+
let pipe1 = 3 |. f
154+
let (uannpoly : 'a -> string) = xx
155+
let (uannint : int -> string) = xx
156+
let _ = ((fun x -> 34)[@att ])
157+
let _ = ((fun x -> 34)[@res.async ][@att ])
158+
let _ = preserveAttr ((fun x -> 34)[@att ])
159+
let _ = preserveAttr ((fun x -> 34)[@res.async ][@att ])
160+
let t0 (type a) (type b) (l : a list) (x : a) = x :: l
161+
let t1 (type a) (type b) =
161162
((Function$ (fun (l : a list) -> fun (x : a) -> x :: l))[@res.arity 2])
162-
let t1 (type a) (type b) (l : a list) (x : a) = x :: l
163-
let t2 (type a) (type b) (l : a list) (x : a) = x :: l
164-
let t3 (type a) (type b) (l : a list) (x : a) = x :: l
165-
type nonrec arrowPath1 = (int -> string, [ `Has_arity1 ]) function$
166-
type nonrec arrowPath2 = (I.t -> string, [ `Has_arity1 ]) function$
167-
type nonrec arrowPath3 = int -> string
168-
type nonrec arrowPath4 = I.t -> string
169-
type nonrec callback1 =
170-
(ReactEvent.Mouse.t -> unit, [ `Has_arity1 ]) function$ as 'callback
171-
type nonrec callback2 =
172-
(ReactEvent.Mouse.t -> unit as 'u, [ `Has_arity1 ]) function$
173-
type nonrec callback3 =
174-
(ReactEvent.Mouse.t -> unit, [ `Has_arity1 ]) function$ as 'callback
163+
let t2 (type a) (type b) =
164+
((Function$ (fun (l : a list) -> fun (x : a) -> x :: l))[@res.arity 2])
165+
let t3 (type a) (type b) =
166+
((Function$ (fun (l : a list) -> fun (x : a) -> x :: l))[@res.arity 2])
167+
type nonrec arrowPath1 = int -> string
168+
type nonrec arrowPath2 = I.t -> string
169+
type nonrec arrowPath3 = (int -> string, [ `Has_arity1 ]) function$
170+
type nonrec arrowPath4 = (I.t -> string, [ `Has_arity1 ]) function$
171+
type nonrec callback1 = (ReactEvent.Mouse.t -> unit) as 'callback
172+
type nonrec callback2 = ReactEvent.Mouse.t -> unit as 'u
173+
type nonrec callback3 = (ReactEvent.Mouse.t -> unit) as 'callback

jscomp/syntax/tests/printer/expr/UncurriedByDefault.res

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ let fnC = (_x): ((unit) => unit) => fooC
7979
let a = ((. ()) => "foo")->Ok
8080
let aC = (() => "foo")->Ok
8181

82-
@@uncurried.swap
8382

8483
let cApp = foo(. 3)
8584
let uApp = foo(3)

jscomp/syntax/tests/printer/expr/expected/UncurriedByDefault.res.txt

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,16 @@ let fnC = (_x): (unit => unit) => fooC
7979
let a = ((. ()) => "foo")->Ok
8080
let aC = (() => "foo")->Ok
8181

82-
@@uncurried.swap
83-
8482
let cApp = foo(. 3)
8583
let uApp = foo(3)
8684

8785
let cFun = (. x) => 3
8886
let uFun = x => 3
89-
let mixFun = (. a) => (b, c) => {(. d, e, f, g) => h => 4}
90-
let bracesFun = x => {(. y) => x + y}
87+
let mixFun = (. a) => {(b, c) => (. d, e, f) => (. g) => {h => 4}}
88+
let bracesFun = x => (. y) => x + y
9189
let cFun2 = (. x, y) => 3
9290
let uFun2 = (x, y) => 3
93-
let cFun2Dots = (. x, y) => 3 // redundant dot on y
91+
let cFun2Dots = (. x) => (. y) => 3 // redundant dot on y
9492

9593
type cTyp = (. string) => int
9694
type uTyp = string => int
@@ -100,18 +98,18 @@ type cTyp2 = (. string, string) => int
10098
type uTyp2 = (string, string) => int
10199
type cu = (. unit) => int
102100
type cp = (. unit) => int
103-
type cuu = (. unit, unit) => int
104-
type cpu = (. unit, unit) => int
105-
type cup = (. unit, unit) => int
106-
type cpp = (. unit, unit) => int
101+
type cuu = (. unit) => (. unit) => int
102+
type cpu = (. unit) => (. unit) => int
103+
type cup = (. unit) => (. unit) => int
104+
type cpp = (. unit) => (. unit) => int
107105
type cu2 = (. unit, unit) => unit
108106
type cp2 = (. unit, unit) => unit
109107
type uu = unit => int
110108
type up = unit => int
111-
type uuu = unit => unit => int
112-
type upu = unit => unit => int
113-
type uup = unit => unit => int
114-
type upp = unit => unit => int
109+
type uuu = (unit, unit) => int
110+
type upu = (unit, unit) => int
111+
type uup = (unit, unit) => int
112+
type upp = (unit, unit) => int
115113
type uu2 = (unit, unit) => unit
116114
type up2 = (unit, unit) => unit
117115

0 commit comments

Comments
 (0)