From d9c70e495a40c3a915e5a41e645981df854b5978 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Sat, 13 Jul 2024 15:06:57 +0200 Subject: [PATCH] Remove `@@uncurried.swap`, which was never public. --- CHANGELOG.md | 1 + .../expected/c_for_u_in_u_mode.res.expected | 29 ---- .../expected/u_for_c_in_u_mode.res.expected | 28 ---- .../fixtures/c_for_u_in_u_mode.res | 1 - .../fixtures/u_for_c_in_u_mode.res | 1 - jscomp/ext/config.ml | 2 +- jscomp/ext/config.mli | 2 +- jscomp/syntax/src/res_core.ml | 3 - jscomp/syntax/src/res_printer.ml | 3 - jscomp/syntax/src/res_uncurried.ml | 2 - .../expressions/UncurriedByDefault.res | 2 - .../expected/UncurriedByDefault.res.txt | 141 +++++++++--------- .../tests/printer/expr/UncurriedByDefault.res | 1 - .../expr/expected/UncurriedByDefault.res.txt | 24 ++- jscomp/test/UncurriedExternals.js | 75 ---------- jscomp/test/UncurriedExternals.res | 42 ------ jscomp/test/async_await.js | 7 +- jscomp/test/async_await.res | 4 +- jscomp/test/uncurried_cast.js | 20 ++- jscomp/test/uncurried_cast.res | 7 +- jscomp/test/uncurried_default.args.js | 37 ++--- jscomp/test/uncurried_default.args.res | 9 +- jscomp/test/uncurried_pipe.res | 6 +- 23 files changed, 121 insertions(+), 326 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8a1db7d94..f4ec163724 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/jscomp/build_tests/super_errors/expected/c_for_u_in_u_mode.res.expected b/jscomp/build_tests/super_errors/expected/c_for_u_in_u_mode.res.expected index 3b3462a019..e69de29bb2 100644 --- a/jscomp/build_tests/super_errors/expected/c_for_u_in_u_mode.res.expected +++ b/jscomp/build_tests/super_errors/expected/c_for_u_in_u_mode.res.expected @@ -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 \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/expected/u_for_c_in_u_mode.res.expected b/jscomp/build_tests/super_errors/expected/u_for_c_in_u_mode.res.expected index 823724e0e7..e69de29bb2 100644 --- a/jscomp/build_tests/super_errors/expected/u_for_c_in_u_mode.res.expected +++ b/jscomp/build_tests/super_errors/expected/u_for_c_in_u_mode.res.expected @@ -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 \ No newline at end of file diff --git a/jscomp/build_tests/super_errors/fixtures/c_for_u_in_u_mode.res b/jscomp/build_tests/super_errors/fixtures/c_for_u_in_u_mode.res index 844400218c..77c4a266d1 100644 --- a/jscomp/build_tests/super_errors/fixtures/c_for_u_in_u_mode.res +++ b/jscomp/build_tests/super_errors/fixtures/c_for_u_in_u_mode.res @@ -3,6 +3,5 @@ module Foo: { let add: (int, int) => int } = { - @@uncurried.swap let add = (. a, b) => a + b } diff --git a/jscomp/build_tests/super_errors/fixtures/u_for_c_in_u_mode.res b/jscomp/build_tests/super_errors/fixtures/u_for_c_in_u_mode.res index 85e59dbaef..a7baf943cd 100644 --- a/jscomp/build_tests/super_errors/fixtures/u_for_c_in_u_mode.res +++ b/jscomp/build_tests/super_errors/fixtures/u_for_c_in_u_mode.res @@ -1,7 +1,6 @@ @@uncurried module Foo: { - @@uncurried.swap let add: (. int, int) => int } = { let add = (a, b) => a + b diff --git a/jscomp/ext/config.ml b/jscomp/ext/config.ml index dd5ec9aea0..d5cbdc10c1 100644 --- a/jscomp/ext/config.ml +++ b/jscomp/ext/config.ml @@ -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" diff --git a/jscomp/ext/config.mli b/jscomp/ext/config.mli index 677e750206..bd5511dabf 100644 --- a/jscomp/ext/config.mli +++ b/jscomp/ext/config.mli @@ -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 \ No newline at end of file diff --git a/jscomp/syntax/src/res_core.ml b/jscomp/syntax/src/res_core.ml index 3b3f0ff3f9..76b7b8fb32 100644 --- a/jscomp/syntax/src/res_core.ml +++ b/jscomp/syntax/src/res_core.ml @@ -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 diff --git a/jscomp/syntax/src/res_printer.ml b/jscomp/syntax/src/res_printer.ml index 23592c382c..3e3a4405bf 100644 --- a/jscomp/syntax/src/res_printer.ml +++ b/jscomp/syntax/src/res_printer.ml @@ -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 diff --git a/jscomp/syntax/src/res_uncurried.ml b/jscomp/syntax/src/res_uncurried.ml index b5d3706c68..ee52288b11 100644 --- a/jscomp/syntax/src/res_uncurried.ml +++ b/jscomp/syntax/src/res_uncurried.ml @@ -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 diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/UncurriedByDefault.res b/jscomp/syntax/tests/parsing/grammar/expressions/UncurriedByDefault.res index 521b201ad7..6e759cb2e4 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/UncurriedByDefault.res +++ b/jscomp/syntax/tests/parsing/grammar/expressions/UncurriedByDefault.res @@ -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) diff --git a/jscomp/syntax/tests/parsing/grammar/expressions/expected/UncurriedByDefault.res.txt b/jscomp/syntax/tests/parsing/grammar/expressions/expected/UncurriedByDefault.res.txt index 189d34b374..16b4bcc4c8 100644 --- a/jscomp/syntax/tests/parsing/grammar/expressions/expected/UncurriedByDefault.res.txt +++ b/jscomp/syntax/tests/parsing/grammar/expressions/expected/UncurriedByDefault.res.txt @@ -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 \ No newline at end of file +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 \ No newline at end of file diff --git a/jscomp/syntax/tests/printer/expr/UncurriedByDefault.res b/jscomp/syntax/tests/printer/expr/UncurriedByDefault.res index e967cb697c..1107da0266 100644 --- a/jscomp/syntax/tests/printer/expr/UncurriedByDefault.res +++ b/jscomp/syntax/tests/printer/expr/UncurriedByDefault.res @@ -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) diff --git a/jscomp/syntax/tests/printer/expr/expected/UncurriedByDefault.res.txt b/jscomp/syntax/tests/printer/expr/expected/UncurriedByDefault.res.txt index 018dbe8b80..047bb6a858 100644 --- a/jscomp/syntax/tests/printer/expr/expected/UncurriedByDefault.res.txt +++ b/jscomp/syntax/tests/printer/expr/expected/UncurriedByDefault.res.txt @@ -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 @@ -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 diff --git a/jscomp/test/UncurriedExternals.js b/jscomp/test/UncurriedExternals.js index b619e1e3b6..de83580641 100644 --- a/jscomp/test/UncurriedExternals.js +++ b/jscomp/test/UncurriedExternals.js @@ -80,81 +80,6 @@ function methodWithAsync(param) { })(param); } -function dd$1(param) { - throw new Error("Not_found", { - cause: { - RE_EXN_ID: "Not_found" - } - }); -} - -let h$1 = sum(1.0, 2.0); - -let M$1 = { - sum: (function (prim0, prim1) { - return sum(prim0, prim1); - }) -}; - -let hh$1 = M$1.sum(1.0, 2.0); - -let mf$1 = 3 % 4; - -function tg$1(arr) { - return arr[0]; -} - -let tc$1 = Object.assign({}, "abc"); - -let te$1 = { - RE_EXN_ID: "Not_found" -}; - -let tcr$1 = {}; - -function tsiC$1(c) { - c.increment = (function (amount) { - let me = this ; - console.log(me); - }); -} - -function tsiU$1(c) { - c.increment = (function (amount) { - let me = this ; - console.log(me); - }); -} - -let match$1 = React.useState(function () { - return 3; -}); - -function methodWithAsyncU() { - let $$this = this ; - return async function (arg) { - return $$this + arg | 0; - }; -} - -let get = match$1[0]; - -let set = match$1[1]; - exports.StandardNotation = StandardNotation; exports.methodWithAsync = methodWithAsync; -exports.dd = dd$1; -exports.h = h$1; -exports.M = M$1; -exports.hh = hh$1; -exports.mf = mf$1; -exports.tg = tg$1; -exports.tc = tc$1; -exports.te = te$1; -exports.tcr = tcr$1; -exports.tsiC = tsiC$1; -exports.tsiU = tsiU$1; -exports.get = get; -exports.set = set; -exports.methodWithAsyncU = methodWithAsyncU; /* h Not a pure module */ diff --git a/jscomp/test/UncurriedExternals.res b/jscomp/test/UncurriedExternals.res index baf95a0474..6832b806f3 100644 --- a/jscomp/test/UncurriedExternals.res +++ b/jscomp/test/UncurriedExternals.res @@ -40,45 +40,3 @@ module StandardNotation = { } let methodWithAsync = @this this => async arg => this + arg - -@@uncurried.swap - -external raise: exn => 'a = "%raise" -let dd = (. ()) => raise(Not_found) - -@val external sum: (float, float) => float = "sum" -let h = sum(1.0, 2.0) - -module M: { - let sum: (float, float) => float -} = { - external sum: (float, float) => float = "sum" -} -let hh = M.sum(1.0, 2.0) - -external mod_float: (float, float) => float = "?fmod_float" -let mf = mod_float(3., 4.) - -@get_index external get: (array, int) => option<'a> = "" -let tg = arr => arr->get(0) - -@val external copy: (@as(json`{}`) _, string) => string = "Object.assign" -let tc = copy("abc") - -external toException: exn => exn = "%identity" -let te = toException(Not_found) - -@obj external ucreate: unit => string = "" -let tcr = ucreate() - -type counter -@set external setIncrementC: (. counter, @this (. counter, int) => unit) => unit = "increment" -let tsiC = c => setIncrementC(.c, @this (. me, amount) => Js.log(. me)) -@set external setIncrementU: (counter, @this (counter, int) => unit) => unit = "increment" -let tsiU = c => setIncrementU(c, @this (me, amount) => Js.log(. me)) - -@module("react") -external useState: (@uncurry (unit => 'state)) => ('state, ('state => 'state) => unit) = "useState" -let (get, set) = useState(() => 3) - -let methodWithAsyncU = @this this => async arg => this + arg diff --git a/jscomp/test/async_await.js b/jscomp/test/async_await.js index ae29f57668..bb0aa4890d 100644 --- a/jscomp/test/async_await.js +++ b/jscomp/test/async_await.js @@ -1,26 +1,27 @@ // Generated by ReScript, PLEASE EDIT WITH CARE 'use strict'; +let Curry = require("../../lib/js/curry.js"); let Caml_array = require("../../lib/js/caml_array.js"); function next(n) { return n + 1 | 0; } -async function useNext() { +async function useNext(param) { return 4; } function Make(I) { let get = async function (key) { - return await I.get(key); + return await Curry._1(I.get, key); }; return { get: get }; } -async function topFoo() { +async function topFoo(param) { return 1; } diff --git a/jscomp/test/async_await.res b/jscomp/test/async_await.res index 85aafb08bd..902efc1e5d 100644 --- a/jscomp/test/async_await.res +++ b/jscomp/test/async_await.res @@ -1,5 +1,3 @@ -@@uncurried.swap - let next = n => n + 1 let useNext = async () => next(3) @@ -18,5 +16,5 @@ let toplevelAwait = await topFoo() let toplevelAwait2 = arr[await topFoo()] let f = async (type input, value: input) => { - await Js.Promise.resolve(. 1) + await Js.Promise.resolve(1) } \ No newline at end of file diff --git a/jscomp/test/uncurried_cast.js b/jscomp/test/uncurried_cast.js index 970d0fc8b9..0efea9a2bd 100644 --- a/jscomp/test/uncurried_cast.js +++ b/jscomp/test/uncurried_cast.js @@ -69,7 +69,7 @@ let StandardNotation = { withOpts: withOpts }; -function testRaise$1() { +function testRaise$1(param) { throw new Error(E, { cause: { RE_EXN_ID: E @@ -87,16 +87,14 @@ let l$1 = Belt_List.mapU({ return x + 1 | 0; })); -let partial_arg = { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } -}; - -function partial$1(param) { - return map(partial_arg, param); +function partial$1(extra) { + return Belt_List.mapU({ + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + }, extra); } let ll$1 = partial$1(function (x) { diff --git a/jscomp/test/uncurried_cast.res b/jscomp/test/uncurried_cast.res index 9a5f933be8..03607ce0ba 100644 --- a/jscomp/test/uncurried_cast.res +++ b/jscomp/test/uncurried_cast.res @@ -21,15 +21,14 @@ module StandardNotation = { type unc2 = (. ~z: int=?, int) => int } -@@uncurried.swap open Uncurried let testRaise = () => raise(E) -let l = List.map(list{1, 2}, x => x + 1) -let partial = List.map(. list{1, 2}) -let ll = partial(.x => x + 1) +let l = List.map(list{1, 2}, (. x) => x + 1) +let partial = List.map(. list{1, 2}, ...) +let ll = partial(. ((. x) => x + 1)) let withOpts = (~x=3, y, ~z=4, w) => x + y + z + w type unc2 = (~z: int=?, int) => int diff --git a/jscomp/test/uncurried_default.args.js b/jscomp/test/uncurried_default.args.js index 6396c663d6..53cdab10e5 100644 --- a/jscomp/test/uncurried_default.args.js +++ b/jscomp/test/uncurried_default.args.js @@ -55,51 +55,45 @@ let StandardNotation = { r3: r3 }; -function withOpt$1(xOpt, y) { +function withOpt$1(xOpt, y, zOpt, w) { let x = xOpt !== undefined ? xOpt : 1; - return function (zOpt, w) { - let z = zOpt !== undefined ? zOpt : 1; - return ((x + y | 0) + z | 0) + w | 0; - }; + let z = zOpt !== undefined ? zOpt : 1; + return ((x + y | 0) + z | 0) + w | 0; } -let testWithOpt$1 = withOpt$1(undefined, 3)(undefined, 4); - -let partial_arg = 10; +let testWithOpt$1 = withOpt$1(undefined, 3, undefined, 4); -let partial$1 = Curry._1((function (param) { - return withOpt$1(partial_arg, param); -})(3), 4)(11); +let partial$1 = withOpt$1(10, 3, 4, 11); -let total$1 = withOpt$1(10, 3)(4, 11); +let total$1 = withOpt$1(10, 3, 4, 11); function foo1$1(xOpt, y) { let x = xOpt !== undefined ? xOpt : 3; return x + y | 0; } -let x$1 = 3; - -let r1$1 = x$1 + 11 | 0; +function r1$1(param) { + return foo1$1(param, 11); +} -function foo2$1(y, xOpt, zOpt) { +function foo2$1(y, xOpt, zOpt, param) { let x = xOpt !== undefined ? xOpt : 3; let z = zOpt !== undefined ? zOpt : 4; return (x + y | 0) + z | 0; } -let r2$1 = foo2$1(11, undefined, undefined); +function r2$1(param, param$1, param$2) { + return foo2$1(11, param, param$1, param$2); +} -function foo3$1(xOpt, yOpt) { +function foo3$1(xOpt, yOpt, param) { let x = xOpt !== undefined ? xOpt : 3; let y = yOpt !== undefined ? yOpt : 4; return x + y | 0; } -let r3$1 = foo3$1(undefined, undefined); - function foo(func) { - return func() + 1 | 0; + return Curry._1(func, undefined) + 1 | 0; } let M = { @@ -116,6 +110,5 @@ exports.r1 = r1$1; exports.foo2 = foo2$1; exports.r2 = r2$1; exports.foo3 = foo3$1; -exports.r3 = r3$1; exports.M = M; /* testWithOpt Not a pure module */ diff --git a/jscomp/test/uncurried_default.args.res b/jscomp/test/uncurried_default.args.res index 242b4214ec..1541af0e6b 100644 --- a/jscomp/test/uncurried_default.args.res +++ b/jscomp/test/uncurried_default.args.res @@ -14,23 +14,20 @@ module StandardNotation = { let r3 = foo3(. ) } -@@uncurried.swap - open StandardNotation let withOpt = (~x=1, y) => (~z=1, w) => x+y+z+w let testWithOpt = withOpt(3)(4) -let partial = withOpt(. ~x=10)(. 3)(. ~z=4)(. 11) +let partial = withOpt(~x=10)(3)(~z=4)(11) let total = withOpt(~x=10, 3)(~z=4, 11) let foo1 = (~x=3, ~y) => x+y let r1 = foo1(~y=11) -let foo2 = (~y, ~x=3, ~z=4) => x+y+z +let foo2 = (~y, ~x=3, ~z=4, ()) => x+y+z let r2 = foo2(~y=11) -let foo3 = (~x=3, ~y=4) => x+y -let r3 = foo3() +let foo3 = (~x=3, ~y=4, ()) => x+y module M: { let foo: (unit => int) => int diff --git a/jscomp/test/uncurried_pipe.res b/jscomp/test/uncurried_pipe.res index 3bc4f179b9..e35b054a00 100644 --- a/jscomp/test/uncurried_pipe.res +++ b/jscomp/test/uncurried_pipe.res @@ -10,13 +10,11 @@ module StandardNotation = { let unary = (. x) => x + 1 } -@@uncurried.swap - open StandardNotation let v7 = 3->add(4) let v17 = 10->add(3->add(4)) -let v27 = 20->add(3->addC(. 4)) -let v37 = 30->addC(. 3->add(4)) +let v27 = 20->add(3->addC(4)) +let v37 = 30->addC(3->add(4)) let v100 = 99->unary