Skip to content

Remove @@uncurried.swap, which was never public. #6875

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 13, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
- 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
- Avoid generating calls to Curry when adjusting arity of uncurried functions. https://github.com/rescript-lang/rescript-compiler/pull/6870
- Remove `@@uncurried.swap`, which was used for internal tests. https://github.com/rescript-lang/rescript-compiler/pull/6875

#### :nail_care: Polish

Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +0,0 @@

We've found a bug for you!
/.../fixtures/c_for_u_in_u_mode.res:5:5-8:1

3 │ module Foo: {
4 │ let add: (int, int) => int
5 │ } = {
6 │  @@uncurried.swap
7 │  let add = (. a, b) => a + b
8 │ }
9 │

Signature mismatch:
Modules do not match:
{
let add: (int, int) => int
}
is not included in
{
let add: (int, int) => int
}
Values do not match:
let add: (int, int) => int (curried)
is not included in
let add: (int, int) => int (uncurried)
/.../fixtures/c_for_u_in_u_mode.res:4:3-28:
Expected declaration
/.../fixtures/c_for_u_in_u_mode.res:7:7-9:
Actual declaration
Original file line number Diff line number Diff line change
@@ -1,28 +0,0 @@

We've found a bug for you!
/.../fixtures/u_for_c_in_u_mode.res:6:5-8:1

4 │ @@uncurried.swap
5 │ let add: (. int, int) => int
6 │ } = {
7 │  let add = (a, b) => a + b
8 │ }
9 │

Signature mismatch:
Modules do not match:
{
let add: (int, int) => int
}
is not included in
{
let add: (int, int) => int
}
Values do not match:
let add: (int, int) => int (uncurried)
is not included in
let add: (int, int) => int (curried)
/.../fixtures/u_for_c_in_u_mode.res:5:3-30:
Expected declaration
/.../fixtures/u_for_c_in_u_mode.res:7:7-9:
Actual declaration
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
module Foo: {
let add: (int, int) => int
} = {
@@uncurried.swap
let add = (. a, b) => a + b
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@@uncurried

module Foo: {
@@uncurried.swap
let add: (. int, int) => int
} = {
let add = (a, b) => a + b
Expand Down
2 changes: 1 addition & 1 deletion jscomp/ext/config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let bs_only = ref true

let unsafe_empty_array = ref false

type uncurried = Legacy | Uncurried | Swap
type uncurried = Legacy | Uncurried
let uncurried = ref Legacy

and cmi_magic_number = "Caml1999I022"
Expand Down
2 changes: 1 addition & 1 deletion jscomp/ext/config.mli
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ val cmt_magic_number : string

val print_config : out_channel -> unit

type uncurried = Legacy | Uncurried | Swap
type uncurried = Legacy | Uncurried
val uncurried : uncurried ref
3 changes: 0 additions & 3 deletions jscomp/syntax/src/res_core.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6670,9 +6670,6 @@ and parse_standalone_attribute p =
let attr_id = parse_attribute_id ~start_pos p in
let attr_id =
match attr_id.txt with
| "uncurried.swap" ->
p.uncurried_config <- Config.Swap;
attr_id
| "uncurried" ->
p.uncurried_config <- Config.Uncurried;
attr_id
Expand Down
3 changes: 0 additions & 3 deletions jscomp/syntax/src/res_printer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5559,9 +5559,6 @@ and print_attribute ?(standalone = false) ~state
| _ ->
let id =
match id.txt with
| "uncurried.swap" ->
state.uncurried_config <- Config.Swap;
id
| "uncurried" ->
state.uncurried_config <- Config.Uncurried;
id
Expand Down
2 changes: 0 additions & 2 deletions jscomp/syntax/src/res_uncurried.ml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
(* For parsing *)
let from_dotted ~dotted = function
| Config.Legacy -> dotted
| Swap -> not dotted
| Uncurried -> true

(* For printing *)
let get_dotted ~uncurried = function
| Config.Legacy -> uncurried
| Swap -> not uncurried
| Uncurried -> false
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ type callback1 = (. ReactEvent.Mouse.t) => unit as 'callback
type callback2 = (. ReactEvent.Mouse.t) => (unit as 'u)
type callback3 = ((. ReactEvent.Mouse.t) => unit) as 'callback

@@uncurried.swap

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,89 +86,88 @@ type nonrec callback2 =
(ReactEvent.Mouse.t -> unit as 'u, [ `Has_arity1 ]) function$
type nonrec callback3 =
(ReactEvent.Mouse.t -> unit, [ `Has_arity1 ]) function$ as 'callback
[@@@uncurried.swap ]
let cApp = foo 3
let uApp = ((foo 3)[@res.uapp ])
let cFun x = 3
let uFun = ((Function$ (fun x -> 3))[@res.arity 1])
let mixFun a =
let cApp = ((foo 3)[@res.uapp ])
let uApp = foo 3
let cFun = ((Function$ (fun x -> 3))[@res.arity 1])
let uFun x = 3
let mixFun =
((Function$
(fun b ->
fun c ->
((fun d ->
fun e ->
fun f -> fun g -> ((Function$ (fun h -> 4))[@res.arity 1]))
[@res.braces ])))
[@res.arity 2])
let bracesFun = ((Function$ (fun x -> ((fun y -> x + y)[@res.braces ])))
(fun a ->
((fun b ->
fun c ->
((Function$
(fun d ->
fun e ->
fun f ->
((Function$ (fun g -> ((fun h -> 4)[@res.braces ])))
[@res.arity 1])))
[@res.arity 3]))
[@res.braces ])))
[@res.arity 1])
let cFun2 x y = 3
let uFun2 = ((Function$ (fun x -> fun y -> 3))[@res.arity 2])
let cFun2Dots x y = 3
type nonrec cTyp = string -> int
type nonrec uTyp = (string -> int, [ `Has_arity1 ]) function$
let bracesFun x = ((Function$ (fun y -> x + y))[@res.arity 1])
let cFun2 = ((Function$ (fun x -> fun y -> 3))[@res.arity 2])
let uFun2 x y = 3
let cFun2Dots =
((Function$ (fun x -> ((Function$ (fun y -> 3))[@res.arity 1])))
[@res.arity 1])
type nonrec cTyp = (string -> int, [ `Has_arity1 ]) function$
type nonrec uTyp = string -> int
type nonrec mixTyp =
string ->
(string ->
(string ->
string ->
string ->
string ->
string ->
string -> string -> (string -> int, [ `Has_arity1 ]) function$,
[ `Has_arity2 ]) function$
type nonrec bTyp = (string -> string -> int, [ `Has_arity1 ]) function$
type nonrec cTyp2 = string -> string -> int
type nonrec uTyp2 = (string -> string -> int, [ `Has_arity2 ]) function$
type nonrec cu = unit -> int
type nonrec cp = unit -> int
type nonrec cuu = unit -> unit -> int
type nonrec cpu = unit -> unit -> int
type nonrec cup = unit -> unit -> int
type nonrec cpp = unit -> unit -> int
type nonrec cu2 = unit -> unit -> unit
type nonrec cp2 = unit -> unit -> unit
type nonrec uu = (unit -> int, [ `Has_arity1 ]) function$
type nonrec up = (unit -> int, [ `Has_arity1 ]) function$
type nonrec uuu =
(string -> string -> string -> string -> string -> int,
[ `Has_arity4 ]) function$,
[ `Has_arity1 ]) function$
type nonrec bTyp = string -> (string -> int, [ `Has_arity1 ]) function$
type nonrec cTyp2 = (string -> string -> int, [ `Has_arity2 ]) function$
type nonrec uTyp2 = string -> string -> int
type nonrec cu = (unit -> int, [ `Has_arity1 ]) function$
type nonrec cp = (unit -> int, [ `Has_arity1 ]) function$
type nonrec cuu =
(unit -> (unit -> int, [ `Has_arity1 ]) function$, [ `Has_arity1 ])
function$
type nonrec upu =
type nonrec cpu =
(unit -> (unit -> int, [ `Has_arity1 ]) function$, [ `Has_arity1 ])
function$
type nonrec uup =
type nonrec cup =
(unit -> (unit -> int, [ `Has_arity1 ]) function$, [ `Has_arity1 ])
function$
type nonrec upp =
type nonrec cpp =
(unit -> (unit -> int, [ `Has_arity1 ]) function$, [ `Has_arity1 ])
function$
type nonrec uu2 = (unit -> unit -> unit, [ `Has_arity2 ]) function$
type nonrec up2 = (unit -> unit -> unit, [ `Has_arity2 ]) function$
type nonrec cnested = (string -> unit) -> unit
type nonrec unested =
type nonrec cu2 = (unit -> unit -> unit, [ `Has_arity2 ]) function$
type nonrec cp2 = (unit -> unit -> unit, [ `Has_arity2 ]) function$
type nonrec uu = unit -> int
type nonrec up = unit -> int
type nonrec uuu = unit -> unit -> int
type nonrec upu = unit -> unit -> int
type nonrec uup = unit -> unit -> int
type nonrec upp = unit -> unit -> int
type nonrec uu2 = unit -> unit -> unit
type nonrec up2 = unit -> unit -> unit
type nonrec cnested =
((string -> unit, [ `Has_arity1 ]) function$ -> unit, [ `Has_arity1 ])
function$
let pipe1 = 3 |.u f
let (uannpoly : ('a -> string, [ `Has_arity1 ]) function$) = xx
let (uannint : (int -> string, [ `Has_arity1 ]) function$) = xx
let _ = ((Function$ ((fun x -> 34)[@att ]))[@res.arity 1])
let _ = ((Function$ ((fun x -> 34)[@res.async ][@att ]))[@res.arity 1])
let _ = ((preserveAttr ((Function$ ((fun x -> 34)[@att ]))[@res.arity 1]))
[@res.uapp ])
let _ =
((preserveAttr ((Function$ ((fun x -> 34)[@res.async ][@att ]))
[@res.arity 1]))
[@res.uapp ])
let t0 (type a) (type b) =
type nonrec unested = (string -> unit) -> unit
let pipe1 = 3 |. f
let (uannpoly : 'a -> string) = xx
let (uannint : int -> string) = xx
let _ = ((fun x -> 34)[@att ])
let _ = ((fun x -> 34)[@res.async ][@att ])
let _ = preserveAttr ((fun x -> 34)[@att ])
let _ = preserveAttr ((fun x -> 34)[@res.async ][@att ])
let t0 (type a) (type b) (l : a list) (x : a) = x :: l
let t1 (type a) (type b) =
((Function$ (fun (l : a list) -> fun (x : a) -> x :: l))[@res.arity 2])
let t1 (type a) (type b) (l : a list) (x : a) = x :: l
let t2 (type a) (type b) (l : a list) (x : a) = x :: l
let t3 (type a) (type b) (l : a list) (x : a) = x :: l
type nonrec arrowPath1 = (int -> string, [ `Has_arity1 ]) function$
type nonrec arrowPath2 = (I.t -> string, [ `Has_arity1 ]) function$
type nonrec arrowPath3 = int -> string
type nonrec arrowPath4 = I.t -> string
type nonrec callback1 =
(ReactEvent.Mouse.t -> unit, [ `Has_arity1 ]) function$ as 'callback
type nonrec callback2 =
(ReactEvent.Mouse.t -> unit as 'u, [ `Has_arity1 ]) function$
type nonrec callback3 =
(ReactEvent.Mouse.t -> unit, [ `Has_arity1 ]) function$ as 'callback
let t2 (type a) (type b) =
((Function$ (fun (l : a list) -> fun (x : a) -> x :: l))[@res.arity 2])
let t3 (type a) (type b) =
((Function$ (fun (l : a list) -> fun (x : a) -> x :: l))[@res.arity 2])
type nonrec arrowPath1 = int -> string
type nonrec arrowPath2 = I.t -> string
type nonrec arrowPath3 = (int -> string, [ `Has_arity1 ]) function$
type nonrec arrowPath4 = (I.t -> string, [ `Has_arity1 ]) function$
type nonrec callback1 = (ReactEvent.Mouse.t -> unit) as 'callback
type nonrec callback2 = ReactEvent.Mouse.t -> unit as 'u
type nonrec callback3 = (ReactEvent.Mouse.t -> unit) as 'callback
1 change: 0 additions & 1 deletion jscomp/syntax/tests/printer/expr/UncurriedByDefault.res
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ let fnC = (_x): ((unit) => unit) => fooC
let a = ((. ()) => "foo")->Ok
let aC = (() => "foo")->Ok

@@uncurried.swap

let cApp = foo(. 3)
let uApp = foo(3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,16 @@ let fnC = (_x): (unit => unit) => fooC
let a = ((. ()) => "foo")->Ok
let aC = (() => "foo")->Ok

@@uncurried.swap

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

let cFun = (. x) => 3
let uFun = x => 3
let mixFun = (. a) => (b, c) => {(. d, e, f, g) => h => 4}
let bracesFun = x => {(. y) => x + y}
let mixFun = (. a) => {(b, c) => (. d, e, f) => (. g) => {h => 4}}
let bracesFun = x => (. y) => x + y
let cFun2 = (. x, y) => 3
let uFun2 = (x, y) => 3
let cFun2Dots = (. x, y) => 3 // redundant dot on y
let cFun2Dots = (. x) => (. y) => 3 // redundant dot on y

type cTyp = (. string) => int
type uTyp = string => int
Expand All @@ -100,18 +98,18 @@ type cTyp2 = (. string, string) => int
type uTyp2 = (string, string) => int
type cu = (. unit) => int
type cp = (. unit) => int
type cuu = (. unit, unit) => int
type cpu = (. unit, unit) => int
type cup = (. unit, unit) => int
type cpp = (. unit, unit) => int
type cuu = (. unit) => (. unit) => int
type cpu = (. unit) => (. unit) => int
type cup = (. unit) => (. unit) => int
type cpp = (. unit) => (. unit) => int
type cu2 = (. unit, unit) => unit
type cp2 = (. unit, unit) => unit
type uu = unit => int
type up = unit => int
type uuu = unit => unit => int
type upu = unit => unit => int
type uup = unit => unit => int
type upp = unit => unit => int
type uuu = (unit, unit) => int
type upu = (unit, unit) => int
type uup = (unit, unit) => int
type upp = (unit, unit) => int
type uu2 = (unit, unit) => unit
type up2 = (unit, unit) => unit

Expand Down
Loading