diff --git a/jscomp/test/AsInUncurriedExternals.res b/jscomp/test/AsInUncurriedExternals.res index d50cad8fef..97ec319375 100644 --- a/jscomp/test/AsInUncurriedExternals.res +++ b/jscomp/test/AsInUncurriedExternals.res @@ -12,5 +12,4 @@ let mo = makeOptions let options = mo(~name="foo", ()) -let shouldNotFail: (~objectMode: _, ~name: string) => int = (~objectMode, ~name) => - 3 +let shouldNotFail: (~objectMode: _, ~name: string) => int = (~objectMode, ~name) => 3 diff --git a/jscomp/test/Coercion.res b/jscomp/test/Coercion.res index d7c89f7b54..89bf168491 100644 --- a/jscomp/test/Coercion.res +++ b/jscomp/test/Coercion.res @@ -2,10 +2,10 @@ let x = 1 let xx = (x :> float) -type r1 = {x:int} -type r2 = {x:int} +type r1 = {x: int} +type r2 = {x: int} type t1 = array type t2 = array -let foo = (x: t1) => { x :> t2 } +let foo = (x: t1) => {(x :> t2)} diff --git a/jscomp/test/DerivingAccessorsCurried.res b/jscomp/test/DerivingAccessorsCurried.res index 80ff7ef476..70a0312b15 100644 --- a/jscomp/test/DerivingAccessorsCurried.res +++ b/jscomp/test/DerivingAccessorsCurried.res @@ -2,10 +2,10 @@ //In curried mode @deriving(accessors) -type myRecord = { myField: int } +type myRecord = {myField: int} @deriving(accessors) -type variant = | NoParam | Num(int) | DoubleNum(int, int) +type variant = NoParam | Num(int) | DoubleNum(int, int) //Asserts the correct signature for derived accessor let _myFieldAlias: myRecord => int = myField @@ -16,6 +16,5 @@ let _doubleNumAlias: (int, int) => variant = doubleNum //Asserts that inference works when composing //with derived functions let compose = (a, accessor) => accessor(a) -let _composedMyField = compose({ myField: 1 }, myField) +let _composedMyField = compose({myField: 1}, myField) let _composedNum = compose(1, num) - diff --git a/jscomp/test/DerivingAccessorsUncurried.res b/jscomp/test/DerivingAccessorsUncurried.res index 130f82c32d..b80b5b1b3e 100644 --- a/jscomp/test/DerivingAccessorsUncurried.res +++ b/jscomp/test/DerivingAccessorsUncurried.res @@ -3,10 +3,10 @@ @@uncurried @deriving(accessors) -type myRecord = { myField: int } +type myRecord = {myField: int} @deriving(accessors) -type variant = | NoParam | Num(int) | DoubleNum(int, int) +type variant = NoParam | Num(int) | DoubleNum(int, int) //Asserts the correct signature for derived accessor let _myFieldAlias: myRecord => int = myField @@ -17,6 +17,5 @@ let _doubleNumAlias: (int, int) => variant = doubleNum //Asserts that inference works when composing //with derived functions let compose = (a, accessor) => accessor(a) -let _composedMyField = compose({ myField: 1 }, myField) +let _composedMyField = compose({myField: 1}, myField) let _composedNum = compose(1, num) - diff --git a/jscomp/test/DisambiguateOptionalFields.res b/jscomp/test/DisambiguateOptionalFields.res index 8a4b6e7031..f3563dab36 100644 --- a/jscomp/test/DisambiguateOptionalFields.res +++ b/jscomp/test/DisambiguateOptionalFields.res @@ -1,8 +1,8 @@ -type t1 = {x:int, y:int} -type t2 = {x:int, y:int, z?:int} +type t1 = {x: int, y: int} +type t2 = {x: int, y: int, z?: int} -let f1 = (v:t1) => v.x -let f2 = (v:t2) => v.x +let f1 = (v: t1) => v.x +let f2 = (v: t2) => v.x -let v = {x:3, y:4} +let v = {x: 3, y: 4} let res = f2(v) // Check that t2 shadows t1 diff --git a/jscomp/test/EmptyRecord.res b/jscomp/test/EmptyRecord.res index 3d9396176c..f1bb9ac869 100644 --- a/jscomp/test/EmptyRecord.res +++ b/jscomp/test/EmptyRecord.res @@ -1,10 +1,10 @@ -type allOptRec = {n?: int, s?:string} +type allOptRec = {n?: int, s?: string} -let construct = (b) => b ? {n:0} : {} +let construct = b => b ? {n: 0} : {} // let z = {} // Error: Empty record literal {} should be type annotated or used in a record context. type emptyrec = {} -let er : emptyrec = {} \ No newline at end of file +let er: emptyrec = {} diff --git a/jscomp/test/Import.res b/jscomp/test/Import.res index 5b8097bf64..9cfd032fe8 100644 --- a/jscomp/test/Import.res +++ b/jscomp/test/Import.res @@ -3,7 +3,7 @@ let eachIntAsync = async (list: list, f: int => unit) => { } let eachIntLazy = (list: list, f: int => unit) => - Js.import(Belt.List.forEach) |> Js.Promise.then_(each => list->each(f)->Js.Promise.resolve) + Js.Promise.then_(each => list->each(f)->Js.Promise.resolve, Js.import(Belt.List.forEach)) let _ = list{1, 2, 3}->eachIntLazy(n => Js.log2("lazy", n)) let _ = list{1, 2, 3}->eachIntAsync(n => Js.log2("async", n)) diff --git a/jscomp/test/RecordOrObject.res b/jscomp/test/RecordOrObject.res index 24de115ecc..cb4ea68a34 100644 --- a/jscomp/test/RecordOrObject.res +++ b/jscomp/test/RecordOrObject.res @@ -1,10 +1,10 @@ type rx = {x: int} type ry = {y: string} -type rxi = {...rx, i?:int} +type rxi = {...rx, i?: int} type rxy = {...rx, ...ry} // this is a record let vxy: rxy = {x: 10, y: "abc"} -let xxi : rxi = {x:10} +let xxi: rxi = {x: 10} type ox = {"x": int} type oy = {"y": int} diff --git a/jscomp/test/SafePromises.res b/jscomp/test/SafePromises.res index 8b18ca8f80..091adf475d 100644 --- a/jscomp/test/SafePromises.res +++ b/jscomp/test/SafePromises.res @@ -3,17 +3,17 @@ let nestedPromise = async (xxx: promise>) => { let xx = await xxx - let _ = xx->Js.Promise2.then(x => Js.log2("Promise2.then", x) |> Js.Promise.resolve) + let _ = xx->Js.Promise2.then(x => Js.Promise.resolve(Js.log2("Promise2.then", x))) let _ = xx->Js.Promise2.catch(x => { Js.log2("Promise2.catch_", x) - 0 |> Js.Promise.resolve + Js.Promise.resolve(0) }) // This crashes - let _ = Js.Promise.then_(x => Js.log2("Promise.then_", x) |> Js.Promise.resolve, xx) + let _ = Js.Promise.then_(x => Js.Promise.resolve(Js.log2("Promise.then_", x)), xx) } -let create = async (x) => { +let create = async x => { Js.log2("create", x) x } diff --git a/jscomp/test/UncurriedAlways.res b/jscomp/test/UncurriedAlways.res index c4bb430a9b..b4ababc7f0 100644 --- a/jscomp/test/UncurriedAlways.res +++ b/jscomp/test/UncurriedAlways.res @@ -2,21 +2,21 @@ let foo = (x, y) => x + y -let z = foo(. 3, 4) +let z = foo(3, 4) -let bar = (. x, y) => x + y +let bar = (x, y) => x + y let b = bar(3, 4) let w = 3->foo(4) -let a = 3->foo(. 4) +let a = 3->foo(4) Js.log(a) // Test automatic uncurried application -let _ = Js.Array2.map([1], (. x) => x + 1) +let _ = Js.Array2.map([1], x => x + 1) -let ptl = @res.partial foo(10) // force partial application +let ptl = foo(10, ...) // force partial application let foo2 = (x, y) => x + y let bar2: _ => _ = foo2(_, 3) @@ -31,7 +31,7 @@ let q: cmp = _ => Jsx.null // Check that subtyping works past type definitions let inl = () => () @inline -let inl2 = (x,y) => x+y +let inl2 = (x, y) => x + y module AllLabels = { let foo = (~x, ~y, ~z) => (x, y, z) @@ -54,7 +54,17 @@ module OptAtEnd = { } module OptMixed = { - let foo = (~d1="d1=0", ~x, ~d2="d2=0", ~y, ~d3="d3=0", ~z, ~d4="d4=0", ~w, ~d5="d5=0") => (d1, x, d2, y, d3, z, d4, w, d5) + let foo = (~d1="d1=0", ~x, ~d2="d2=0", ~y, ~d3="d3=0", ~z, ~d4="d4=0", ~w, ~d5="d5=0") => ( + d1, + x, + d2, + y, + d3, + z, + d4, + w, + d5, + ) let ptl = foo(~y="y", ~w="w", ...) @@ -72,7 +82,7 @@ let fn = cb => { fn(s => Js.log(#foo(s))) -let fn1 = (a, b, ()) => a() + b +let fn1 = (a, b, ()) => a() + b let a = fn1(() => 1, 2, _) @@ -93,7 +103,7 @@ module PartialApplication = { module ReverseApplication = { let hello1 = (y, f) => f(y) - let hello2 = (y, f) => y |> f + let hello2 = (y, f) => f(y) } module Pipe = { @@ -104,4 +114,4 @@ module Pipe = { let f3 = (foo, x) => foo(x) let f4 = (x, f) => x->f(3) -} \ No newline at end of file +} diff --git a/jscomp/test/UncurriedExternals.res b/jscomp/test/UncurriedExternals.res index 42feca6bc1..688c67b1dd 100644 --- a/jscomp/test/UncurriedExternals.res +++ b/jscomp/test/UncurriedExternals.res @@ -1,41 +1,40 @@ module StandardNotation = { - external raise: (. exn) => 'a = "%raise" - let dd = () => raise(. Not_found) + external raise: exn => 'a = "%raise" + let dd = () => raise(Not_found) - @val external sum: (. float, float) => float = "sum" - let h = sum(. 1.0, 2.0) + @val external sum: (float, float) => float = "sum" + let h = sum(1.0, 2.0) module M: { - let sum: (. float, float) => float + let sum: (float, float) => float } = { - external sum: (. float, float) => float = "sum" + external sum: (float, float) => float = "sum" } - let hh = M.sum(. 1.0, 2.0) + let hh = M.sum(1.0, 2.0) - external mod_float: (. float, float) => float = "?fmod_float" - let mf = mod_float(. 3., 4.) + 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) + @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") + @val external copy: (@as(json`{}`) _, string) => string = "Object.assign" + let tc = copy("abc") - external toException: (. exn) => exn = "%identity" - let te = toException(. Not_found) + external toException: exn => exn = "%identity" + let te = toException(Not_found) - @obj external ccreate: (. unit) => string = "" - let tcr = ccreate(.) + @obj external ccreate: unit => string = "" + let tcr = ccreate() 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)) + @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: ((unit => 'state)) => ('state, ('state => 'state) => unit) = - "useState" + external useState: (unit => 'state) => ('state, ('state => 'state) => unit) = "useState" let (get, set) = useState(() => 3) } diff --git a/jscomp/test/UncurriedPervasives.res b/jscomp/test/UncurriedPervasives.res index 5edc7ad770..4c4db42d70 100644 --- a/jscomp/test/UncurriedPervasives.res +++ b/jscomp/test/UncurriedPervasives.res @@ -1,2 +1,2 @@ @@uncurried -let n : _ => unit = ignore // Check that we're pulling in uncurried pervasives +let n: _ => unit = ignore // Check that we're pulling in uncurried pervasives diff --git a/jscomp/test/UntaggedVariants.res b/jscomp/test/UntaggedVariants.res index 855952a20f..3972053a72 100644 --- a/jscomp/test/UntaggedVariants.res +++ b/jscomp/test/UntaggedVariants.res @@ -296,16 +296,16 @@ module OptionUnboxingHeuristic = { module TestFunctionCase = { @unboxed - type t = Array(array) | Record({x: int}) | Function((. int) => int) + type t = Array(array) | Record({x: int}) | Function(int => int) let classify = v => switch v { | Record({x}) => x | Array(a) => a[0] - | Function(f) => f(. 3) + | Function(f) => f(3) } - let ff = Function((. x) => x + 1) + let ff = Function(x => x + 1) } module ComplexPattern = { @@ -416,14 +416,14 @@ module AllInstanceofTypes = { module Aliased = { type dict = Js.Dict.t - type fn = (. unit) => option + type fn = unit => option @unboxed type t = Object(dict) | String(string) | Function(fn) let test = (t: t) => { switch t { | Object(d) => d->Js.Dict.get("Hello") | String(s) => Some(s) - | Function(fn) => fn(.) + | Function(fn) => fn() } } } diff --git a/jscomp/test/VariantSpreads.res b/jscomp/test/VariantSpreads.res index 13e47fcf46..467e3db3ea 100644 --- a/jscomp/test/VariantSpreads.res +++ b/jscomp/test/VariantSpreads.res @@ -1,6 +1,6 @@ module S = { - type x = Foo | Bar - type s = Five(int) | Six + type x = Foo | Bar + type s = Five(int) | Six } type a = One(bool, S.x) | Two @@ -17,4 +17,4 @@ let ddd: b = Six type f = One({name: string, age?: int}) | Two type q = | ...f | Three -let q: q = One({name: "hello"}) \ No newline at end of file +let q: q = One({name: "hello"}) diff --git a/jscomp/test/a_filename_test.res b/jscomp/test/a_filename_test.res index 5d78f0588d..d1d7452cc9 100644 --- a/jscomp/test/a_filename_test.res +++ b/jscomp/test/a_filename_test.res @@ -9,7 +9,7 @@ let eq = (loc, x, y) => { list{(loc ++ (" id " ++ string_of_int(test_id.contents)), _ => Mt.Eq(x, y)), ...suites.contents} } -let test = (x,y) => Ext_filename_test.node_relative_path(true, x, y) +let test = (x, y) => Ext_filename_test.node_relative_path(true, x, y) let () = /* TODO: adapt these tests to run on Windows. */ if platform !== #win32 { eq( diff --git a/jscomp/test/alias_default_value_test.res b/jscomp/test/alias_default_value_test.res index 5bdeda0728..6d8fce486b 100644 --- a/jscomp/test/alias_default_value_test.res +++ b/jscomp/test/alias_default_value_test.res @@ -35,7 +35,7 @@ module C4 = { module C6 = { module type Comp = { - let xx : int + let xx: int @react.component let make: unit => React.element } diff --git a/jscomp/test/argv_test.res b/jscomp/test/argv_test.res index 2122b07def..37455729be 100644 --- a/jscomp/test/argv_test.res +++ b/jscomp/test/argv_test.res @@ -11,6 +11,6 @@ let arg_spec = { Arg.parse_argv(["prog.exe", "-c", "-d"], arg_spec, anno_fun, usage_msg) { - assert (compile.contents == true) - assert (test.contents == false) + assert(compile.contents == true) + assert(test.contents == false) } diff --git a/jscomp/test/ari_regress_test.res b/jscomp/test/ari_regress_test.res index d90eec871e..c912469ccd 100644 --- a/jscomp/test/ari_regress_test.res +++ b/jscomp/test/ari_regress_test.res @@ -26,7 +26,7 @@ let suites = { _ => Eq( 14, { - v(1) |> ignore + ignore(v(1)) v(1) }, ), diff --git a/jscomp/test/arith_lexer.res b/jscomp/test/arith_lexer.res index 6fdcdbf221..12ccee33d6 100644 --- a/jscomp/test/arith_lexer.res +++ b/jscomp/test/arith_lexer.res @@ -1,110 +1,110 @@ open Arith_parser let __ocaml_lex_tables = { - Lexing.lex_base: "\000\000\246\255\247\255\248\255\249\255\250\255\251\255\252\255\ - \058\000\133\000\255\255", - Lexing.lex_backtrk: "\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \002\000\001\000\255\255", - Lexing.lex_default: "\255\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \255\255\255\255\000\000", - Lexing.lex_trans: "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\010\000\010\000\000\000\000\000\010\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \003\000\002\000\005\000\007\000\000\000\006\000\000\000\004\000\ - \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\ - \009\000\009\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\009\000\009\000\009\000\ - \009\000\009\000\009\000\009\000\009\000\009\000\009\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000", - Lexing.lex_check: "\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\000\000\000\000\255\255\255\255\000\000\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \000\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \000\000\000\000\000\000\000\000\255\255\000\000\255\255\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\255\255\255\255\255\255\255\255\255\255\ - \255\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\255\255\255\255\255\255\ - \255\255\255\255\255\255\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\009\000\009\000\009\000\ - \009\000\009\000\009\000\009\000\009\000\009\000\009\000\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \000\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255", + Lexing.lex_base: "\x00\x00\xf6\xff\xf7\xff\xf8\xff\xf9\xff\xfa\xff\xfb\xff\xfc\xff\ + \x3a\x00\x85\x00\xff\xff", + Lexing.lex_backtrk: "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \x02\x00\x01\x00\xff\xff", + Lexing.lex_default: "\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \xff\xff\xff\xff\x00\x00", + Lexing.lex_trans: "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x0a\x00\x0a\x00\x00\x00\x00\x00\x0a\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x03\x00\x02\x00\x05\x00\x07\x00\x00\x00\x06\x00\x00\x00\x04\x00\ + \x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\ + \x09\x00\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x09\x00\x09\x00\x09\x00\ + \x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + Lexing.lex_check: "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x09\x00\x09\x00\x09\x00\ + \x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", Lexing.lex_base_code: "", Lexing.lex_backtrk_code: "", Lexing.lex_default_code: "", diff --git a/jscomp/test/arith_parser.res b/jscomp/test/arith_parser.res index aaa9d8288a..0e051be8aa 100644 --- a/jscomp/test/arith_parser.res +++ b/jscomp/test/arith_parser.res @@ -28,122 +28,122 @@ let yytransl_const = [ let yytransl_block = [257 /* NUMERAL */, 258 /* IDENT */, 0] -let yylhs = "\255\255\ -\001\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\ -\002\000\000\000" +let yylhs = "\xff\xff\ +\x01\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\ +\x02\x00\x00\x00" -let yylen = "\002\000\ -\002\000\001\000\001\000\003\000\003\000\003\000\003\000\002\000\ -\003\000\002\000" +let yylen = "\x02\x00\ +\x02\x00\x01\x00\x01\x00\x03\x00\x03\x00\x03\x00\x03\x00\x02\x00\ +\x03\x00\x02\x00" -let yydefred = "\000\000\ -\000\000\000\000\002\000\003\000\000\000\000\000\010\000\000\000\ -\008\000\000\000\000\000\000\000\000\000\000\000\001\000\009\000\ -\000\000\000\000\006\000\007\000" +let yydefred = "\x00\x00\ +\x00\x00\x00\x00\x02\x00\x03\x00\x00\x00\x00\x00\x0a\x00\x00\x00\ +\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x09\x00\ +\x00\x00\x00\x00\x06\x00\x07\x00" -let yydgoto = "\002\000\ -\007\000\008\000" +let yydgoto = "\x02\x00\ +\x07\x00\x08\x00" -let yysindex = "\255\255\ -\016\255\000\000\000\000\000\000\016\255\016\255\000\000\010\000\ -\000\000\022\255\016\255\016\255\016\255\016\255\000\000\000\000\ -\255\254\255\254\000\000\000\000" +let yysindex = "\xff\xff\ +\x10\xff\x00\x00\x00\x00\x00\x00\x10\xff\x10\xff\x00\x00\x0a\x00\ +\x00\x00\x16\xff\x10\xff\x10\xff\x10\xff\x10\xff\x00\x00\x00\x00\ +\xff\xfe\xff\xfe\x00\x00\x00\x00" -let yyrindex = "\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\001\000\003\000\000\000\000\000" +let yyrindex = "\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x01\x00\x03\x00\x00\x00\x00\x00" -let yygindex = "\000\000\ -\000\000\002\000" +let yygindex = "\x00\x00\ +\x00\x00\x02\x00" let yytablesize = 272 -let yytable = "\001\000\ -\004\000\000\000\005\000\013\000\014\000\000\000\009\000\010\000\ -\000\000\015\000\000\000\000\000\017\000\018\000\019\000\020\000\ -\003\000\004\000\000\000\005\000\000\000\000\000\000\000\006\000\ -\011\000\012\000\013\000\014\000\000\000\000\000\016\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\004\000\004\000\005\000\005\000\000\000\ -\000\000\004\000\000\000\005\000\011\000\012\000\013\000\014\000" +let yytable = "\x01\x00\ +\x04\x00\x00\x00\x05\x00\x0d\x00\x0e\x00\x00\x00\x09\x00\x0a\x00\ +\x00\x00\x0f\x00\x00\x00\x00\x00\x11\x00\x12\x00\x13\x00\x14\x00\ +\x03\x00\x04\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x06\x00\ +\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x00\x00\x00\x00\x10\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x04\x00\x04\x00\x05\x00\x05\x00\x00\x00\ +\x00\x00\x04\x00\x00\x00\x05\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00" -let yycheck = "\001\000\ -\000\000\255\255\000\000\005\001\006\001\255\255\005\000\006\000\ -\255\255\000\000\255\255\255\255\011\000\012\000\013\000\014\000\ -\001\001\002\001\255\255\004\001\255\255\255\255\255\255\008\001\ -\003\001\004\001\005\001\006\001\255\255\255\255\009\001\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ -\255\255\255\255\255\255\003\001\004\001\003\001\004\001\255\255\ -\255\255\009\001\255\255\009\001\003\001\004\001\005\001\006\001" +let yycheck = "\x01\x00\ +\x00\x00\xff\xff\x00\x00\x05\x01\x06\x01\xff\xff\x05\x00\x06\x00\ +\xff\xff\x00\x00\xff\xff\xff\xff\x0b\x00\x0c\x00\x0d\x00\x0e\x00\ +\x01\x01\x02\x01\xff\xff\x04\x01\xff\xff\xff\xff\xff\xff\x08\x01\ +\x03\x01\x04\x01\x05\x01\x06\x01\xff\xff\xff\xff\x09\x01\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ +\xff\xff\xff\xff\xff\xff\x03\x01\x04\x01\x03\x01\x04\x01\xff\xff\ +\xff\xff\x09\x01\xff\xff\x09\x01\x03\x01\x04\x01\x05\x01\x06\x01" let yynames_const = "\ - PLUS\000\ - MINUS\000\ - TIMES\000\ - DIVIDE\000\ - UMINUS\000\ - LPAREN\000\ - RPAREN\000\ - EOF\000\ + PLUS\x00\ + MINUS\x00\ + TIMES\x00\ + DIVIDE\x00\ + UMINUS\x00\ + LPAREN\x00\ + RPAREN\x00\ + EOF\x00\ " let yynames_block = "\ - NUMERAL\000\ - IDENT\000\ + NUMERAL\x00\ + IDENT\x00\ " let yyact = [ diff --git a/jscomp/test/arith_syntax.res b/jscomp/test/arith_syntax.res index 0a5820d9c8..fbb77f3ea7 100644 --- a/jscomp/test/arith_syntax.res +++ b/jscomp/test/arith_syntax.res @@ -1,10 +1,10 @@ type rec expression = | /** non-negative integer constant */ Numeral(float) - | /** Addition [e1 + e2] */ Plus(expression, expression) - | /** Difference [e1 - e2] */ Minus(expression, expression) - | /** Product [e1 * e2] */ Times(expression, expression) - | /** Quotient [e1 / e2] */ Divide(expression, expression) - | /** Opposite value [-e] */ Negate(expression) + | /** Addition [e1 + e2] */ Plus(expression, expression) + | /** Difference [e1 - e2] */ Minus(expression, expression) + | /** Product [e1 * e2] */ Times(expression, expression) + | /** Quotient [e1 / e2] */ Divide(expression, expression) + | /** Opposite value [-e] */ Negate(expression) | Variable(string) let rec str = e => diff --git a/jscomp/test/arity.res b/jscomp/test/arity.res index 18f818e1a1..09e4abfbc5 100644 --- a/jscomp/test/arity.res +++ b/jscomp/test/arity.res @@ -1,8 +1,8 @@ -type t = (. ~x: int, ~y: int) => int +type t = (~x: int, ~y: int) => int -let u = (. ~f: t, a, b) => { - f(. ~x=a, ~y=b)->Js.log - f(. ~y=b, ~x=a)->Js.log +let u = (~f: t, a, b) => { + f(~x=a, ~y=b)->Js.log + f(~y=b, ~x=a)->Js.log } type t0 = (~x: int, ~y: int) => int @@ -12,7 +12,7 @@ let u2 = (~f: t0, a, b) => { f(~y=b, ~x=a)->Js.log } -let f = (. ~x, y) => x + y +let f = (~x, y) => x + y let add = \"+" // let u = f(.3,~x=2,1); // This function has arity2 but was expected arity3 @@ -32,7 +32,7 @@ let // This function has arity2 but was expected arity3 // This function is applied to arguments -- weird message h = u => { let m = u["hi"] - m(. 1, 2) + m(1, 2) } // diff --git a/jscomp/test/arity_deopt.res b/jscomp/test/arity_deopt.res index c7e214365a..c0f6dcb5ca 100644 --- a/jscomp/test/arity_deopt.res +++ b/jscomp/test/arity_deopt.res @@ -22,31 +22,31 @@ let eq = (loc, x, y) => { /* let@z z = f x y in */ /* return (x + y + z ) */ -let f0 = (. x, y, z) => x + y + z +let f0 = (x, y, z) => x + y + z /* catch up. In OCaml we can not tell the difference from below {[ let f = fun [@bs] x y z -> x + y + z ]} */ -let f1 = x => (. y, z) => x + y + z +let f1 = x => (y, z) => x + y + z -let f2 = (. x, y) => { +let f2 = (x, y) => { let a = x z => a + y + z } let f3 = x => { let a = x - (. y, z) => a + y + z + (y, z) => a + y + z } /* be careful! When you start optimize functions of [@bs], its call site invariant (Ml_app) will not hold any more. So the best is never shrink functons which could change arity */ let () = { - \"@@"(eq(__LOC__, 6, ...), f0(. 1, 2, 3)) - \"@@"(eq(__LOC__, 6, ...), f1(1)(. 2, 3)) - \"@@"(eq(__LOC__, 6, ...), f2(. 1, 2)(3)) - \"@@"(eq(__LOC__, 6, ...), f3(1)(. 2, 3)) + \"@@"(eq(__LOC__, 6, ...), f0(1, 2, 3)) + \"@@"(eq(__LOC__, 6, ...), f1(1)(2, 3)) + \"@@"(eq(__LOC__, 6, ...), f2(1, 2)(3)) + \"@@"(eq(__LOC__, 6, ...), f3(1)(2, 3)) } let () = Mt.from_pair_suites(__MODULE__, suites.contents) diff --git a/jscomp/test/as_inline_record_test.res b/jscomp/test/as_inline_record_test.res index c5cb51648a..5f5056a9be 100644 --- a/jscomp/test/as_inline_record_test.res +++ b/jscomp/test/as_inline_record_test.res @@ -17,12 +17,12 @@ let getName' = t => | User(u) => u.name } -let getAge = t => +let getAge = t => switch t { | User({age}) => age } -let getAge' = t => +let getAge' = t => switch t { | User(u) => u.age - } \ No newline at end of file + } diff --git a/jscomp/test/async_await.res b/jscomp/test/async_await.res index 902efc1e5d..fa6a1f6d67 100644 --- a/jscomp/test/async_await.res +++ b/jscomp/test/async_await.res @@ -6,7 +6,7 @@ module type Impl = { } module Make = (I: Impl) => { - let get = async (key) => await I.get(key) + let get = async key => await I.get(key) } let topFoo = async () => 1 @@ -17,4 +17,4 @@ let toplevelAwait2 = arr[await topFoo()] let f = async (type input, value: input) => { await Js.Promise.resolve(1) -} \ No newline at end of file +} diff --git a/jscomp/test/async_inline.res b/jscomp/test/async_inline.res index 4572961ff1..9e489e8928 100644 --- a/jscomp/test/async_inline.res +++ b/jscomp/test/async_inline.res @@ -1,10 +1,10 @@ let willBeInlined = async () => 3 -let inlined = willBeInlined () +let inlined = willBeInlined() let wrapSomethingAsync: unit => unit = () => { let _ = ( - async (_) => { + async _ => { let test = await Js.Promise.resolve("Test") Js.log(test) } @@ -24,14 +24,14 @@ let wrapSomethingAsync2 = () => module M: { let broken: (unit => promise<'a>) => promise<'a> } = { - let doSomethingAsync = async (someAsyncFunction) => { + let doSomethingAsync = async someAsyncFunction => { await someAsyncFunction() } let broken = someAsyncFunction => doSomethingAsync(someAsyncFunction) } -let broken = async (someAsyncFunction) => { +let broken = async someAsyncFunction => { await someAsyncFunction() } @@ -39,22 +39,22 @@ let broken = someAsyncFunction => broken(someAsyncFunction) let curriedId = x => x let curriedIdAsync = async x => x -let uncurriedId = (.x ) => x -let uncurriedIdAsync = async (.x ) => x +let uncurriedId = x => x +let uncurriedIdAsync = async x => x let tci = curriedId(3) let tcia = curriedIdAsync(3) -let tui = uncurriedId(. 3) -let tuia = uncurriedIdAsync(. 3) +let tui = uncurriedId(3) +let tuia = uncurriedIdAsync(3) -let nested1 = () => async (y) => await y +let nested1 = () => async y => await y -let nested2 = async () => async (y) => await y +let nested2 = async () => async y => await y type callback<'input, 'output> = 'input => 'output @module("react") -external useCallback: (('input => 'output)) => callback<'input, 'output> = "useCallback" +external useCallback: ('input => 'output) => callback<'input, 'output> = "useCallback" let onSubmit = () => useCallback(async b => { diff --git a/jscomp/test/attr_test.res b/jscomp/test/attr_test.res index ea4ac21b1b..957191cb0d 100644 --- a/jscomp/test/attr_test.res +++ b/jscomp/test/attr_test.res @@ -1,21 +1,19 @@ -let u = (. x, y) => x + y +let u = (x, y) => x + y -let h = u(. 1, 2) +let h = u(1, 2) type u = {"v": int, "y": int} -type xx<'a, 'b> = {.."case": (. int) => (. int) => 'a} as 'b +type xx<'a, 'b> = {.."case": int => int => 'a} as 'b type xx_uncurry<'a, 'b> = {.."case": (int, int) => 'a} as 'b type yy_uncurry = {"x": int} type yy = {"x": int} type number = float +let max2: (float, float) => float = (x, y) => x +. y +let hh = max2(1., 2.) -let max2: (. float, float) => float = (. x, y) => x +. y - -let hh = max2(. 1., 2.) - -@val external des: (string, (unit => unit)) => unit = "des" +@val external des: (string, unit => unit) => unit = "des" let f = x => des(x, () => Js.log("hei")) diff --git a/jscomp/test/belt_hashmap_ntest.res b/jscomp/test/belt_hashmap_ntest.res index c240a089ef..440f9bfaf5 100644 --- a/jscomp/test/belt_hashmap_ntest.res +++ b/jscomp/test/belt_hashmap_ntest.res @@ -43,4 +43,4 @@ describe("Belt.HashMap", () => { eq(__LOC__, N.size(v), 98_000) ok(__LOC__, A.every(I.range(2_001, 100_000), x => N.has(v, x))) }) -}) \ No newline at end of file +}) diff --git a/jscomp/test/belt_list_ntest.res b/jscomp/test/belt_list_ntest.res index 94dd4cc5d0..d95bbdc9ab 100644 --- a/jscomp/test/belt_list_ntest.res +++ b/jscomp/test/belt_list_ntest.res @@ -32,7 +32,7 @@ describe("Belt.List", () => { test("flatten", () => { eq( __LOC__, - N.flatten(list{list{1}, list{2}, list{3}, list{}, N.makeBy(4, i => i)}) , + N.flatten(list{list{1}, list{2}, list{3}, list{}, N.makeBy(4, i => i)}), list{1, 2, 3, 0, 1, 2, 3}, ) eq(__LOC__, N.flatten(list{}), list{}) @@ -47,7 +47,11 @@ describe("Belt.List", () => { ) eq(__LOC__, N.concatMany([]), list{}) eq(__LOC__, N.concatMany([list{}, list{}, list{2}, list{1}, list{2}, list{}]), list{2, 1, 2}) - eq(__LOC__, N.concatMany([list{}, list{}, list{2, 3}, list{1}, list{2}, list{}]), list{2, 3, 1, 2}) + eq( + __LOC__, + N.concatMany([list{}, list{}, list{2, 3}, list{1}, list{2}, list{}]), + list{2, 3, 1, 2}, + ) eq(__LOC__, N.concatMany([list{1, 2, 3}]), list{1, 2, 3}) }) @@ -55,13 +59,13 @@ describe("Belt.List", () => { eq( __LOC__, N.concat(N.makeBy(100, i => i), N.makeBy(100, i => i))->N.toArray, - A.concat(A.makeBy(100, i => i), A.makeBy(100, i => i)) + A.concat(A.makeBy(100, i => i), A.makeBy(100, i => i)), ) eq(__LOC__, N.concat(list{1}, list{}), list{1}) eq(__LOC__, N.concat(list{}, list{1}), list{1}) }) - + test("zip", () => { eq(__LOC__, N.zip(list{1, 2, 3}, list{3, 4}), list{(1, 3), (2, 4)}) eq(__LOC__, N.zip(list{}, list{1}), list{}) @@ -121,16 +125,13 @@ describe("Belt.List", () => { eq(__LOC__, map2_add(list{}, list{1}), list{}) eq(__LOC__, map2_add(list{1}, list{}), list{}) eq(__LOC__, map2_add(list{}, list{}), list{}) + eq(__LOC__, map2_add(length_10_id, b), N.concat(N.map(c, x => x * 2), list{16, 18})) + eq(__LOC__, map2_add(length_10_id, length_8_id), N.mapWithIndex(length_8_id, (i, x) => i + x)) eq( - __LOC__, - map2_add(length_10_id, b), - N.concat(N.map(c, x => x * 2), list{16, 18}) - ) - eq(__LOC__, - map2_add(length_10_id, length_8_id), - N.mapWithIndex(length_8_id, (i, x) => i + x) + __LOC__, + N.reverse(N.mapReverse2(length_10_id, length_10_id, add)), + N.map(length_10_id, x => x * 2), ) - eq(__LOC__, N.reverse(N.mapReverse2(length_10_id, length_10_id, add)), N.map(length_10_id, x => x * 2)) let xs = N.reverse(N.mapReverse2(length_8_id, length_10_id, add)) eq(__LOC__, N.length(xs), 8) eq(__LOC__, xs, N.zipBy(length_10_id, length_8_id, add)) @@ -173,9 +174,21 @@ describe("Belt.List", () => { ok(__LOC__, N.hasAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 2, \"=")) ok(__LOC__, !N.hasAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 4, \"=")) ok(__LOC__, N.hasAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 4, (x, y) => x + 1 == y)) - eq(__LOC__, N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 3, \"="), list{(1, "1"), (2, "2")}) - eq(__LOC__, N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 1, \"="), list{(2, "2"), (3, "3")}) - eq(__LOC__, N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 2, \"="), list{(1, "1"), (3, "3")}) + eq( + __LOC__, + N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 3, \"="), + list{(1, "1"), (2, "2")}, + ) + eq( + __LOC__, + N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 1, \"="), + list{(2, "2"), (3, "3")}, + ) + eq( + __LOC__, + N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 2, \"="), + list{(1, "1"), (3, "3")}, + ) eq( __LOC__, N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 0, \"="), @@ -211,15 +224,10 @@ describe("Belt.List", () => { ok(__LOC__, N.getAssoc(list{(1, "a"), (2, "b"), (3, "c")}, 4, \"=") == None) }) - test("head/tail etc.", () => { let succx = x => x + 1 - eq( - __LOC__, - (N.head(length_10_id), N.tail(length_10_id)), - (Some(0), N.drop(length_10_id, 1)), - ) + eq(__LOC__, (N.head(length_10_id), N.tail(length_10_id)), (Some(0), N.drop(length_10_id, 1))) eq(__LOC__, N.head(list{}), None) throw(__LOC__, () => N.headExn(list{})) throw(__LOC__, () => N.tailExn(list{})->ignore) @@ -237,16 +245,8 @@ describe("Belt.List", () => { eq(__LOC__, sum(list{}), 0) eq(__LOC__, sum(length_10_id), 45) eq(__LOC__, N.makeBy(0, id), list{}) - eq( - __LOC__, - N.reverse(N.reverse(length_10_id)), - length_10_id, - ) - eq( - __LOC__, - N.reverse(N.reverse(length_8_id)), - length_8_id, - ) + eq(__LOC__, N.reverse(N.reverse(length_10_id)), length_10_id) + eq(__LOC__, N.reverse(N.reverse(length_8_id)), length_8_id) eq(__LOC__, N.reverse(list{}), list{}) eq(__LOC__, N.reverse(N.mapReverse(length_10_id, succx)), N.map(length_10_id, succx)) eq(__LOC__, N.reduce(length_10_id, 0, add), 45) @@ -303,7 +303,6 @@ describe("Belt.List", () => { eq(__LOC__, N.some2(list{1, 2, 3}, list{-1, -2}, (x, y) => x == y), false) }) - test("add", () => { eq(__LOC__, list{}->N.add(3)->N.add(2), list{2, 3}) }) @@ -350,12 +349,13 @@ describe("Belt.List", () => { test("keepMap", () => { let u0 = N.makeBy(20, x => x) - let u1 = u0->N.keepMap(x => - if mod(x, 7) == 0 { - Some(x + 1) - } else { - None - } + let u1 = u0->N.keepMap( + x => + if mod(x, 7) == 0 { + Some(x + 1) + } else { + None + }, ) eq(__LOC__, u1, list{1, 8, 15}) ok( @@ -363,23 +363,26 @@ describe("Belt.List", () => { { open N - list{1, 2, 3, 4}->keepMap(x => - if mod(x, 2) == 0 { - Some(-x) - } else { - None - } + list{1, 2, 3, 4}->keepMap( + x => + if mod(x, 2) == 0 { + Some(-x) + } else { + None + }, ) == list{-2, -4} }, ) ok( __LOC__, - N.keepMap(list{1, 2, 3, 4}, x => - if mod(x, 5) == 0 { - Some(x) - } else { - None - } + N.keepMap( + list{1, 2, 3, 4}, + x => + if mod(x, 5) == 0 { + Some(x) + } else { + None + }, ) == list{}, ) }) diff --git a/jscomp/test/bench.res b/jscomp/test/bench.res index 6285496d5e..aa0e5cf1e5 100644 --- a/jscomp/test/bench.res +++ b/jscomp/test/bench.res @@ -3,15 +3,15 @@ let map = (f, a) => { if l == 0 { [] } else { - let r = Array.make(l, f(. Array.unsafe_get(a, 0))) + let r = Array.make(l, f(Array.unsafe_get(a, 0))) for i in 1 to l - 1 { - Array.unsafe_set(r, i, f(. Array.unsafe_get(a, i))) + Array.unsafe_set(r, i, f(Array.unsafe_get(a, i))) } r } } -let map = (type u v, f: u => v, a: array): array => map((. x) => f(x), a) +let map = (type u v, f: u => v, a: array): array => map(x => f(x), a) let init = (l, f) => if l == 0 { @@ -22,24 +22,24 @@ let init = (l, f) => /* See #6575. We could also check for maximum array size, but this depends on whether we create a float array or a regular one... */ - let res = Array.make(l, f(. 0)) + let res = Array.make(l, f(0)) for i in 1 to pred(l) { - Array.unsafe_set(res, i, f(. i)) + Array.unsafe_set(res, i, f(i)) } res } -let init = (l, f) => init(l, (. x) => f(x)) +let init = (l, f) => init(l, x => f(x)) let fold_left = (f, x, a) => { let r = ref(x) for i in 0 to Array.length(a) - 1 { - r := f(. r.contents, Array.unsafe_get(a, i)) + r := f(r.contents, Array.unsafe_get(a, i)) } r.contents } -let fold_left = (f, x, a) => fold_left((. x, y) => f(x, y), x, a) +let fold_left = (f, x, a) => fold_left((x, y) => f(x, y), x, a) let f2 = () => { let arr = init(3_000_000, i => float_of_int(i)) diff --git a/jscomp/test/bigint_test.res b/jscomp/test/bigint_test.res index 7ec6430e21..c39bce036d 100644 --- a/jscomp/test/bigint_test.res +++ b/jscomp/test/bigint_test.res @@ -27,50 +27,134 @@ let () = { eq(__LOC__, generic_compare(1n, 1n), 0) eq(__LOC__, bigint_compare(-0n, -1n), 1) eq(__LOC__, generic_compare(-0n, -1n), 1) - eq(__LOC__, bigint_compare(+0n, -1n), 1) - eq(__LOC__, generic_compare(+0n, -1n), 1) + eq(__LOC__, bigint_compare(0n, -1n), 1) + eq(__LOC__, generic_compare(0n, -1n), 1) eq(__LOC__, bigint_compare(1n, 2n), -1) eq(__LOC__, generic_compare(1n, 2n), -1) eq(__LOC__, bigint_compare(1n, 02n), -1) eq(__LOC__, generic_compare(1n, 02n), -1) eq(__LOC__, bigint_compare(1n, 001n), 0) eq(__LOC__, generic_compare(1n, 001n), 0) - eq(__LOC__, bigint_equal(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n), true) - eq(__LOC__, generic_equal(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n), true) - eq(__LOC__, bigint_equal(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, 1000000000000000000000000000000000000000000000000000000000000000000000000000000000001n), false) - eq(__LOC__, generic_equal(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, 1000000000000000000000000000000000000000000000000000000000000000000000000000000000001n), false) - eq(__LOC__, bigint_equal(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, -1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n), false) - eq(__LOC__, generic_equal(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, -1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n), false) - eq(__LOC__, bigint_equal(switch 1n { - |1n => 3n - |2n => 4n - |_ => 0n - }, 3n), true) - eq(__LOC__, generic_equal(switch 1n { - |1n => 3n - |2n => 4n - |_ => 0n - }, 3n), true) - eq(__LOC__, bigint_equal(switch -1n { - |-00001n => 3n - |-2n => 4n - |_ => 0n - }, 3n), true) - eq(__LOC__, generic_equal(switch -1n { - |-00001n => 3n - |2n => 4n - |_ => 0n - }, 3n), true) - eq(__LOC__, bigint_equal(switch -0001_000n { - |-00001000n => 3n - |-0002n => 4n - |_ => 0n - }, 3n), true) - eq(__LOC__, generic_equal(switch -0001_000n { - |-00001000n => 3n - |-0002n => 4n - |_ => 0n - }, 3n), true) + eq( + __LOC__, + bigint_equal( + 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, + 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, + ), + true, + ) + eq( + __LOC__, + generic_equal( + 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, + 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, + ), + true, + ) + eq( + __LOC__, + bigint_equal( + 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, + 1000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, + ), + false, + ) + eq( + __LOC__, + generic_equal( + 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, + 1000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, + ), + false, + ) + eq( + __LOC__, + bigint_equal( + 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, + -1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, + ), + false, + ) + eq( + __LOC__, + generic_equal( + 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, + -1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, + ), + false, + ) + eq( + __LOC__, + bigint_equal( + switch 1n { + | 1n => 3n + | 2n => 4n + | _ => 0n + }, + 3n, + ), + true, + ) + eq( + __LOC__, + generic_equal( + switch 1n { + | 1n => 3n + | 2n => 4n + | _ => 0n + }, + 3n, + ), + true, + ) + eq( + __LOC__, + bigint_equal( + switch -1n { + | -00001n => 3n + | -2n => 4n + | _ => 0n + }, + 3n, + ), + true, + ) + eq( + __LOC__, + generic_equal( + switch -1n { + | -00001n => 3n + | 2n => 4n + | _ => 0n + }, + 3n, + ), + true, + ) + eq( + __LOC__, + bigint_equal( + switch -0001_000n { + | -00001000n => 3n + | -0002n => 4n + | _ => 0n + }, + 3n, + ), + true, + ) + eq( + __LOC__, + generic_equal( + switch -0001_000n { + | -00001000n => 3n + | -0002n => 4n + | _ => 0n + }, + 3n, + ), + true, + ) eq(__LOC__, bigint_land(9n, 1n), 1n) eq(__LOC__, bigint_lor(9n, 1n), 9n) eq(__LOC__, bigint_lxor(9n, 1n), 8n) diff --git a/jscomp/test/bs_abstract_test.res b/jscomp/test/bs_abstract_test.res index ef854ad00d..314ce3081d 100644 --- a/jscomp/test/bs_abstract_test.res +++ b/jscomp/test/bs_abstract_test.res @@ -8,7 +8,7 @@ let v = linked_list(~hd=3, ~tl=Js.null) tlSet(v, Js.Null.return(v)) -type rec t = (. int, int) => bool +type rec t = (int, int) => bool @deriving(abstract) and x = { k: t, @@ -18,7 +18,7 @@ and x = { let x0 = k => x(~k, ~y="xx") let x1 = k => x(~k, ~y="xx") -let f = x(~k=(. x, y) => x == y, ~y="x") +let f = x(~k=(x, y) => x == y, ~y="x") @deriving(abstract) type u = { @@ -34,14 +34,14 @@ let uf2 = u => y1Get(u)(1, 2) @deriving(abstract) type u1 = { x: int, - yyyy: (. int) => int, - yyyy1: (. int, int) => int, + yyyy: int => int, + yyyy1: (int, int) => int, @optional yyyy2: int => int, } -let uff = f => (f->yyyyGet)(. 1) +let uff = f => (f->yyyyGet)(1) -let uff2 = f => (f->yyyy1Get)(. 1, 2) +let uff2 = f => (f->yyyy1Get)(1, 2) let uff3 = f => switch f->yyyy2Get { @@ -52,8 +52,8 @@ let uff3 = f => @deriving({abstract: light}) type u3 = { x: int, - yyyy: (. int) => int, - yyyy1: (. int, int) => int, + yyyy: int => int, + yyyy1: (int, int) => int, @optional yyyy2: int => int, } diff --git a/jscomp/test/bs_abstract_test.resi b/jscomp/test/bs_abstract_test.resi index 93495d53fa..640523dd59 100644 --- a/jscomp/test/bs_abstract_test.resi +++ b/jscomp/test/bs_abstract_test.resi @@ -4,7 +4,7 @@ type rec linked_list<'a> = private { tl: Js.null>, } -type rec t = (. int, int) => bool +type rec t = (int, int) => bool @deriving(abstract) and x = private { k: t, diff --git a/jscomp/test/bs_array_test.res b/jscomp/test/bs_array_test.res index 019a108136..b14cb0cc8f 100644 --- a/jscomp/test/bs_array_test.res +++ b/jscomp/test/bs_array_test.res @@ -32,8 +32,8 @@ let () = { (A.get(v, 0), A.get(v, 1), A.get(v, 2), A.get(v, 3), A.get(v, -1)), (Some(1), Some(2), None, None, None), ) - throw(__LOC__, _ => A.getExn([0, 1], -1) |> ignore) - throw(__LOC__, _ => A.getExn([0, 1], 2) |> ignore) + throw(__LOC__, _ => ignore(A.getExn([0, 1], -1))) + throw(__LOC__, _ => ignore(A.getExn([0, 1], 2))) b( __LOC__, { @@ -109,7 +109,7 @@ let () = { eq(__LOC__, A.reduceWithIndex([1, 2, 3, 4], 0, (acc, x, i) => acc + x + i), 16) b(__LOC__, A.reduceReverse2([1, 2, 3], [1, 2], 0, (acc, x, y) => acc + x + y) == 6) } -let addone = (. x) => x + 1 +let addone = x => x + 1 let makeMatrixExn = (sx, sy, init) => { /* let open A in */ diff --git a/jscomp/test/bs_auto_uncurry.res b/jscomp/test/bs_auto_uncurry.res index 6afc9104f3..fbd1b56c05 100644 --- a/jscomp/test/bs_auto_uncurry.res +++ b/jscomp/test/bs_auto_uncurry.res @@ -1,10 +1,10 @@ module Curry = {} module Block = {} -@val external map: (array<'a>, ('a => 'b)) => array<'b> = "Array.prototype.map.call" +@val external map: (array<'a>, 'a => 'b) => array<'b> = "Array.prototype.map.call" type id = int => int -@val external map2: (array, (int => int)) => array = "Array.prototype.map.cal" +@val external map2: (array, int => int) => array = "Array.prototype.map.cal" /* [n] should not be documented, since such inconsistency could not be checked @@ -15,7 +15,7 @@ let xbs = map([1, 2, 3, 5], x => x + 1) let f = (cb: int => int) => map([1, 2, 3, 4], cb) -let xs = map([(1,2), (1,2), (2,1)], ((x, y)) => y + x + 1) +let xs = map([(1, 2), (1, 2), (2, 1)], ((x, y)) => y + x + 1) @val external map2: (array<'a>, array<'b>, ('a, 'b) => 'c) => array<'c> = "map2" diff --git a/jscomp/test/bs_auto_uncurry_test.res b/jscomp/test/bs_auto_uncurry_test.res index dddae4148b..8a79812ede 100644 --- a/jscomp/test/bs_auto_uncurry_test.res +++ b/jscomp/test/bs_auto_uncurry_test.res @@ -6,7 +6,7 @@ let eq = (loc, x, y) => { list{(loc ++ (" id " ++ string_of_int(test_id.contents)), _ => Mt.Eq(x, y)), ...suites.contents} } -@send external map: (array<'a>, ('a => 'b)) => array<'b> = "map" +@send external map: (array<'a>, 'a => 'b) => array<'b> = "map" %%raw(` function hi (cb){ @@ -15,7 +15,7 @@ function hi (cb){ } `) -@val external hi: ((unit => unit)) => unit = "hi" +@val external hi: (unit => unit) => unit = "hi" let () = { let xs = ref(list{}) diff --git a/jscomp/test/bs_rest_test.res b/jscomp/test/bs_rest_test.res index 74d25fcd1c..21a562487c 100644 --- a/jscomp/test/bs_rest_test.res +++ b/jscomp/test/bs_rest_test.res @@ -2,18 +2,18 @@ function x(v){return [v]} `) -@val external f: (. 'a) => array<'a> = "x" +@val external f: 'a => array<'a> = "x" -let u = f(. "3") -let v = f(. 3) +let u = f("3") +let v = f(3) include ( { - @val external xxx: (. 'a) => array<'a> = "x" + @val external xxx: 'a => array<'a> = "x" }: { - let xxx: (. 'a) => array<'a> + let xxx: 'a => array<'a> } ) -let u = xxx(. 3) -let xx = xxx(. "3") +let u = xxx(3) +let xx = xxx("3") diff --git a/jscomp/test/bs_set_int_test.res b/jscomp/test/bs_set_int_test.res index 31f009650b..9b5223c511 100644 --- a/jscomp/test/bs_set_int_test.res +++ b/jscomp/test/bs_set_int_test.res @@ -29,8 +29,7 @@ let () = b(__LOC__, \"=~"(u, [3])) /* inclusive */ let range = (i, j) => Array.init(j - i + 1, k => k + i) -let revRange = (i, j) => - Array.init(j - i + 1, k => k + i) |> Array.to_list |> List.rev |> Array.of_list +let revRange = (i, j) => Array.of_list(List.rev(Array.to_list(Array.init(j - i + 1, k => k + i)))) let () = { let v = ofA(Array.append(range(100, 1000), revRange(400, 1500))) diff --git a/jscomp/test/bs_splice_partial.res b/jscomp/test/bs_splice_partial.res index e6e5489459..cfa53ad332 100644 --- a/jscomp/test/bs_splice_partial.res +++ b/jscomp/test/bs_splice_partial.res @@ -32,19 +32,19 @@ type id = int => int @variadic @send external cb: (int, string, array) => id = "cb" -type id2 = (. int) => int +type id2 = int => int @variadic @send external cb2: (int, string, array) => id2 = "cb2" let test_cb = x => { ignore((x->cb("hI", [1, 2, 3]))(3)) \"@@"(ignore, cb(x, "hI", [1, 2, 3])(3)) - cb2(x, "hI", [1, 2, 3])(. 3) + cb2(x, "hI", [1, 2, 3])(3) } -type u = (. int) => int +type u = int => int @val external v: u = "v" -let f = x => \"@@"(ignore, v(. x)) +let f = x => \"@@"(ignore, v(x)) @val external fff0: (int, int, @as(json`[undefined,undefined]`) _) => int = "say" diff --git a/jscomp/test/caml_format_test.res b/jscomp/test/caml_format_test.res index 1938b9cf89..b2bf039c62 100644 --- a/jscomp/test/caml_format_test.res +++ b/jscomp/test/caml_format_test.res @@ -26,12 +26,15 @@ let of_string = [ /* "0.", 0. */ /* |] */ -let from_float_of_string = xs => xs |> Array.mapi((i, (a, b)) => string_of_float) +let from_float_of_string = xs => Array.mapi((i, (a, b)) => string_of_float, xs) let from_of_string = xs => - of_string - |> Array.mapi((i, (a, b)) => (`of_string ${string_of_int(i)}`, _ => Mt.Eq(int_of_string(b), a))) - |> Array.to_list + Array.to_list( + Array.mapi( + (i, (a, b)) => (`of_string ${string_of_int(i)}`, _ => Mt.Eq(int_of_string(b), a)), + of_string, + ), + ) let to_str = s => int_of_string(s) @@ -51,12 +54,15 @@ let suites: Mt.pair_suites = \"@"( (FP_zero, "0."), ] - pairs - |> Array.mapi((i, (a, b)) => ( - `infinity_of_string ${string_of_int(i)}`, - _ => Mt.Eq(a, \"@@"(classify_float, float_of_string(b))), - )) - |> Array.to_list + Array.to_list( + Array.mapi( + (i, (a, b)) => ( + `infinity_of_string ${string_of_int(i)}`, + _ => Mt.Eq(a, \"@@"(classify_float, float_of_string(b))), + ), + pairs, + ), + ) }, \"@"( list{ @@ -66,12 +72,15 @@ let suites: Mt.pair_suites = \"@"( { let pairs = [(3232., "32_32.0"), (1.000, "1.000"), (12.000, "12.000")] - pairs - |> Array.mapi((i, (a, b)) => ( - `normal_float_of_string ${string_of_int(i)}`, - _ => Mt.Eq(a, float_of_string(b)), - )) - |> Array.to_list + Array.to_list( + Array.mapi( + (i, (a, b)) => ( + `normal_float_of_string ${string_of_int(i)}`, + _ => Mt.Eq(a, float_of_string(b)), + ), + pairs, + ), + ) }, ), ), @@ -146,22 +155,27 @@ let () = \"@@"( \"@"( suites, \"@"( - Array.mapi( - (i, (fmt, f, str_result)) => ( - `loat_format ${string_of_int(i)}`, - _ => Mt.Eq(format_float(fmt, f), str_result), + Array.to_list( + Array.mapi( + (i, (fmt, f, str_result)) => ( + `loat_format ${string_of_int(i)}`, + _ => Mt.Eq(format_float(fmt, f), str_result), + ), + float_data, ), - float_data, - ) |> Array.to_list, + ), \"@"( int64_suites, - of_string_data - |> Array.mapi((i, (a, b)) => ( - `int64_of_string ${string_of_int(i)} `, - _ => Mt.Eq(Int64.of_string(b), a), - )) - |> Array.to_list, + Array.to_list( + Array.mapi( + (i, (a, b)) => ( + `int64_of_string ${string_of_int(i)} `, + _ => Mt.Eq(Int64.of_string(b), a), + ), + of_string_data, + ), + ), ), ), - ), + ) ) diff --git a/jscomp/test/chn_test.res b/jscomp/test/chn_test.res index 65dc5666b0..e7d3010a4b 100644 --- a/jscomp/test/chn_test.res +++ b/jscomp/test/chn_test.res @@ -12,12 +12,14 @@ Js.log(`你好, Js.log(`\x3f\u003f\b\t\n\v\f\r\0"'`) let convert = (s: string): list => - Js_array2.fromMap(Js_string.castToArrayLike(s), x => - switch Js_string2.codePointAt(x, 0) { - | None => assert(false) - | Some(x) => x - } - ) |> Array.to_list + Array.to_list( + Js_array2.fromMap(Js_string.castToArrayLike(s), x => + switch Js_string2.codePointAt(x, 0) { + | None => assert(false) + | Some(x) => x + } + ), + ) let () = { eq( @@ -85,10 +87,6 @@ let () = { there is no need for line continuation, */ - eq( - __LOC__, - convert(` \b\t\n\v\f\r"'\\\0a`), - list{32, 8, 9, 10, 11, 12, 13, 34, 39, 92, 0, 97}, - ) + eq(__LOC__, convert(` \b\t\n\v\f\r"'\\\0a`), list{32, 8, 9, 10, 11, 12, 13, 34, 39, 92, 0, 97}) } let () = Mt.from_pair_suites(__MODULE__, suites.contents) diff --git a/jscomp/test/class_type_ffi_test.res b/jscomp/test/class_type_ffi_test.res index 0147da4a13..211f385297 100644 --- a/jscomp/test/class_type_ffi_test.res +++ b/jscomp/test/class_type_ffi_test.res @@ -7,7 +7,7 @@ let test_set = x => x["length__aux"] = 3 it can not be nominal */ let ff = ( - fn: (. 'a0, 'a1, 'a2, 'a3, 'a4, 'a5, 'a6, 'a7, 'a8, 'a9, 'a10, 'a11) => 'a12, + fn: ('a0, 'a1, 'a2, 'a3, 'a4, 'a5, 'a6, 'a7, 'a8, 'a9, 'a10, 'a11) => 'a12, a0, a1, a2, @@ -20,16 +20,15 @@ let ff = ( a9, a10, a11, -) => fn(. a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) +) => fn(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) let ff2 = (fn, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) => - fn(. a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) + fn(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) /* Test [fn_run_method] */ let off2 = (o, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) => o["huge_method"](a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) /* Test [fn_mk] */ -let mk_f = () => - (. a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) => - a0(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) +let mk_f = () => (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) => + a0(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) diff --git a/jscomp/test/coercion_module_alias_test.res b/jscomp/test/coercion_module_alias_test.res index e8356088a2..e89afae008 100644 --- a/jscomp/test/coercion_module_alias_test.res +++ b/jscomp/test/coercion_module_alias_test.res @@ -44,7 +44,7 @@ module M'': { module N': { let x: int } -} = M' +} = (M') \"@@"(l, M''.N'.x) module M2 = { include M' @@ -61,7 +61,7 @@ module M3': { module N': { let x: int } -} = M2 +} = (M2) \"@@"(l, M3'.N'.x) module M4: { diff --git a/jscomp/test/complex_if_test.res b/jscomp/test/complex_if_test.res index 2578ee1893..c3e838f8df 100644 --- a/jscomp/test/complex_if_test.res +++ b/jscomp/test/complex_if_test.res @@ -72,7 +72,7 @@ let suites = { "complete_escape", _ => Eq( string_escaped( - "\000\001\002\003\004\005\006\007\b\t\n\011\012\r\014\015\016\017\018\019\020\021\022\023\024\025\026\027\028\029\030\031 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\127\128\129\130\131\132\133\134\135\136\137\138\139\140\141\142\143\144\145\146\147\148\149\150\151\152\153\154\155\156\157\158\159\160\161\162\163\164\165\166\167\168\169\170\171\172\173\174\175\176\177\178\179\180\181\182\183\184\185\186\187\188\189\190\191\192\193\194\195\196\197\198\199\200\201\202\203\204\205\206\207\208\209\210\211\212\213\214\215\216\217\218\219\220\221\222\223\224\225\226\227\228\229\230\231\232\233\234\235\236\237\238\239\240\241\242\243\244\245\246\247\248\249\250\251\252\253\254\255", + "\x00\x01\x02\x03\x04\x05\x06\x07\b\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", ), "\\000\\001\\002\\003\\004\\005\\006\\007\\b\\t\\n\\011\\012\\r\\014\\015\\016\\017\\018\\019\\020\\021\\022\\023\\024\\025\\026\\027\\028\\029\\030\\031 !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\\127\\128\\129\\130\\131\\132\\133\\134\\135\\136\\137\\138\\139\\140\\141\\142\\143\\144\\145\\146\\147\\148\\149\\150\\151\\152\\153\\154\\155\\156\\157\\158\\159\\160\\161\\162\\163\\164\\165\\166\\167\\168\\169\\170\\171\\172\\173\\174\\175\\176\\177\\178\\179\\180\\181\\182\\183\\184\\185\\186\\187\\188\\189\\190\\191\\192\\193\\194\\195\\196\\197\\198\\199\\200\\201\\202\\203\\204\\205\\206\\207\\208\\209\\210\\211\\212\\213\\214\\215\\216\\217\\218\\219\\220\\221\\222\\223\\224\\225\\226\\227\\228\\229\\230\\231\\232\\233\\234\\235\\236\\237\\238\\239\\240\\241\\242\\243\\244\\245\\246\\247\\248\\249\\250\\251\\252\\253\\254\\255", ), diff --git a/jscomp/test/defunctor_make_test.res b/jscomp/test/defunctor_make_test.res index 2d198934e6..662f4dbc76 100644 --- a/jscomp/test/defunctor_make_test.res +++ b/jscomp/test/defunctor_make_test.res @@ -1,6 +1,6 @@ module Comparable: { type comparator<'a> - let getcompare: comparator<'a> => (. 'a, 'a) => int + let getcompare: comparator<'a> => ('a, 'a) => int module type C = { type id type key @@ -10,12 +10,12 @@ module Comparable: { module Make: ( M: { type key - let compare: (. key, key) => int + let compare: (key, key) => int }, ) => (C with type key = M.key) } = { - type comparator<'a> = (. 'a, 'a) => int - let getcompare: comparator<'a> => (. 'a, 'a) => int = x => x + type comparator<'a> = ('a, 'a) => int + let getcompare: comparator<'a> => ('a, 'a) => int = x => x module type C = { type id type key @@ -26,7 +26,7 @@ module Comparable: { module Make = ( M: { type key - let compare: (. key, key) => int + let compare: (key, key) => int }, ) => { type id @@ -116,7 +116,7 @@ let rec add = (x, data, compare, x_) => switch x_ { | Empty => Node(Empty, x, data, Empty, 1) | Node(l, v, d, r, h) => - let c = compare(. x, v) + let c = compare(x, v) if c == 0 { Node(l, x, data, r, h) } else if c < 0 { @@ -154,11 +154,11 @@ module U = struct module V0 = Comparable.Make({ type key = int - let compare = (. x: key, y) => Pervasives.compare((x: key), y) + let compare = (x: key, y) => Pervasives.compare((x: key), y) }) module V1 = Comparable.Make({ type key = int - let compare = (. x: key, y) => Pervasives.compare(x, y) + let compare = (x: key, y) => Pervasives.compare(x, y) }) let v0 = empty(module(V0)) let v1 = empty(module(V1)) diff --git a/jscomp/test/demo_int_map.resi b/jscomp/test/demo_int_map.resi index e69de29bb2..8b13789179 100644 --- a/jscomp/test/demo_int_map.resi +++ b/jscomp/test/demo_int_map.resi @@ -0,0 +1 @@ + diff --git a/jscomp/test/demo_page.res b/jscomp/test/demo_page.res index 4c7e2994c7..85737bfcba 100644 --- a/jscomp/test/demo_page.res +++ b/jscomp/test/demo_page.res @@ -5,7 +5,8 @@ let rec fib = x => | n => fib(n - 1) + fib(n - 2) } -/** Imperative style */ /** List map */ +/** Imperative style */ +/** List map */ let sum = n => { let v = ref(0) for i in 0 to n { @@ -43,7 +44,8 @@ type component_class @obj /** make a json object */ external config: (~display_name: string=?, ~render: unit => component, unit) => config = "" -/** make a json object */ @obj +/** make a json object */ +@obj external attrs: (~alt: string=?, ~autoPlay: bool=?, unit) => attrs = "" external str: string => component = "%identity" diff --git a/jscomp/test/derive_projector_test.res b/jscomp/test/derive_projector_test.res index ef1e9bce0a..3630a093fa 100644 --- a/jscomp/test/derive_projector_test.res +++ b/jscomp/test/derive_projector_test.res @@ -25,6 +25,6 @@ let h = list{d_empty, d_int(3), d_tuple(3, "hgo"), d_tweak((3, "hgo")), newConte @deriving(accessors) type xx = {"x": int} -@deriving(accessors) type t = A((. int) => int) +@deriving(accessors) type t = A(int => int) -let f = a((. x) => x) +let f = a(x => x) diff --git a/jscomp/test/derive_projector_test.resi b/jscomp/test/derive_projector_test.resi index c0be745663..0c8dd7f01d 100644 --- a/jscomp/test/derive_projector_test.resi +++ b/jscomp/test/derive_projector_test.resi @@ -21,4 +21,4 @@ let h: list @deriving(accessors) type hh = Xx(int) -@deriving(accessors) type t = A((. int) => int) +@deriving(accessors) type t = A(int => int) diff --git a/jscomp/test/digest_test.res b/jscomp/test/digest_test.res index 1a075cb30f..96ce3f2931 100644 --- a/jscomp/test/digest_test.res +++ b/jscomp/test/digest_test.res @@ -188,12 +188,15 @@ let f = x => \"@@"(Digest.to_hex, Digest.string(x)) "b325dc1c6f5e7a2b7cf465b9feab7948", ] - Ext_array_test.range(0, 129) - |> Array.map(i => ( - Belt.Int.toString(i), - _ => Mt.Eq(\"@@"(Digest.to_hex, \"@@"(Digest.string, String.make(i, 'a'))), ref[i]), - )) - |> Array.to_list + Array.to_list( + Array.map( + i => ( + Belt.Int.toString(i), + _ => Mt.Eq(\"@@"(Digest.to_hex, \"@@"(Digest.string, String.make(i, 'a'))), ref[i]), + ), + Ext_array_test.range(0, 129), + ), + ) }, - ), + ) ) diff --git a/jscomp/test/directives.res b/jscomp/test/directives.res index 7e7c2e7863..e6369d8ea9 100644 --- a/jscomp/test/directives.res +++ b/jscomp/test/directives.res @@ -2,4 +2,3 @@ @@directive("second directive;") let a = Belt.Array.forEach - diff --git a/jscomp/test/earger_curry_test.res b/jscomp/test/earger_curry_test.res index dafe764805..b676b0b51d 100644 --- a/jscomp/test/earger_curry_test.res +++ b/jscomp/test/earger_curry_test.res @@ -1,19 +1,19 @@ -let f = g => (. x) => g(x) +let f = g => x => g(x) let map = (f, a) => { let l = Array.length(a) if l == 0 { [] } else { - let r = Array.make(l, f(. Array.unsafe_get(a, 0))) + let r = Array.make(l, f(Array.unsafe_get(a, 0))) for i in 1 to l - 1 { - Array.unsafe_set(r, i, f(. Array.unsafe_get(a, i))) + Array.unsafe_set(r, i, f(Array.unsafe_get(a, i))) } r } } -let map = (type u v, f: u => v, a: array): array => map((. x) => f(x), a) +let map = (type u v, f: u => v, a: array): array => map(x => f(x), a) let init = (l, f) => if l == 0 { @@ -24,24 +24,24 @@ let init = (l, f) => /* See #6575. We could also check for maximum array size, but this depends on whether we create a float array or a regular one... */ - let res = Array.make(l, f(. 0)) + let res = Array.make(l, f(0)) for i in 1 to pred(l) { - Array.unsafe_set(res, i, f(. i)) + Array.unsafe_set(res, i, f(i)) } res } -let init = (l, f) => init(l, (. x) => f(x)) +let init = (l, f) => init(l, x => f(x)) let fold_left = (f, x, a) => { let r = ref(x) for i in 0 to Array.length(a) - 1 { - r := f(. r.contents, Array.unsafe_get(a, i)) + r := f(r.contents, Array.unsafe_get(a, i)) } r.contents } -let fold_left = (f, x, a) => fold_left((. x, y) => f(x, y), x, a) +let fold_left = (f, x, a) => fold_left((x, y) => f(x, y), x, a) @val external timeStart: string => unit = "console.time" @@ -114,19 +114,20 @@ let f = x => u */ let g = x => { - let u = (a,b) => add5( - x, - { - incr(v) - 1 - }, - { - incr(v) - 2 - }, - a, - b - ) + let u = (a, b) => + add5( + x, + { + incr(v) + 1 + }, + { + incr(v) + 2 + }, + a, + b, + ) all_v := list{v.contents, ...all_v.contents} u } diff --git a/jscomp/test/equal_exception_test.res b/jscomp/test/equal_exception_test.res index 4e7382c6ff..fc21456964 100644 --- a/jscomp/test/equal_exception_test.res +++ b/jscomp/test/equal_exception_test.res @@ -1,12 +1,12 @@ let v = "gso" let is_equal = () => { - assert (Bytes.get(Bytes.make(3, 'a'), 0) == 'a') - assert (Bytes.unsafe_get(Bytes.make(3, 'a'), 0) == 'a') + assert(Bytes.get(Bytes.make(3, 'a'), 0) == 'a') + assert(Bytes.unsafe_get(Bytes.make(3, 'a'), 0) == 'a') let u = Bytes.make(3, 'a') Bytes.unsafe_set(u, 0, 'b') - assert (Bytes.unsafe_get(u, 0) == 'b') - assert (String.get(v, 0) == 'g') + assert(Bytes.unsafe_get(u, 0) == 'b') + assert(String.get(v, 0) == 'g') } let is_exception = () => @@ -47,7 +47,7 @@ let eq = x => | _ => false } exception Not_found -assert ((e == Not_found) == false) -assert (eq(Not_found) == false) +assert((e == Not_found) == false) +assert(eq(Not_found) == false) Mt.from_suites("exception", suites) diff --git a/jscomp/test/event_ffi.res b/jscomp/test/event_ffi.res index 67d76dcc0f..13d03efe6e 100644 --- a/jscomp/test/event_ffi.res +++ b/jscomp/test/event_ffi.res @@ -30,28 +30,28 @@ let () = */ -let h0 = x => x(.) +let h0 = x => x() /* {[ function h0 (x){ return x () } ]} */ -let h00 = x => x(.) +let h00 = x => x() -let h1 = (x, y) => x(. y) /* weird case */ -let h10 = x => x(. 3) +let h1 = (x, y) => x(y) /* weird case */ +let h10 = x => x(3) -let h30 = x => (. a) => x(. 3, 3, a) -let h33 = x => x(. 1, 2, 3) -let h34 = x => x(. 1, 2, 3)(4) +let h30 = x => a => x(3, 3, a) +let h33 = x => x(1, 2, 3) +let h34 = x => x(1, 2, 3)(4) -let ocaml_run = (. b, c) => ((. x, y, z) => x + y + z)(. 1, b, c) +let ocaml_run = (b, c) => ((x, y, z) => x + y + z)(1, b, c) -let a0 = (. ()) => Js.log("hi") -let a1 = () => (. x) => x -let a2 = (. x, y) => x + y -let a3 = (. x, y, z) => x + y + z +let a0 = () => Js.log("hi") +let a1 = () => x => x +let a2 = (x, y) => x + y +let a3 = (x, y, z) => x + y + z /* let a4 = Js.Internal.fn_mk4 (fun x y z -> let u = x * x + y * y + z * z in fun d -> u + d) */ /* let a44 = Js.Internal.fn_mk4 (fun x y z d -> let u = x * x + y * y + z * z in u + d) */ @@ -61,6 +61,6 @@ let a3 = (. x, y, z) => x + y + z let test_as: ('a => 'a, _ as 'b) => 'b = List.map -let xx: unit => (. _) => unit = () => (. _) => Js.log(3) +let xx: unit => _ => unit = () => _ => Js.log(3) /* let test_hihi = hihi _ [@bs] */ diff --git a/jscomp/test/exception_raise_test.res b/jscomp/test/exception_raise_test.res index 33ed2dac68..bd1e269665 100644 --- a/jscomp/test/exception_raise_test.res +++ b/jscomp/test/exception_raise_test.res @@ -133,7 +133,7 @@ let suites = ref({ let test_id = ref(0) let eq = (loc, x, y) => Mt.eq_suites(~test_id, ~suites, loc, x, y) -let () = try %raw(`()=>{throw 2}`)(.) catch { +let () = try %raw(`()=>{throw 2}`)() catch { | e => eq(__LOC__, Js.Exn.asJsExn(e) != None, true) } diff --git a/jscomp/test/exception_value_test.res b/jscomp/test/exception_value_test.res index 38460a461c..9f82ae3dcf 100644 --- a/jscomp/test/exception_value_test.res +++ b/jscomp/test/exception_value_test.res @@ -1,7 +1,7 @@ let f = () => raise(Not_found) let assert_f = x => { - let () = assert (x > 3) + let () = assert(x > 3) 3 } diff --git a/jscomp/test/exotic_labels_test.res b/jscomp/test/exotic_labels_test.res index c7db482886..c805daf98d 100644 --- a/jscomp/test/exotic_labels_test.res +++ b/jscomp/test/exotic_labels_test.res @@ -4,17 +4,15 @@ type \"Type2" = string type \"Type3" = \"Type1" -type \"Type4" = { - field: string, -} +type \"Type4" = {field: string} let fn1 = v => v.field type dict = { - \"key": int, + key: int, \"KEY": int, } let dict = { - \"key": 1, + key: 1, \"KEY": 1, } diff --git a/jscomp/test/exponentiation_precedence_test.res b/jscomp/test/exponentiation_precedence_test.res index 55ec5fb6ec..97c300005a 100644 --- a/jscomp/test/exponentiation_precedence_test.res +++ b/jscomp/test/exponentiation_precedence_test.res @@ -1,4 +1,4 @@ let a = 2. ** 3. ** 2. let b = 2. ** -3. ** 2. let c = (2. ** 3.) ** 2. -let d = (-2.) ** 2. +let d = -2. ** 2. diff --git a/jscomp/test/ext_bytes_test.res b/jscomp/test/ext_bytes_test.res index 2cf7e9d126..1672db940f 100644 Binary files a/jscomp/test/ext_bytes_test.res and b/jscomp/test/ext_bytes_test.res differ diff --git a/jscomp/test/ext_list_test.res b/jscomp/test/ext_list_test.res index e9e1dfbec8..bf90e21a09 100644 --- a/jscomp/test/ext_list_test.res +++ b/jscomp/test/ext_list_test.res @@ -293,7 +293,7 @@ and aux = (cmp, x: 'a, xss: list>): list> => } } -let stable_group = (cmp, lst) => group(cmp, lst) |> List.rev +let stable_group = (cmp, lst) => List.rev(group(cmp, lst)) let rec drop = (n, h) => if n < 0 { @@ -499,4 +499,3 @@ let rec assoc_by_int = (def, k: int, lst) => modulo [1;2;3] [1;2;3;4] => [1;2;3] None modulo [1;2;3] [1;2;3] => [1;2;3] Some [] */ - \ No newline at end of file diff --git a/jscomp/test/external_ppx2.res b/jscomp/test/external_ppx2.res index c22dfdab71..fd515ec20e 100644 --- a/jscomp/test/external_ppx2.res +++ b/jscomp/test/external_ppx2.res @@ -1,4 +1,4 @@ external f: (@as("\h\e\l\lo") _, int) => unit = "f" let x = "\h\e\l\lo" -let y = f(42) \ No newline at end of file +let y = f(42) diff --git a/jscomp/test/ffi_arity_test.res b/jscomp/test/ffi_arity_test.res index a59986703e..fd8b5673fd 100644 --- a/jscomp/test/ffi_arity_test.res +++ b/jscomp/test/ffi_arity_test.res @@ -1,5 +1,5 @@ -@send external map: (array<'a>, (. 'a) => 'b) => array<'b> = "map" -@send external mapi: (array<'a>, (. 'a, int) => 'b) => array<'b> = "map" +@send external map: (array<'a>, 'a => 'b) => array<'b> = "map" +@send external mapi: (array<'a>, ('a, int) => 'b) => array<'b> = "map" @val external parseInt: string => int = "parseInt" @val external parseInt_radix: (string, int) => int = "parseInt" @@ -11,13 +11,13 @@ let f = v => v => v + v } -let v = mapi([1, 2, 3], (. a, b) => f(a)(b)) +let v = mapi([1, 2, 3], (a, b) => f(a)(b)) -let vv = mapi([1, 2, 3], (. a, b) => a + b) +let vv = mapi([1, 2, 3], (a, b) => a + b) -let hh = map(["1", "2", "3"], (. x) => parseInt(x)) +let hh = map(["1", "2", "3"], x => parseInt(x)) -let u = (. ()) => 3 +let u = () => 3 let vvv = ref(0) let fff = () => { @@ -27,7 +27,7 @@ let fff = () => { incr(vvv) } -let g = (. ()) => fff() +let g = () => fff() /* will be compiled into var g = function () { fff (0)} not {[ var g = fff ]} @@ -38,11 +38,11 @@ let abc = (x, y, z) => { x + y + z } -let abc_u = (. x, y, z) => abc(x, y, z) +let abc_u = (x, y, z) => abc(x, y, z) /* cool, it will be compiled into {[ var absc_u = abc ]} */ -let () = g(.) +let () = g() Mt.from_pair_suites( __MODULE__, { diff --git a/jscomp/test/ffi_array_test.res b/jscomp/test/ffi_array_test.res index a86aedd15c..6ad8c568c3 100644 --- a/jscomp/test/ffi_array_test.res +++ b/jscomp/test/ffi_array_test.res @@ -6,8 +6,8 @@ let eq = (loc, x, y) => { list{(loc ++ (" id " ++ string_of_int(test_id.contents)), _ => Mt.Eq(x, y)), ...suites.contents} } -@send external map: (Js_array2.t<'a>, (. 'a) => 'b) => Js_array2.t<'b> = "map" +@send external map: (Js_array2.t<'a>, 'a => 'b) => Js_array2.t<'b> = "map" -let () = eq(__LOC__, map([1, 2, 3, 4], (. x) => x + 1), [2, 3, 4, 5]) +let () = eq(__LOC__, map([1, 2, 3, 4], x => x + 1), [2, 3, 4, 5]) Mt.from_pair_suites(__MODULE__, suites.contents) diff --git a/jscomp/test/ffi_js_test.res b/jscomp/test/ffi_js_test.res index 68a4136fe3..ec405c71d1 100644 --- a/jscomp/test/ffi_js_test.res +++ b/jscomp/test/ffi_js_test.res @@ -1,4 +1,4 @@ -let keys: (. Obj.t) => array = %raw(" function (x){return Object.keys(x)}") +let keys: Obj.t => array = %raw(" function (x){return Object.keys(x)}") %%raw(` function $$higher_order(x){ @@ -7,7 +7,7 @@ let keys: (. Obj.t) => array = %raw(" function (x){return Object.keys(x) } } `) -@val external higher_order: int => (. int, int) => int = "$$higher_order" +@val external higher_order: int => (int, int) => int = "$$higher_order" let suites: ref = ref(list{}) let test_id = ref(0) @@ -27,7 +27,7 @@ let int_config = config(~kind=Int, ~hi=3, ~low=32) let string_config = config(~kind=Str, ~hi=3, ~low="32") -let () = eq(__LOC__, (6, higher_order(1)(. 2, 3))) +let () = eq(__LOC__, (6, higher_order(1)(2, 3))) let same_type = ( list{int_config, {"hi": 3, "low": 32}}, diff --git a/jscomp/test/float_of_bits_test.res b/jscomp/test/float_of_bits_test.res index 384d32d01a..fa4bf47f62 100644 --- a/jscomp/test/float_of_bits_test.res +++ b/jscomp/test/float_of_bits_test.res @@ -4,13 +4,17 @@ let one_float = 4607182418800017408L let int32_pairs = [(32l, 4.48415508583941463e-44), (3l, 4.20389539297445121e-45)] let from_pairs = pair => - int32_pairs - |> Array.mapi((i, (i32, f)) => list{ - ("int32_float_of_bits " ++ __unsafe_cast(i), _ => Mt.Eq(Int32.float_of_bits(i32), f)), - ("int32_bits_of_float " ++ __unsafe_cast(i), _ => Mt.Eq(Int32.bits_of_float(f), i32)), - }) - |> Array.to_list - |> List.concat + List.concat( + Array.to_list( + Array.mapi( + (i, (i32, f)) => list{ + ("int32_float_of_bits " ++ __unsafe_cast(i), _ => Mt.Eq(Int32.float_of_bits(i32), f)), + ("int32_bits_of_float " ++ __unsafe_cast(i), _ => Mt.Eq(Int32.bits_of_float(f), i32)), + }, + int32_pairs, + ), + ), + ) let suites = \"@"( { open Mt diff --git a/jscomp/test/float_test.res b/jscomp/test/float_test.res index 76efc4186e..6281fd99c1 100644 --- a/jscomp/test/float_test.res +++ b/jscomp/test/float_test.res @@ -36,9 +36,7 @@ let results = Array.append( ) let from_pairs = ps => - ps - |> Array.mapi((i, (a, b)) => ("pair " ++ __unsafe_cast(i), _ => Mt.Approx(a, b))) - |> Array.to_list + Array.to_list(Array.mapi((i, (a, b)) => ("pair " ++ __unsafe_cast(i), _ => Mt.Approx(a, b)), ps)) let float_compare = (x: float, y) => Pervasives.compare(x, y) let generic_compare = Pervasives.compare @@ -67,9 +65,7 @@ let () = { (true, true), ) /* modf nan => (nan,nan) */ - eq( - __LOC__, - Array.map(((x, y)) => float_compare(x, y), [(1., 3.), (2., 1.), (3., 2.)]) |> Array.map(x => + eq(__LOC__, Array.map(x => if x > 0 { 1 } else if x < 0 { @@ -77,9 +73,7 @@ let () = { } else { 0 } - ), - [-1, 1, 1], - ) + , Array.map(((x, y)) => float_compare(x, y), [(1., 3.), (2., 1.), (3., 2.)])), [-1, 1, 1]) eq(__LOC__, copysign(-3., 0.), 3.) eq(__LOC__, copysign(3., 0.), 3.) eq(__LOC__, log10(10.), 1.) @@ -145,6 +139,6 @@ let () = { } }, \"@"(from_pairs(results), suites.contents), - ), + ) ) } diff --git a/jscomp/test/genlex_test.res b/jscomp/test/genlex_test.res index 74f3d7b0de..d727895a3d 100644 --- a/jscomp/test/genlex_test.res +++ b/jscomp/test/genlex_test.res @@ -18,7 +18,7 @@ let suites = { "lexer_stream_genlex", _ => Eq( list{Int(3), Kwd("("), Int(3), Kwd("+"), Int(2), Int(-1), Kwd(")")}, - "3(3 + 2 -1)" |> Stream.of_string |> lexer |> to_list, + to_list(lexer(Stream.of_string("3(3 + 2 -1)"))), ), ), } diff --git a/jscomp/test/global_mangles.res b/jscomp/test/global_mangles.res index f3b2e30199..d20d20dac2 100644 --- a/jscomp/test/global_mangles.res +++ b/jscomp/test/global_mangles.res @@ -1,8 +1,3 @@ /* Reserved in CommonJS */ -let ( - __dirname, - __filename, - exports, - require, -) = (1, 2, 3, 4) +let (__dirname, __filename, exports, require) = (1, 2, 3, 4) diff --git a/jscomp/test/gpr_1072.res b/jscomp/test/gpr_1072.res index 92492c67ae..43f67e00c6 100644 --- a/jscomp/test/gpr_1072.res +++ b/jscomp/test/gpr_1072.res @@ -49,7 +49,7 @@ let v_ice_cream4: list = list{ @obj external label_test: (~x__ignore: int, unit) => _ = "" /** here the type label should be the same, - when get the object, it will be mangled */ + when get the object, it will be mangled */ type label_expect = {"x__ignore": int} let vv: label_expect = label_test(~x__ignore=3, ()) diff --git a/jscomp/test/gpr_1268.res b/jscomp/test/gpr_1268.res index add5f5d894..c184bea513 100644 --- a/jscomp/test/gpr_1268.res +++ b/jscomp/test/gpr_1268.res @@ -1,8 +1,8 @@ -let f = (a, b, x, y) => a(x) |> \"+"(b(y)) +let f = (a, b, x, y) => b(y) + a(x) @val external add: (int, int) => int = "add" -let f_add2 = (a, b, x, y) => a(x) |> add(b(y)) +let f_add2 = (a, b, x, y) => add(b(y), a(x)) let f = (a, b, x, y) => a(x) + b(y) @@ -10,6 +10,6 @@ let f1 = (a, b, x, y) => add(a(x), b(y)) let f2 = x => Js.log(x) -let f3 = x => x |> Js.log +let f3 = x => Js.log(x) -let f4 = (x, y) => x |> add(y) +let f4 = (x, y) => add(y, x) diff --git a/jscomp/test/gpr_1409_test.res b/jscomp/test/gpr_1409_test.res index a00780abb2..ce8af26025 100644 --- a/jscomp/test/gpr_1409_test.res +++ b/jscomp/test/gpr_1409_test.res @@ -57,7 +57,7 @@ let test6 = (f, x) => { incr(x) Some(x.contents) }, - ~xx__hi=?f(. x), + ~xx__hi=?f(x), ~hi=2, (), ) diff --git a/jscomp/test/gpr_1503_test.res b/jscomp/test/gpr_1503_test.res index 7885207305..91d165b9c7 100644 --- a/jscomp/test/gpr_1503_test.res +++ b/jscomp/test/gpr_1503_test.res @@ -6,7 +6,7 @@ let eq = (loc, x, y) => { list{(loc ++ (" id " ++ string_of_int(test_id.contents)), _ => Mt.Eq(x, y)), ...suites.contents} } -let id = x => x |> Int64.to_string |> Int64.of_string +let id = x => Int64.of_string(Int64.to_string(x)) let () = { let i = 0x7BABABABABABABABL diff --git a/jscomp/test/gpr_1667_test.res b/jscomp/test/gpr_1667_test.res index 19b3be576e..011f488c03 100644 --- a/jscomp/test/gpr_1667_test.res +++ b/jscomp/test/gpr_1667_test.res @@ -11,6 +11,7 @@ let eq = (loc, x, y) => { let e = { let o = false + ( z => { diff --git a/jscomp/test/gpr_2682_test.res b/jscomp/test/gpr_2682_test.res index 7a21ef4665..74f7c0d7c3 100644 --- a/jscomp/test/gpr_2682_test.res +++ b/jscomp/test/gpr_2682_test.res @@ -23,7 +23,7 @@ let forIn = %raw(`(o,foo)=> { } }`) -let forIn: ('a, (. string) => unit) => unit = forIn +let forIn: ('a, string => unit) => unit = forIn /* let%raw forIn : 'a -> (string -> unit [@bs]) -> unit = fun o foo -> {| @@ -33,20 +33,20 @@ let%raw forIn : 'a -> (string -> unit [@bs]) -> unit = fun o foo -> {| |} */ module N: { - let log2: (. string) => unit + let log2: string => unit } = { - let log = (. x) => Js.log(x) + let log = x => Js.log(x) - let log2: (. 'a) => unit = log + let log2: 'a => unit = log } /* let log : 'a -> unit = fun%raw x -> {|console.log (x)|} */ -forIn({"x": 3}, (. x) => Js.log(x)) -forIn({"x": 3, "y": 3}, (. x) => Js.log(x)) +forIn({"x": 3}, x => Js.log(x)) +forIn({"x": 3, "y": 3}, x => Js.log(x)) -let f3: (. unit) => bool = %raw("()=>true") +let f3: unit => bool = %raw("()=>true") -let bbbb = f3(.) +let bbbb = f3() assert(bbbb) diff --git a/jscomp/test/gpr_3492_test.res b/jscomp/test/gpr_3492_test.res index 07c4d1d945..3aad61c499 100644 --- a/jscomp/test/gpr_3492_test.res +++ b/jscomp/test/gpr_3492_test.res @@ -4,7 +4,7 @@ let eq = (loc, x, y) => Mt.eq_suites(~test_id, ~suites, loc, x, y) %%raw("function foo(a){return a()}") -@val("foo") external foo: ((unit => int)) => int = "" +@val("foo") external foo: (unit => int) => int = "" let fn = () => { Js.log("hi") 1 diff --git a/jscomp/test/gpr_3877_test.res b/jscomp/test/gpr_3877_test.res index c3c72db18b..3cb055c198 100644 --- a/jscomp/test/gpr_3877_test.res +++ b/jscomp/test/gpr_3877_test.res @@ -23,5 +23,5 @@ let a = test(201) let b = test(504) -assert (a == "good response") -assert (b == "bad response") +assert(a == "good response") +assert(b == "bad response") diff --git a/jscomp/test/gpr_4274_test.res b/jscomp/test/gpr_4274_test.res index 142cedcdf4..d638baaafd 100644 --- a/jscomp/test/gpr_4274_test.res +++ b/jscomp/test/gpr_4274_test.res @@ -4,17 +4,17 @@ module N = { module type X = { type f<'a> = {i: 'a} - let forEach: (. array<'a>, f<'a => unit>) => unit + let forEach: (array<'a>, f<'a => unit>) => unit } /* type annotation here interferes.. */ -let f = (module(X: X), xs: array) => X.forEach(. xs, {X.i: x => Js.log(x.x)}) +let f = (module(X: X), xs: array) => X.forEach(xs, {X.i: x => Js.log(x.x)}) -Belt.List.forEach(list{{N.x: 3}}, (. x) => Js.log(x.x)) +Belt.List.forEach(list{{N.x: 3}}, x => Js.log(x.x)) module Foo = { type record = {foo: string} } let bar = [{Foo.foo: @reason.raw_literal("bar") "bar"}] -let _ = Belt.Array.map(bar, (. b) => b.foo) +let _ = Belt.Array.map(bar, b => b.foo) diff --git a/jscomp/test/gpr_4931_allow.res b/jscomp/test/gpr_4931_allow.res index 2a7065c0ef..c68e924430 100644 --- a/jscomp/test/gpr_4931_allow.res +++ b/jscomp/test/gpr_4931_allow.res @@ -1,5 +1,5 @@ @@config({ - flags : ["-bs-package-output", "es6:jscomp/test:.mjs"] + flags: ["-bs-package-output", "es6:jscomp/test:.mjs"], }) %%raw(` @@ -8,4 +8,3 @@ if(import.meta.hot) { }else{ console.log("ok") }`) - diff --git a/jscomp/test/gpr_5071_test.res b/jscomp/test/gpr_5071_test.res index e2f5de6288..d7003d2df5 100644 --- a/jscomp/test/gpr_5071_test.res +++ b/jscomp/test/gpr_5071_test.res @@ -1,7 +1,5 @@ @@config({ - flags: [ - "-w","-16" - ], + flags: ["-w", "-16"], }) module Test: { @obj diff --git a/jscomp/test/gpr_5218_test.res b/jscomp/test/gpr_5218_test.res index 9ba44480b0..b16d9a7078 100644 --- a/jscomp/test/gpr_5218_test.res +++ b/jscomp/test/gpr_5218_test.res @@ -1,15 +1,15 @@ - let {eq_suites} = module(Mt) let test_id = ref(0) let suites = ref(list{}) -let test = x => switch (x) { +let test = x => + switch x { | #1(x) => #1(x) | #2(x) => #2(x) -} + } -eq_suites(~test_id,~suites,__LOC__,test(#1(3)),#1(3)) +eq_suites(~test_id, ~suites, __LOC__, test(#1(3)), #1(3)) -eq_suites(~test_id,~suites,__LOC__,test(#2(3)),#2(3)) +eq_suites(~test_id, ~suites, __LOC__, test(#2(3)), #2(3)) Mt.from_pair_suites(__FILE__, suites.contents) diff --git a/jscomp/test/gpr_5557.res b/jscomp/test/gpr_5557.res index a9342cfcf0..81d3274ed8 100644 --- a/jscomp/test/gpr_5557.res +++ b/jscomp/test/gpr_5557.res @@ -1,9 +1,9 @@ @@config({ - flags : ["-w", "-8"] + flags: ["-w", "-8"], }) let isA = c => switch c { | 'a' => true } -let h : int = ('a' :> int) +let h: int = ('a' :> int) diff --git a/jscomp/test/gpr_5753.res b/jscomp/test/gpr_5753.res index 27eb975ef7..0a46f612bb 100644 --- a/jscomp/test/gpr_5753.res +++ b/jscomp/test/gpr_5753.res @@ -1,5 +1,5 @@ @@config({ - flags : ["-w", "-8"] + flags: ["-w", "-8"], }) -'文'-> Js.log \ No newline at end of file +'文'->Js.log diff --git a/jscomp/test/gpr_858_unit2_test.res b/jscomp/test/gpr_858_unit2_test.res index bfcb7c16b0..76a0424018 100644 --- a/jscomp/test/gpr_858_unit2_test.res +++ b/jscomp/test/gpr_858_unit2_test.res @@ -3,7 +3,7 @@ let () = { for i in 1 to 2 { let rec f = (n, x) => switch x { - | 0 => assert (i == n) + | 0 => assert(i == n) | j => delayed := { let prev = delayed.contents diff --git a/jscomp/test/gpr_974_test.res b/jscomp/test/gpr_974_test.res index 176ec6d597..70599869cd 100644 --- a/jscomp/test/gpr_974_test.res +++ b/jscomp/test/gpr_974_test.res @@ -1,5 +1,5 @@ let _ = { - assert (Js.Null_undefined.toOption(Js.Null_undefined.return("")) == Some("")) - assert (Js.Undefined.toOption(Js.Undefined.return("")) == Some("")) - assert (Js.Null.toOption(Js.Null.return("")) == Some("")) + assert(Js.Null_undefined.toOption(Js.Null_undefined.return("")) == Some("")) + assert(Js.Undefined.toOption(Js.Undefined.return("")) == Some("")) + assert(Js.Null.toOption(Js.Null.return("")) == Some("")) } diff --git a/jscomp/test/hash_sugar_desugar.res b/jscomp/test/hash_sugar_desugar.res index 326f4995c7..5ec1c533a3 100644 --- a/jscomp/test/hash_sugar_desugar.res +++ b/jscomp/test/hash_sugar_desugar.res @@ -22,7 +22,7 @@ let h5 = u => u["hi"] = 3 let h6 = u => u["p"] -let h7 = u => u["m"](. 1, 2) +let h7 = u => u["m"](1, 2) let h8 = u => { let f = u["hi"] diff --git a/jscomp/test/hash_sugar_desugar.resi b/jscomp/test/hash_sugar_desugar.resi index f152ec00db..48cd714895 100644 --- a/jscomp/test/hash_sugar_desugar.resi +++ b/jscomp/test/hash_sugar_desugar.resi @@ -8,7 +8,7 @@ let h5: {..@set "hi": int} => unit { mutable "hi" : int } */ let h6: {.."p": 'a} => 'a -let h7: {.."m": (. int, int) => 'a} => 'a +let h7: {.."m": (int, int) => 'a} => 'a let h8: {.."hi": (int, int) => 'a} => 'a let chain_g: {"x": {"y": {"z": int}}} => int diff --git a/jscomp/test/hash_test.res b/jscomp/test/hash_test.res index 526d552cc8..8771d12a7c 100644 --- a/jscomp/test/hash_test.res +++ b/jscomp/test/hash_test.res @@ -40,13 +40,13 @@ let test_strings_hash_results = [ ] let normalize = x => land(x, 0x3FFFFFFF) -let caml_hash = x => Hashtbl.hash(x) |> normalize -let () = eq(__LOC__, test_strings |> Array.map(caml_hash), test_strings_hash_results) +let caml_hash = x => normalize(Hashtbl.hash(x)) +let () = eq(__LOC__, Array.map(caml_hash, test_strings), test_strings_hash_results) -let () = eq(__LOC__, Hashtbl.hash(0) |> normalize, 129913994) +let () = eq(__LOC__, normalize(Hashtbl.hash(0)), 129913994) -let () = eq(__LOC__, Hashtbl.hash("x") |> normalize, 780510073) +let () = eq(__LOC__, normalize(Hashtbl.hash("x")), 780510073) -let () = eq(__LOC__, Hashtbl.hash("xy") |> normalize, 194127723) +let () = eq(__LOC__, normalize(Hashtbl.hash("xy")), 194127723) let () = Mt.from_pair_suites(__MODULE__, suites.contents) diff --git a/jscomp/test/hello_res.res b/jscomp/test/hello_res.res index 5ad0b97441..e1e7fc96bb 100644 --- a/jscomp/test/hello_res.res +++ b/jscomp/test/hello_res.res @@ -1,7 +1,7 @@ @@config({ flags: [ // "-dparsetree" - ], + ], }) let b = List.length(list{1, 2, 3}) diff --git a/jscomp/test/hello_res.resi b/jscomp/test/hello_res.resi index b3d091d52a..6989395bb4 100644 --- a/jscomp/test/hello_res.resi +++ b/jscomp/test/hello_res.resi @@ -1,4 +1,4 @@ -let a : int +let a: int -let to : int -let downto : int \ No newline at end of file +let to: int +let downto: int diff --git a/jscomp/test/ignore_uncurry_attribute.res b/jscomp/test/ignore_uncurry_attribute.res index 53e7cb29fc..64a6f065c4 100644 --- a/jscomp/test/ignore_uncurry_attribute.res +++ b/jscomp/test/ignore_uncurry_attribute.res @@ -1,7 +1,7 @@ @@uncurried -external map1: (array<'a>, ('a => 'b)) => array<'b> = "map" +external map1: (array<'a>, 'a => 'b) => array<'b> = "map" let map1 = map1 -external map2: (array<'a>, ('a => 'b)) => array<'b> = "map" +external map2: (array<'a>, 'a => 'b) => array<'b> = "map" let map2 = map2 diff --git a/jscomp/test/inline_map_demo.res b/jscomp/test/inline_map_demo.res index 34ee7b3763..9360771940 100644 --- a/jscomp/test/inline_map_demo.res +++ b/jscomp/test/inline_map_demo.res @@ -1,4 +1,4 @@ -@@config({no_export: no_export, flags: ["-w", "@A"]}) +@@config({no_export, flags: ["-w", "@A"]}) let compare = (x: int, y: int) => compare(x, y) diff --git a/jscomp/test/int32_test.res b/jscomp/test/int32_test.res index 78d3c43bf6..71380264a8 100644 --- a/jscomp/test/int32_test.res +++ b/jscomp/test/int32_test.res @@ -7,7 +7,7 @@ let f = x => ( ) let shift_right_logical_tests = ( - Ext_array_test.range(0, 31) |> Array.map(x => Int32.shift_right_logical(-1l, x)), + Array.map(x => Int32.shift_right_logical(-1l, x), Ext_array_test.range(0, 31)), [ -1l, 2147483647l, @@ -45,7 +45,7 @@ let shift_right_logical_tests = ( ) let shift_right_tests = ( - Ext_array_test.range(0, 31) |> Array.map(x => Int32.shift_right(Int32.min_int, x)), + Array.map(x => Int32.shift_right(Int32.min_int, x), Ext_array_test.range(0, 31)), [ -2147483648l, -1073741824l, @@ -83,7 +83,7 @@ let shift_right_tests = ( ) let shift_left_tests = ( - Ext_array_test.range(0, 31) |> Array.map(x => Int32.shift_left(1l, x)), + Array.map(x => Int32.shift_left(1l, x), Ext_array_test.range(0, 31)), [ 1l, 2l, @@ -135,28 +135,34 @@ let suites = ref( \"@"( { let (a, b) = shift_right_logical_tests - Ext_array_test.map2i( - (i, a, b) => ("shift_right_logical_cases " ++ __unsafe_cast(i), _ => Mt.Eq(a, b)), - a, - b, - ) |> Array.to_list + Array.to_list( + Ext_array_test.map2i( + (i, a, b) => ("shift_right_logical_cases " ++ __unsafe_cast(i), _ => Mt.Eq(a, b)), + a, + b, + ), + ) }, \"@"( { let (a, b) = shift_right_tests - Ext_array_test.map2i( - (i, a, b) => ("shift_right_cases " ++ __unsafe_cast(i), _ => Mt.Eq(a, b)), - a, - b, - ) |> Array.to_list + Array.to_list( + Ext_array_test.map2i( + (i, a, b) => ("shift_right_cases " ++ __unsafe_cast(i), _ => Mt.Eq(a, b)), + a, + b, + ), + ) }, { let (a, b) = shift_left_tests - Ext_array_test.map2i( - (i, a, b) => ("shift_left_cases " ++ __unsafe_cast(i), _ => Mt.Eq(a, b)), - a, - b, - ) |> Array.to_list + Array.to_list( + Ext_array_test.map2i( + (i, a, b) => ("shift_left_cases " ++ __unsafe_cast(i), _ => Mt.Eq(a, b)), + a, + b, + ), + ) }, ), ), diff --git a/jscomp/test/int64_mul_div_test.res b/jscomp/test/int64_mul_div_test.res index ef3db5619f..cc8e914b65 100644 --- a/jscomp/test/int64_mul_div_test.res +++ b/jscomp/test/int64_mul_div_test.res @@ -199,31 +199,28 @@ let simple_divs = [ /* let f a b = a,b, div a b, rem a b;; */ let from = xs => - xs - |> Array.to_list - |> List.mapi((i, (a, b, c, d)) => ( - "small_divs " ++ __unsafe_cast(i), - _ => Mt.Eq((c, d), (Int64.div(a, b), Int64.rem(a, b))), - )) + List.mapi( + (i, (a, b, c, d)) => ( + "small_divs " ++ __unsafe_cast(i), + _ => Mt.Eq((c, d), (Int64.div(a, b), Int64.rem(a, b))), + ), + Array.to_list(xs), + ) let to_string = [(0L, "0")] let int64_compare_tests = [(1L, 2L, -1), (2L, 1L, 1), (2L, 1L, 1)] let from_compare = xs => - xs - |> Array.to_list - |> List.mapi((i, (a, b, c)) => ( - "int64_compare " ++ __unsafe_cast(i), - _ => Mt.Eq(c, Int64.compare(a, b)), - )) + List.mapi( + (i, (a, b, c)) => ("int64_compare " ++ __unsafe_cast(i), _ => Mt.Eq(c, Int64.compare(a, b))), + Array.to_list(xs), + ) let from_to_string = xs => - xs - |> Array.to_list - |> List.mapi((i, (a, str_a)) => ( - "to_string " ++ __unsafe_cast(i), - _ => Mt.Eq(str_a, Int64.to_string(a)), - )) + List.mapi( + (i, (a, str_a)) => ("to_string " ++ __unsafe_cast(i), _ => Mt.Eq(str_a, Int64.to_string(a))), + Array.to_list(xs), + ) \"@@"( Mt.from_pair_suites(__MODULE__, ...), @@ -232,19 +229,15 @@ let from_to_string = xs => \"@"( from_pairs("small", small_pairs), \"@"( - to_floats - |> Array.to_list - |> List.mapi((i, (i64, f)) => ( - "to_float_" ++ __unsafe_cast(i), - _ => Mt.Eq(Int64.to_float(i64), f), - )), + List.mapi( + (i, (i64, f)) => ("to_float_" ++ __unsafe_cast(i), _ => Mt.Eq(Int64.to_float(i64), f)), + Array.to_list(to_floats), + ), \"@"( - of_float_pairs - |> Array.to_list - |> List.mapi((i, (f, i64)) => ( - "of_float_" ++ __unsafe_cast(i), - _ => Mt.Eq(Int64.of_float(f), i64), - )), + List.mapi( + (i, (f, i64)) => ("of_float_" ++ __unsafe_cast(i), _ => Mt.Eq(Int64.of_float(f), i64)), + Array.to_list(of_float_pairs), + ), \"@"( list{ ( @@ -268,7 +261,7 @@ let from_to_string = xs => ), ), ), - ), + ) ) /* Undefined behaviorJ diff --git a/jscomp/test/int64_string_bench.res b/jscomp/test/int64_string_bench.res index 7d1652145d..f383178686 100644 --- a/jscomp/test/int64_string_bench.res +++ b/jscomp/test/int64_string_bench.res @@ -6,7 +6,7 @@ let () = { } /* let u = 3L in */ for i in 0 to 1_00_000 { - Int64.to_string(u) |> ignore + ignore(Int64.to_string(u)) } Js.Console.timeEnd("Int64.to_string") Js.log(Int64.to_string(u)) @@ -15,7 +15,7 @@ let () = { Js.Console.timeStart("Int64.to_string") let u = 30_000_000L for i in 0 to 1_00_000 { - Int64.to_string(u) |> ignore + ignore(Int64.to_string(u)) } Js.Console.timeEnd("Int64.to_string") Js.log(Int64.to_string(u)) @@ -28,7 +28,7 @@ let () = { min_int->add(100L) } for i in 0 to 1_00_000 { - Int64.to_string(u) |> ignore + ignore(Int64.to_string(u)) } Js.Console.timeEnd("Int64.to_string") Js.log(Int64.to_string(u)) diff --git a/jscomp/test/int64_test.res b/jscomp/test/int64_test.res index 3e7ef213a9..b52d223946 100644 --- a/jscomp/test/int64_test.res +++ b/jscomp/test/int64_test.res @@ -10,7 +10,7 @@ let commutative_add = (result, a, b) => Mt.Eq((result, result), (add(a, b), add( let generic_compare = Pervasives.compare let shift_left_tests = ( - Ext_array_test.range(0, 63) |> Array.map(i => Int64.shift_left(1L, i)), + Array.map(i => Int64.shift_left(1L, i), Ext_array_test.range(0, 63)), [ 1L, 2L, @@ -80,7 +80,7 @@ let shift_left_tests = ( ) let shift_right_tests = ( - Ext_array_test.range(0, 63) |> Array.map(i => Int64.shift_right(0x8000_0000_0000_0000L, i)), + Array.map(i => Int64.shift_right(0x8000_0000_0000_0000L, i), Ext_array_test.range(0, 63)), [ -9223372036854775808L, -4611686018427387904L, @@ -150,9 +150,7 @@ let shift_right_tests = ( ) let shift_right_logical_suites = ( - Ext_array_test.range(0, 63) |> Array.map(i => - Int64.shift_right_logical(0x8000_0000_0000_0000L, i) - ), + Array.map(i => Int64.shift_right_logical(0x8000_0000_0000_0000L, i), Ext_array_test.range(0, 63)), [ -9223372036854775808L, 4611686018427387904L, @@ -307,7 +305,7 @@ let suites: Mt.pair_suites = /* "shift_right",(fun _ -> ( "lsl", _ => Eq( - Array.init(64, i => i) |> Array.map(x => shift_left(1L, x)), + Array.map(x => shift_left(1L, x), Array.init(64, i => i)), [ 1L, 2L, @@ -379,7 +377,7 @@ let suites: Mt.pair_suites = /* "shift_right",(fun _ -> ( "lsr", _ => Eq( - Array.init(64, i => i) |> Array.map(x => shift_right_logical(-1L, x)), + Array.map(x => shift_right_logical(-1L, x), Array.init(64, i => i)), [ -1L, 9223372036854775807L, @@ -451,7 +449,7 @@ let suites: Mt.pair_suites = /* "shift_right",(fun _ -> ( "asr", _ => Eq( - Array.init(64, i => i) |> Array.map(x => shift_right(-1L, x)), + Array.map(x => shift_right(-1L, x), Array.init(64, i => i)), [ -1L, -1L, @@ -584,28 +582,34 @@ let suites: Mt.pair_suites = /* "shift_right",(fun _ -> \"@"( { let (a, b) = shift_left_tests - Ext_array_test.map2i( - (i, a, b) => ("shift_left_cases " ++ __unsafe_cast(i), _ => Mt.Eq(a, b)), - a, - b, - ) |> Array.to_list + Array.to_list( + Ext_array_test.map2i( + (i, a, b) => ("shift_left_cases " ++ __unsafe_cast(i), _ => Mt.Eq(a, b)), + a, + b, + ), + ) }, \"@"( { let (a, b) = shift_right_tests - Ext_array_test.map2i( - (i, a, b) => ("shift_right_cases " ++ __unsafe_cast(i), _ => Mt.Eq(a, b)), - a, - b, - ) |> Array.to_list + Array.to_list( + Ext_array_test.map2i( + (i, a, b) => ("shift_right_cases " ++ __unsafe_cast(i), _ => Mt.Eq(a, b)), + a, + b, + ), + ) }, { let (a, b) = shift_right_logical_suites - Ext_array_test.map2i( - (i, a, b) => ("shift_right_logical_cases " ++ __unsafe_cast(i), _ => Mt.Eq(a, b)), - a, - b, - ) |> Array.to_list + Array.to_list( + Ext_array_test.map2i( + (i, a, b) => ("shift_right_logical_cases " ++ __unsafe_cast(i), _ => Mt.Eq(a, b)), + a, + b, + ), + ) }, ), ), diff --git a/jscomp/test/int_hashtbl_test.res b/jscomp/test/int_hashtbl_test.res index 8312a9d5de..73f8e04b3d 100644 --- a/jscomp/test/int_hashtbl_test.res +++ b/jscomp/test/int_hashtbl_test.res @@ -14,7 +14,7 @@ let f = (module(H: Hashtbl.S with type key = int)) => { H.add(tbl, 2, '2') \"@@"( List.sort(((a: int, _), (b, _)) => compare(a, b), ...), - H.fold((k, v, acc) => list{(k, v), ...acc}, tbl, list{}), + H.fold((k, v, acc) => list{(k, v), ...acc}, tbl, list{}) ) } diff --git a/jscomp/test/internal_unused_test.res b/jscomp/test/internal_unused_test.res index 172028f365..437c3cf754 100644 --- a/jscomp/test/internal_unused_test.res +++ b/jscomp/test/internal_unused_test.res @@ -26,7 +26,7 @@ let f = () => raise(A) %%private( let d = c let f = d - let h = (. a, b) => a + b + let h = (a, b) => a + b ) %%private(let h0 = 1) @@ -51,14 +51,12 @@ Js.log(h2) Js.log(f) -Js.log(h(. 1, 2)) +Js.log(h(1, 2)) /* module%private X = Arg type x = X.spec */ /* [%%debugger.chrome] */ module H = () => { - %%private( - @module("./x") external x: int => int = "x" - ) + %%private(@module("./x") external x: int => int = "x") } diff --git a/jscomp/test/js_date_test.res b/jscomp/test/js_date_test.res index 2b19872c01..5ff6749503 100644 --- a/jscomp/test/js_date_test.res +++ b/jscomp/test/js_date_test.res @@ -6,15 +6,15 @@ let suites = { open Mt list{ ("valueOf", _ => Eq(195131516789., N.valueOf(date()))), - ("make", _ => Ok(N.make() |> N.getTime > 1487223505382.)), + ("make", _ => Ok(N.getTime(N.make()) > 1487223505382.)), ("parseAsFloat", _ => Eq(N.parseAsFloat("1976-03-08T12:34:56.789+01:23"), 195131516789.)), - ("parseAsFloat_invalid", _ => Ok(N.parseAsFloat("gibberish") |> Js_float.isNaN)), - ("fromFloat", _ => Eq("1976-03-08T11:11:56.789Z", N.fromFloat(195131516789.) |> N.toISOString)), + ("parseAsFloat_invalid", _ => Ok(Js_float.isNaN(N.parseAsFloat("gibberish")))), + ("fromFloat", _ => Eq("1976-03-08T11:11:56.789Z", N.toISOString(N.fromFloat(195131516789.)))), ( "fromString_valid", - _ => Eq(195131516789., N.fromString("1976-03-08T12:34:56.789+01:23") |> N.getTime), + _ => Eq(195131516789., N.getTime(N.fromString("1976-03-08T12:34:56.789+01:23"))), ), - ("fromString_invalid", _ => Ok(N.fromString("gibberish") |> N.getTime |> Js_float.isNaN)), + ("fromString_invalid", _ => Ok(Js_float.isNaN(N.getTime(N.fromString("gibberish"))))), ( "makeWithYM", _ => { diff --git a/jscomp/test/js_dict_test.res b/jscomp/test/js_dict_test.res index 8db793714c..e1e1716c7c 100644 --- a/jscomp/test/js_dict_test.res +++ b/jscomp/test/js_dict_test.res @@ -21,13 +21,10 @@ let suites = { ("entries", _ => Eq([("foo", 43), ("bar", 86)], entries(obj()))), ("values", _ => Eq([43, 86], values(obj()))), ("fromList - []", _ => Eq(empty(), fromList(list{}))), - ("fromList", _ => Eq([("x", 23), ("y", 46)], fromList(list{("x", 23), ("y", 46)}) |> entries)), + ("fromList", _ => Eq([("x", 23), ("y", 46)], entries(fromList(list{("x", 23), ("y", 46)})))), ("fromArray - []", _ => Eq(empty(), fromArray([]))), - ("fromArray", _ => Eq([("x", 23), ("y", 46)], fromArray([("x", 23), ("y", 46)]) |> entries)), - ( - "map", - _ => Eq({"foo": "43", "bar": "86"} |> Obj.magic, map((. i) => string_of_int(i), obj())), - ), + ("fromArray", _ => Eq([("x", 23), ("y", 46)], entries(fromArray([("x", 23), ("y", 46)])))), + ("map", _ => Eq(Obj.magic({"foo": "43", "bar": "86"}), map(i => string_of_int(i), obj()))), } } Mt.from_pair_suites(__MODULE__, suites) diff --git a/jscomp/test/js_float_test.res b/jscomp/test/js_float_test.res index 0d8f0f75fc..f8d855ca65 100644 --- a/jscomp/test/js_float_test.res +++ b/jscomp/test/js_float_test.res @@ -102,7 +102,7 @@ let suites = { ("fromString - 0x11", _ => Eq(17., fromString("0x11"))), ("fromString - 0b11", _ => Eq(3., fromString("0b11"))), ("fromString - 0o11", _ => Eq(9., fromString("0o11"))), - ("fromString - invalid string", _ => Eq(true, fromString("foo") |> isNaN)), + ("fromString - invalid string", _ => Eq(true, isNaN(fromString("foo")))), } } diff --git a/jscomp/test/js_json_test.res b/jscomp/test/js_json_test.res index 04086a7cce..2d0891af31 100644 --- a/jscomp/test/js_json_test.res +++ b/jscomp/test/js_json_test.res @@ -30,13 +30,15 @@ let () = { switch ty2 { | J.JSONArray(x) => /* compiler infer x : J.t array */ - x->Js.Array2.forEach(x => { - let ty3 = J.classify(x) - switch ty3 { - | J.JSONNumber(_) => () - | _ => assert(false) - } - }) |> (() => Mt.Ok(true)) + (() => Mt.Ok(true))( + x->Js.Array2.forEach(x => { + let ty3 = J.classify(x) + switch ty3 { + | J.JSONNumber(_) => () + | _ => assert(false) + } + }), + ) | _ => Mt.Ok(false) } | None => Mt.Ok(false) @@ -49,7 +51,7 @@ let () = { } let () = { - let json = J.null |> J.stringify |> J.parseExn + let json = J.parseExn(J.stringify(J.null)) let ty = J.classify(json) switch ty { | J.JSONNull => true_(__LOC__) @@ -60,7 +62,7 @@ let () = { } let () = { - let json = J.string("test string") |> J.stringify |> J.parseExn + let json = J.parseExn(J.stringify(J.string("test string"))) let ty = J.classify(json) switch ty { @@ -70,7 +72,7 @@ let () = { } let () = { - let json = J.number(1.23456789) |> J.stringify |> J.parseExn + let json = J.parseExn(J.stringify(J.number(1.23456789))) let ty = J.classify(json) switch ty { @@ -80,7 +82,7 @@ let () = { } let () = { - let json = J.number(float_of_int(0xAFAFAFAF)) |> J.stringify |> J.parseExn + let json = J.parseExn(J.stringify(J.number(float_of_int(0xAFAFAFAF)))) let ty = J.classify(json) switch ty { @@ -91,7 +93,7 @@ let () = { let () = { let test = v => { - let json = J.boolean(v) |> J.stringify |> J.parseExn + let json = J.parseExn(J.stringify(J.boolean(v))) let ty = J.classify(json) switch ty { @@ -117,7 +119,7 @@ let () = { Js_dict.set(dict, "a", J.string("test string")) Js_dict.set(dict, "b", J.number(123.0)) - let json = dict |> J.object_ |> J.stringify |> J.parseExn + let json = J.parseExn(J.stringify(J.object_(dict))) /* Make sure parsed as Object */ let ty = J.classify(json) @@ -189,12 +191,9 @@ let eq_at_i = (type a, loc: string, json: J.t, i: int, kind: J.Kind.t, expect } let () = { - let json = - ["string 0", "string 1", "string 2"] - |> Array.map(J.string) - |> J.array - |> J.stringify - |> J.parseExn + let json = J.parseExn( + J.stringify(J.array(Array.map(J.string, ["string 0", "string 1", "string 2"]))), + ) eq_at_i(__LOC__, json, 0, J.Kind.String, "string 0") eq_at_i(__LOC__, json, 1, J.Kind.String, "string 1") @@ -203,7 +202,7 @@ let () = { } let () = { - let json = ["string 0", "string 1", "string 2"] |> J.stringArray |> J.stringify |> J.parseExn + let json = J.parseExn(J.stringify(J.stringArray(["string 0", "string 1", "string 2"]))) eq_at_i(__LOC__, json, 0, J.Kind.String, "string 0") eq_at_i(__LOC__, json, 1, J.Kind.String, "string 1") @@ -213,7 +212,7 @@ let () = { let () = { let a = [1.0000001, 10000000000.1, 123.0] - let json = a |> J.numberArray |> J.stringify |> J.parseExn + let json = J.parseExn(J.stringify(J.numberArray(a))) /* Loop is unrolled to keep relevant location information */ eq_at_i(__LOC__, json, 0, J.Kind.Number, a[0]) @@ -224,7 +223,7 @@ let () = { let () = { let a = [0, 0xAFAFAFAF, 0xF000AABB] - let json = a |> Array.map(float_of_int) |> J.numberArray |> J.stringify |> J.parseExn + let json = J.parseExn(J.stringify(J.numberArray(Array.map(float_of_int, a)))) /* Loop is unrolled to keep relevant location information */ eq_at_i(__LOC__, json, 0, J.Kind.Number, float_of_int(a[0])) @@ -235,7 +234,7 @@ let () = { let () = { let a = [true, false, true] - let json = a |> J.booleanArray |> J.stringify |> J.parseExn + let json = J.parseExn(J.stringify(J.booleanArray(a))) /* Loop is unrolled to keep relevant location information */ eq_at_i(__LOC__, json, 0, J.Kind.Boolean, a[0]) @@ -253,7 +252,7 @@ let () = { } let a = [make_d("aaa", 123), make_d("bbb", 456)] - let json = a |> J.objectArray |> J.stringify |> J.parseExn + let json = J.parseExn(J.stringify(J.objectArray(a))) let ty = J.classify(json) switch ty { diff --git a/jscomp/test/js_null_test.res b/jscomp/test/js_null_test.res index 9dbeae2596..fb3eaa95df 100644 --- a/jscomp/test/js_null_test.res +++ b/jscomp/test/js_null_test.res @@ -3,18 +3,18 @@ open Js_null let suites = { open Mt list{ - ("toOption - empty", _ => Eq(None, empty |> toOption)), - ("toOption - 'a", _ => Eq(Some(), return() |> toOption)), - ("return", _ => Eq(Some("something"), return("something") |> toOption)), + ("toOption - empty", _ => Eq(None, toOption(empty))), + ("toOption - 'a", _ => Eq(Some(), toOption(return()))), + ("return", _ => Eq(Some("something"), toOption(return("something")))), ("test - empty", _ => Eq(true, empty == Js.null)), ("test - 'a", _ => Eq(false, return() == empty)), - ("bind - empty", _ => StrictEq(empty, bind(empty, (. v) => v))), - ("bind - 'a", _ => StrictEq(return(4), bind(return(2), (. n) => n * 2))), + ("bind - empty", _ => StrictEq(empty, bind(empty, v => v))), + ("bind - 'a", _ => StrictEq(return(4), bind(return(2), n => n * 2))), ( "iter - empty", _ => { let hit = ref(false) - let _ = iter(empty, (. _) => hit := true) + let _ = iter(empty, _ => hit := true) Eq(false, hit.contents) }, ), @@ -22,12 +22,12 @@ let suites = { "iter - 'a", _ => { let hit = ref(0) - let _ = iter(return(2), (. v) => hit := v) + let _ = iter(return(2), v => hit := v) Eq(2, hit.contents) }, ), - ("fromOption - None", _ => Eq(empty, None |> fromOption)), - ("fromOption - Some", _ => Eq(return(2), Some(2) |> fromOption)), + ("fromOption - None", _ => Eq(empty, fromOption(None))), + ("fromOption - Some", _ => Eq(return(2), fromOption(Some(2)))), } } Mt.from_pair_suites(__MODULE__, suites) diff --git a/jscomp/test/js_null_undefined_test.res b/jscomp/test/js_null_undefined_test.res index b1e025569f..81c5ab6935 100644 --- a/jscomp/test/js_null_undefined_test.res +++ b/jscomp/test/js_null_undefined_test.res @@ -3,24 +3,24 @@ open Js_null_undefined let suites = { open Mt list{ - ("toOption - null", _ => Eq(None, null |> toOption)), - ("toOption - undefined", _ => Eq(None, undefined |> toOption)), - ("toOption - empty", _ => Eq(None, undefined |> toOption)), - (__LOC__, _ => Eq(Some("foo"), return("foo") |> toOption)), - ("return", _ => Eq(Some("something"), return("something") |> toOption)), - ("test - null", _ => Eq(true, null |> isNullable)), - ("test - undefined", _ => Eq(true, undefined |> isNullable)), - ("test - empty", _ => Eq(true, undefined |> isNullable)), - (__LOC__, _ => Eq(true, return() |> isNullable)), - ("bind - null", _ => StrictEq(null, bind(null, (. v) => v))), - ("bind - undefined", _ => StrictEq(undefined, bind(undefined, (. v) => v))), - ("bind - empty", _ => StrictEq(undefined, bind(undefined, (. v) => v))), - ("bind - 'a", _ => Eq(return(4), bind(return(2), (. n) => n * 2))), + ("toOption - null", _ => Eq(None, toOption(null))), + ("toOption - undefined", _ => Eq(None, toOption(undefined))), + ("toOption - empty", _ => Eq(None, toOption(undefined))), + (__LOC__, _ => Eq(Some("foo"), toOption(return("foo")))), + ("return", _ => Eq(Some("something"), toOption(return("something")))), + ("test - null", _ => Eq(true, isNullable(null))), + ("test - undefined", _ => Eq(true, isNullable(undefined))), + ("test - empty", _ => Eq(true, isNullable(undefined))), + (__LOC__, _ => Eq(true, isNullable(return()))), + ("bind - null", _ => StrictEq(null, bind(null, v => v))), + ("bind - undefined", _ => StrictEq(undefined, bind(undefined, v => v))), + ("bind - empty", _ => StrictEq(undefined, bind(undefined, v => v))), + ("bind - 'a", _ => Eq(return(4), bind(return(2), n => n * 2))), ( "iter - null", _ => { let hit = ref(false) - let _ = iter(null, (. _) => hit := true) + let _ = iter(null, _ => hit := true) Eq(false, hit.contents) }, ), @@ -28,7 +28,7 @@ let suites = { "iter - undefined", _ => { let hit = ref(false) - let _ = iter(undefined, (. _) => hit := true) + let _ = iter(undefined, _ => hit := true) Eq(false, hit.contents) }, ), @@ -36,7 +36,7 @@ let suites = { "iter - empty", _ => { let hit = ref(false) - let _ = iter(undefined, (. _) => hit := true) + let _ = iter(undefined, _ => hit := true) Eq(false, hit.contents) }, ), @@ -44,12 +44,12 @@ let suites = { "iter - 'a", _ => { let hit = ref(0) - let _ = iter(return(2), (. v) => hit := v) + let _ = iter(return(2), v => hit := v) Eq(2, hit.contents) }, ), - ("fromOption - None", _ => Eq(undefined, None |> fromOption)), - ("fromOption - Some", _ => Eq(return(2), Some(2) |> fromOption)), + ("fromOption - None", _ => Eq(undefined, fromOption(None))), + ("fromOption - Some", _ => Eq(return(2), fromOption(Some(2)))), ("null <> undefined", _ => Ok(null != undefined)), ("null <> empty", _ => Ok(null != undefined)), ("undefined = empty", _ => Ok(undefined == undefined)), diff --git a/jscomp/test/js_obj_test.res b/jscomp/test/js_obj_test.res index e93bb138f2..8787d2f367 100644 --- a/jscomp/test/js_obj_test.res +++ b/jscomp/test/js_obj_test.res @@ -5,7 +5,7 @@ type x = {"say": int => int} let suites = { open Mt list{ - ("empty", _ => Eq(0, empty() |> keys |> Array.length)), + ("empty", _ => Eq(0, Array.length(keys(empty())))), ("assign", _ => Eq({"a": 1}, assign(empty(), {"a": 1}))), } } diff --git a/jscomp/test/js_option_test.res b/jscomp/test/js_option_test.res index 7b9ceda183..6ca8709354 100644 --- a/jscomp/test/js_option_test.res +++ b/jscomp/test/js_option_test.res @@ -1,4 +1,4 @@ -let simpleEq = (. a: int, b) => a == b +let simpleEq = (a: int, b) => a == b let option_suites = { open Mt @@ -18,29 +18,29 @@ let option_suites = { "option_andThen_SomeSome", _ => Eq( true, - Js.Option.isSomeValue(simpleEq, 3, Js.Option.andThen((. a) => Some(a + 1), Some(2))), + Js.Option.isSomeValue(simpleEq, 3, Js.Option.andThen(a => Some(a + 1), Some(2))), ), ), ( "option_andThen_SomeNone", - _ => Eq(false, Js.Option.isSomeValue(simpleEq, 3, Js.Option.andThen((. _) => None, Some(2)))), + _ => Eq(false, Js.Option.isSomeValue(simpleEq, 3, Js.Option.andThen(_ => None, Some(2)))), ), ( "option_map_Some", - _ => Eq(true, Js.Option.isSomeValue(simpleEq, 3, Js.Option.map((. a) => a + 1, Some(2)))), + _ => Eq(true, Js.Option.isSomeValue(simpleEq, 3, Js.Option.map(a => a + 1, Some(2)))), ), - ("option_map_None", _ => Eq(None, Js.Option.map((. a) => a + 1, None))), + ("option_map_None", _ => Eq(None, Js.Option.map(a => a + 1, None))), ("option_default_Some", _ => Eq(2, Js.Option.getWithDefault(3, Some(2)))), ("option_default_None", _ => Eq(3, Js.Option.getWithDefault(3, None))), ( "option_filter_Pass", _ => Eq( true, - Js.Option.isSomeValue(simpleEq, 2, Js.Option.filter((. a) => mod(a, 2) == 0, Some(2))), + Js.Option.isSomeValue(simpleEq, 2, Js.Option.filter(a => mod(a, 2) == 0, Some(2))), ), ), - ("option_filter_Reject", _ => Eq(None, Js.Option.filter((. a) => mod(a, 3) == 0, Some(2)))), - ("option_filter_None", _ => Eq(None, Js.Option.filter((. a) => mod(a, 3) == 0, None))), + ("option_filter_Reject", _ => Eq(None, Js.Option.filter(a => mod(a, 3) == 0, Some(2)))), + ("option_filter_None", _ => Eq(None, Js.Option.filter(a => mod(a, 3) == 0, None))), ( "option_firstSome_First", _ => Eq(true, Js.Option.isSomeValue(simpleEq, 3, Js.Option.firstSome(Some(3), Some(2)))), diff --git a/jscomp/test/js_re_test.res b/jscomp/test/js_re_test.res index ca800bfd97..21a0e6b550 100644 --- a/jscomp/test/js_re_test.res +++ b/jscomp/test/js_re_test.res @@ -68,7 +68,7 @@ let suites = { "result_index", _ => switch "zbar"->Js.Re.fromString->Js.Re.exec_("foobarbazbar") { - | Some(res) => Eq(8, res |> Js.Re.index) + | Some(res) => Eq(8, Js.Re.index(res)) | None => Fail() }, ), @@ -78,7 +78,7 @@ let suites = { let input = "foobar" switch /foo/g->Js.Re.exec_(input) { - | Some(res) => Eq(input, res |> Js.Re.input) + | Some(res) => Eq(input, Js.Re.input(res)) | None => Fail() } }, diff --git a/jscomp/test/js_string_test.res b/jscomp/test/js_string_test.res index 4c55d469ef..f2f46f6767 100644 --- a/jscomp/test/js_string_test.res +++ b/jscomp/test/js_string_test.res @@ -42,10 +42,7 @@ let suites = { /* es2015 */ ("repeat", _ => Eq("foofoofoo", "foo"->Js.String2.repeat(3))), ("replace", _ => Eq("fooBORKbaz", "foobarbaz"->Js.String2.replace("bar", "BORK"))), - ( - "replaceByRe", - _ => Eq("fooBORKBORK", "foobarbaz"->Js.String2.replaceByRe(/ba./g, "BORK")), - ), + ("replaceByRe", _ => Eq("fooBORKBORK", "foobarbaz"->Js.String2.replaceByRe(/ba./g, "BORK"))), ( "unsafeReplaceBy0", _ => { @@ -107,14 +104,14 @@ let suites = { "splitByRe", _ => Eq( [Some("a"), Some("#"), None, Some("b"), Some("#"), Some(":"), Some("c")], - "a#b#:c" |> Js.String.splitByRe(/(#)(:)?/), + Js.String.splitByRe(/(#)(:)?/, "a#b#:c"), ), ), ( "splitByReAtMost", _ => Eq( [Some("a"), Some("#"), None], - "a#b#:c" |> Js.String.splitByReAtMost(/(#)(:)?/, ~limit=3), + Js.String.splitByReAtMost(/(#)(:)?/, ~limit=3, "a#b#:c"), ), ), /* es2015 */ diff --git a/jscomp/test/js_undefined_test.res b/jscomp/test/js_undefined_test.res index 29753e7384..c5c7e1012a 100644 --- a/jscomp/test/js_undefined_test.res +++ b/jscomp/test/js_undefined_test.res @@ -3,18 +3,18 @@ open Js_undefined let suites = { open Mt list{ - ("toOption - empty", _ => Eq(None, empty |> toOption)), - (__LOC__, _ => Eq(None, return() |> toOption)), - ("return", _ => Eq(Some("something"), return("something") |> toOption)), + ("toOption - empty", _ => Eq(None, toOption(empty))), + (__LOC__, _ => Eq(None, toOption(return()))), + ("return", _ => Eq(Some("something"), toOption(return("something")))), ("test - empty", _ => Eq(true, empty == Js.undefined)), (__LOC__, _ => Eq(true, return() == Js.undefined)), - ("bind - empty", _ => Eq(empty, bind(empty, (. v) => v))), - ("bind - 'a", _ => Eq(return(4), bind(return(2), (. n) => n * 2))), + ("bind - empty", _ => Eq(empty, bind(empty, v => v))), + ("bind - 'a", _ => Eq(return(4), bind(return(2), n => n * 2))), ( "iter - empty", _ => { let hit = ref(false) - let _ = iter(empty, (. _) => hit := true) + let _ = iter(empty, _ => hit := true) Eq(false, hit.contents) }, ), @@ -22,12 +22,12 @@ let suites = { "iter - 'a", _ => { let hit = ref(0) - let _ = iter(return(2), (. v) => hit := v) + let _ = iter(return(2), v => hit := v) Eq(2, hit.contents) }, ), - ("fromOption - None", _ => Eq(empty, None |> fromOption)), - ("fromOption - Some", _ => Eq(return(2), Some(2) |> fromOption)), + ("fromOption - None", _ => Eq(empty, fromOption(None))), + ("fromOption - Some", _ => Eq(return(2), fromOption(Some(2)))), } } Mt.from_pair_suites(__MODULE__, suites) diff --git a/jscomp/test/jsxv4_newtype.res b/jscomp/test/jsxv4_newtype.res index 62919a8284..64b48c9823 100644 --- a/jscomp/test/jsxv4_newtype.res +++ b/jscomp/test/jsxv4_newtype.res @@ -1,6 +1,6 @@ @@config({ - flags: ["-bs-jsx", "4"], - }) + flags: ["-bs-jsx", "4"], +}) module V4A = { @react.component @@ -9,7 +9,7 @@ module V4A = { module V4A1 = { @react.component - let make = (type x y, ~a:x, ~b:array, ~c:'a) => React.null + let make = (type x y, ~a: x, ~b: array, ~c: 'a) => React.null } module type T = { diff --git a/jscomp/test/keep_uncurry_attribute.res b/jscomp/test/keep_uncurry_attribute.res index 80cfe6eeb4..e0195ece82 100644 --- a/jscomp/test/keep_uncurry_attribute.res +++ b/jscomp/test/keep_uncurry_attribute.res @@ -1,5 +1,5 @@ -external map1: (array<'a>, ('a => 'b)) => array<'b> = "map" +external map1: (array<'a>, 'a => 'b) => array<'b> = "map" let map1 = map1 -external map2: (array<'a>, ('a => 'b)) => array<'b> = "map" +external map2: (array<'a>, 'a => 'b) => array<'b> = "map" let map2 = map2 diff --git a/jscomp/test/key_word_property_plus_test.res b/jscomp/test/key_word_property_plus_test.res index c8a3639c40..88adb2f22b 100644 --- a/jscomp/test/key_word_property_plus_test.res +++ b/jscomp/test/key_word_property_plus_test.res @@ -11,10 +11,7 @@ let () = eq( Js.Array2.reduce([1, 2, 3, 4], \"+", 0), { open Global_mangles - __dirname + - __filename + - exports + - require + __dirname + __filename + exports + require }, ) diff --git a/jscomp/test/label_uncurry.res b/jscomp/test/label_uncurry.res index 3e64de08b3..0cb0f00920 100644 --- a/jscomp/test/label_uncurry.res +++ b/jscomp/test/label_uncurry.res @@ -1,17 +1,17 @@ -type t = (. ~x: int, ~y: string) => int +type t = (~x: int, ~y: string) => int -type u = (. ~x: int, ~y: string) => int +type u = (~x: int, ~y: string) => int let f = (x: t): u => x -let u: u = (. ~x, ~y) => x + int_of_string(y) +let u: u = (~x, ~y) => x + int_of_string(y) let u1 = (f: u) => { - f(. ~y="x", ~x=2)->Js.log - f(. ~x=2, ~y="x")->Js.log + f(~y="x", ~x=2)->Js.log + f(~x=2, ~y="x")->Js.log } -let h = (. ~x : unit) => 3 +let h = (~x: unit) => 3 let a = u1(u) -type u0 = (. ~x: int=?, ~y: string) => int +type u0 = (~x: int=?, ~y: string) => int diff --git a/jscomp/test/lazy_test.res b/jscomp/test/lazy_test.res index 00b9bd7c32..755af29dd8 100644 --- a/jscomp/test/lazy_test.res +++ b/jscomp/test/lazy_test.res @@ -1,5 +1,5 @@ let u = ref(3) -let v = Lazy.from_fun(() => (u := 32)) +let v = Lazy.from_fun(() => u := 32) let lazy_test = () => { let h = u.contents @@ -45,9 +45,9 @@ let forward_test = Lazy.from_fun(() => { }) /* module Mt = Mock_mt */ -let f005 = Lazy.from_fun(() => (1 + 2 + 3)) +let f005 = Lazy.from_fun(() => 1 + 2 + 3) -let f006: lazy_t<() => int> = Lazy.from_fun(() => { +let f006: lazy_t int> = Lazy.from_fun(() => { let x = 3 _ => x }) @@ -63,7 +63,7 @@ let a2 = x => Lazy.from_val(x) let a3 = Lazy.from_val(3) let a4 = a2(3) let a5 = Lazy.from_val(None) -let a6 = Lazy.from_val(()) +let a6 = Lazy.from_val() let a7 = Lazy.force(a5) let a8 = Lazy.force(a6) @@ -78,7 +78,10 @@ Mt.from_pair_suites( ("lazy_force", _ => Eq(u_v.contents, 2)), ("lazy_from_fun", _ => Eq(Lazy.force(l_from_fun), 3)), ("lazy_from_val", _ => Eq(Lazy.force(Lazy.from_val(3)), 3)), - ("lazy_from_val2", _ => Eq(\"@@"(Lazy.force, Lazy.force(Lazy.from_val(Lazy.from_fun(() => 3)))), 3)), + ( + "lazy_from_val2", + _ => Eq(\"@@"(Lazy.force, Lazy.force(Lazy.from_val(Lazy.from_fun(() => 3)))), 3), + ), ( "lazy_from_val3", _ => Eq( diff --git a/jscomp/test/libqueue_test.res b/jscomp/test/libqueue_test.res index d5a33beb89..528c28b515 100644 --- a/jscomp/test/libqueue_test.res +++ b/jscomp/test/libqueue_test.res @@ -13,7 +13,7 @@ module Q = { include Queue - let to_list = q => fold((l, x) => list{x, ...l}, list{}, q) |> List.rev + let to_list = q => List.rev(fold((l, x) => list{x, ...l}, list{}, q)) } let does_raise = (f, q) => diff --git a/jscomp/test/map_find_test.res b/jscomp/test/map_find_test.res index 01fbd4e782..43cf4300f8 100644 --- a/jscomp/test/map_find_test.res +++ b/jscomp/test/map_find_test.res @@ -27,7 +27,7 @@ include ( \"@@"( Mt.from_pair_suites(__MODULE__, ...), - list{("int", _ => Eq(IntMap.find(10, m), 'a')), ("string", _ => Eq(SMap.find("10", s), 'a'))}, + list{("int", _ => Eq(IntMap.find(10, m), 'a')), ("string", _ => Eq(SMap.find("10", s), 'a'))} ) }: {} ) diff --git a/jscomp/test/mario_game.res b/jscomp/test/mario_game.res index dda93f8aa2..1b355f7c9b 100644 --- a/jscomp/test/mario_game.res +++ b/jscomp/test/mario_game.res @@ -1464,7 +1464,7 @@ module Draw: { /* Displays the fps. */ let fps = (canvas, fps_val) => { - let fps_str = int_of_float(fps_val) |> string_of_int + let fps_str = string_of_int(int_of_float(fps_val)) let canvas = Dom_html.canvasElementToJsObj(canvas) let context = Dom_html.canvasRenderingContext2DToJsObj(canvas["getContext"]("2d")) \"@@"(ignore, context["fillText"](fps_str, 10., 18.)) diff --git a/jscomp/test/more_poly_variant_test.res b/jscomp/test/more_poly_variant_test.res index b7ee7f9ab1..b471c3bb82 100644 --- a/jscomp/test/more_poly_variant_test.res +++ b/jscomp/test/more_poly_variant_test.res @@ -1,11 +1,10 @@ type rec vlist<'a> = [#Nil | #Cons('a, vlist<'a>)] -let rec map = (f): (vlist<'a> => vlist<'b>) => - x => - switch x { - | #Nil => #Nil - | #Cons(a, l) => #Cons(f(. a), map(f)(l)) - } +let rec map = (f): (vlist<'a> => vlist<'b>) => x => + switch x { + | #Nil => #Nil + | #Cons(a, l) => #Cons(f(a), map(f)(l)) + } let split_cases = x => switch x { diff --git a/jscomp/test/mt.res b/jscomp/test/mt.res index beef506e02..86224cc2c2 100644 --- a/jscomp/test/mt.res +++ b/jscomp/test/mt.res @@ -1,8 +1,8 @@ -@val external describe: (string, (. unit) => unit) => unit = "describe" +@val external describe: (string, unit => unit) => unit = "describe" -@val external it: (string, (unit => unit)) => unit = "it" +@val external it: (string, unit => unit) => unit = "it" -@val external it_promise: (string, (unit => Js.Promise.t<_>)) => unit = "it" +@val external it_promise: (string, unit => Js.Promise.t<_>) => unit = "it" @val @module("assert") external eq: ('a, 'a) => unit = "deepEqual" @@ -18,9 +18,7 @@ @val @variadic external dump: array<'a> => unit = "console.log" -@val -@module("assert") -/** There is a problem -- +@val @module("assert") /** There is a problem -- it does not return [unit] */ external throws: (unit => unit) => unit = "throws" @@ -248,20 +246,19 @@ let old_from_promise_suites_donotuse = (name, suites: list<(string, Js.Promise.t switch Array.to_list(argv) { | list{cmd, ..._} => if is_mocha() { - describe(name, (. ()) => - suites |> List.iter(((name, code)) => + describe(name, () => List.iter(((name, code)) => it_promise( name, _ => - code |> Js.Promise.then_( + Js.Promise.then_( x => { handleCode(x) val_unit }, + code, ), ) - ) - ) + , suites)) } else { Js.log("promise suites") } /* TODO */ diff --git a/jscomp/test/mutable_obj_test.res b/jscomp/test/mutable_obj_test.res index 6b9a080d48..e4c3904a1f 100644 --- a/jscomp/test/mutable_obj_test.res +++ b/jscomp/test/mutable_obj_test.res @@ -9,4 +9,4 @@ let f = (x: {@set({no_get: no_get}) "height": int}) => x["height"] = 3 type v = {@set "dec": int => {"x": int, "y": float}} -let f = (x: v) => x["dec"] = (x) => {"x": x, "y": float_of_int(x)} +let f = (x: v) => x["dec"] = x => {"x": x, "y": float_of_int(x)} diff --git a/jscomp/test/mutable_uncurry_test.res b/jscomp/test/mutable_uncurry_test.res index 3754f69662..3792510b37 100644 --- a/jscomp/test/mutable_uncurry_test.res +++ b/jscomp/test/mutable_uncurry_test.res @@ -8,21 +8,21 @@ let suites: ref = ref(list{}) let test_id = ref(0) let eqs = (loc, x, y) => Mt.eq_suites(~test_id, ~suites, loc, x, y) -let eq = (. {contents: (x: int)}, {contents: y}) => x == y +let eq = ({contents: (x: int)}, {contents: y}) => x == y -let eq2 = (. x, {contents: y}) => x.contents == y +let eq2 = (x, {contents: y}) => x.contents == y -eqs(__LOC__, false, eq(. ref(1), ref(2))) -eqs(__LOC__, true, eq(. ref(2), ref(2))) +eqs(__LOC__, false, eq(ref(1), ref(2))) +eqs(__LOC__, true, eq(ref(2), ref(2))) -let ut3 = (. {contents: x0}, {contents: x1}, {contents: x2}) => (x0, x1, x2) +let ut3 = ({contents: x0}, {contents: x1}, {contents: x2}) => (x0, x1, x2) let t3 = ({contents: x0}, {contents: x1}, {contents: x2}) => (x0, x1, x2) -let ut4 = (. {contents: x0}, {contents: x1}, {contents: x2}, {contents: x3}) => (x0, x1, x2, x3) +let ut4 = ({contents: x0}, {contents: x1}, {contents: x2}, {contents: x3}) => (x0, x1, x2, x3) let t4 = ({contents: x0}, {contents: x1}, {contents: x2}, {contents: x3}) => (x0, x1, x2, x3) -let ut5 = (. {contents: x0}, {contents: x1}, {contents: x2}, {contents: x3}, {contents: x4}) => ( +let ut5 = ({contents: x0}, {contents: x1}, {contents: x2}, {contents: x3}, {contents: x4}) => ( x0, x1, x2, @@ -38,18 +38,18 @@ let t5 = ({contents: x0}, {contents: x1}, {contents: x2}, {contents: x3}, {conte x4, ) -let nested0 = (. {contents: x0}, {contents: x1}, {contents: x2}) => { +let nested0 = ({contents: x0}, {contents: x1}, {contents: x2}) => { let a = x0 + x1 + x2 ({contents: x0}, {contents: x1}, {contents: x2}) => a + x0 + x1 + x2 } let nested1 = ({contents: x0}, {contents: x1}, {contents: x2}) => { let a = x0 + x1 + x2 - (. {contents: x0}, {contents: x1}, {contents: x2}) => a + x0 + x1 + x2 + ({contents: x0}, {contents: x1}, {contents: x2}) => a + x0 + x1 + x2 } -eqs(__LOC__, ut3(. ref(1), ref(2), ref(3)), (1, 2, 3)) +eqs(__LOC__, ut3(ref(1), ref(2), ref(3)), (1, 2, 3)) eqs(__LOC__, t3(ref(1), ref(2), ref(3)), (1, 2, 3)) -eqs(__LOC__, ut5(. ref(1), ref(2), ref(3), ref(1), ref(1)), (1, 2, 3, 1, 1)) +eqs(__LOC__, ut5(ref(1), ref(2), ref(3), ref(1), ref(1)), (1, 2, 3, 1, 1)) Mt.from_pair_suites(__FILE__, suites.contents) diff --git a/jscomp/test/noassert.res b/jscomp/test/noassert.res index fcc6aa74da..453f9e8ba1 100644 --- a/jscomp/test/noassert.res +++ b/jscomp/test/noassert.res @@ -1,3 +1,3 @@ -let f = () => assert (false) +let f = () => assert(false) -let h = () => assert (3 > 2) +let h = () => assert(3 > 2) diff --git a/jscomp/test/node_assert.res b/jscomp/test/node_assert.res index 69be2a90c2..9892c1d550 100644 --- a/jscomp/test/node_assert.res +++ b/jscomp/test/node_assert.res @@ -4,4 +4,5 @@ @module("node:assert") external notDeepEqual: ('a, 'a, ~message: string=?) => unit = "notDeepStrictEqual" @module("node:assert") external fail: (~message: string=?) => unit = "fail" -@module("node:assert") external throws: (unit => unit, ~error: 'a=?, ~message: string=?) => unit = "throws" +@module("node:assert") +external throws: (unit => unit, ~error: 'a=?, ~message: string=?) => unit = "throws" diff --git a/jscomp/test/number_lexer.res b/jscomp/test/number_lexer.res index 78b10be679..25ae7eaa4a 100644 --- a/jscomp/test/number_lexer.res +++ b/jscomp/test/number_lexer.res @@ -2,110 +2,110 @@ let l = log let __ocaml_lex_tables = { - Lexing.lex_base: "\000\000\246\255\247\255\248\255\249\255\250\255\251\255\252\255\ - \058\000\133\000\255\255", - Lexing.lex_backtrk: "\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \002\000\001\000\255\255", - Lexing.lex_default: "\255\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \255\255\255\255\000\000", - Lexing.lex_trans: "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\010\000\010\000\000\000\000\000\010\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \003\000\002\000\005\000\007\000\000\000\006\000\000\000\004\000\ - \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\ - \009\000\009\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\009\000\009\000\009\000\ - \009\000\009\000\009\000\009\000\009\000\009\000\009\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000", - Lexing.lex_check: "\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\000\000\000\000\255\255\255\255\000\000\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \000\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \000\000\000\000\000\000\000\000\255\255\000\000\255\255\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\255\255\255\255\255\255\255\255\255\255\ - \255\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ - \000\000\000\000\000\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\255\255\255\255\255\255\ - \255\255\255\255\255\255\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\ - \008\000\008\000\008\000\008\000\008\000\009\000\009\000\009\000\ - \009\000\009\000\009\000\009\000\009\000\009\000\009\000\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \000\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ - \255\255\255\255\255\255\255\255\255\255\255\255", + Lexing.lex_base: "\x00\x00\xf6\xff\xf7\xff\xf8\xff\xf9\xff\xfa\xff\xfb\xff\xfc\xff\ + \x3a\x00\x85\x00\xff\xff", + Lexing.lex_backtrk: "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \x02\x00\x01\x00\xff\xff", + Lexing.lex_default: "\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \xff\xff\xff\xff\x00\x00", + Lexing.lex_trans: "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x0a\x00\x0a\x00\x00\x00\x00\x00\x0a\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x03\x00\x02\x00\x05\x00\x07\x00\x00\x00\x06\x00\x00\x00\x04\x00\ + \x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\ + \x09\x00\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x09\x00\x09\x00\x09\x00\ + \x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + Lexing.lex_check: "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ + \x00\x00\x00\x00\x00\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\ + \x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x09\x00\x09\x00\x09\x00\ + \x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\ + \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", Lexing.lex_base_code: "", Lexing.lex_backtrk_code: "", Lexing.lex_default_code: "", diff --git a/jscomp/test/obj_literal_ppx.res b/jscomp/test/obj_literal_ppx.res index fc67f22b55..50b30a939b 100644 --- a/jscomp/test/obj_literal_ppx.res +++ b/jscomp/test/obj_literal_ppx.res @@ -1,6 +1,6 @@ let a = {"x": 3, "y": [1]} -let b = {"x": 3, "y": [1], "z": 3, "u": (. x, y) => x + y} +let b = {"x": 3, "y": [1], "z": 3, "u": (x, y) => x + y} let f = obj => obj["x"] + Array.length(obj["y"]) diff --git a/jscomp/test/ocaml_re_test.res b/jscomp/test/ocaml_re_test.res index ff4b072d84..39f07bb0b2 100644 --- a/jscomp/test/ocaml_re_test.res +++ b/jscomp/test/ocaml_re_test.res @@ -769,8 +769,7 @@ module Re_automata: { let reset_table = a => Array.fill(a, 0, Array.length(a), false) - let rec mark_used_indices = tbl => - List.iter(x => + let rec mark_used_indices = tbl => List.iter(x => switch x { | E.TSeq(l, _, _) => mark_used_indices(tbl)(l) | E.TExp(marks, _) @@ -780,8 +779,8 @@ module Re_automata: { tbl[i] = true } , marks.Marks.marks) - }, ... - ) + } + , ...) let rec find_free = (tbl, idx, len) => if idx == len || !tbl[idx] { @@ -805,11 +804,11 @@ module Re_automata: { /* *** Computation of the next state *** */ let remove_matches = List.filter(x => - switch x { - | E.TMatch(_) => false - | _ => true - }, ... - ) + switch x { + | E.TMatch(_) => false + | _ => true + } + , ...) let rec split_at_match_rec = (l', x) => switch x { @@ -1249,16 +1248,16 @@ module Re: { @raise Not_found if the regular expression can't be found in [str] ") let exec: ( - ~pos: int /* Default: 0 */=?, - ~len: int /* Default: -1 (until end of string) */=?, + ~pos: int=? /* Default: 0 */, + ~len: int=? /* Default: -1 (until end of string) */, re, string, ) => groups @ocaml.doc(" Similar to {!exec}, but returns an option instead of using an exception. ") let exec_opt: ( - ~pos: int /* Default: 0 */=?, - ~len: int /* Default: -1 (until end of string) */=?, + ~pos: int=? /* Default: 0 */, + ~len: int=? /* Default: -1 (until end of string) */, re, string, ) => option @@ -1266,16 +1265,16 @@ module Re: { @ocaml.doc(" Similar to {!exec}, but returns [true] if the expression matches, and [false] if it doesn't ") let execp: ( - ~pos: int /* Default: 0 */=?, - ~len: int /* Default: -1 (until end of string) */=?, + ~pos: int=? /* Default: 0 */, + ~len: int=? /* Default: -1 (until end of string) */, re, string, ) => bool @ocaml.doc(" More detailed version of {!exec_p} ") let exec_partial: ( - ~pos: int /* Default: 0 */=?, - ~len: int /* Default: -1 (until end of string) */=?, + ~pos: int=? /* Default: 0 */, + ~len: int=? /* Default: -1 (until end of string) */, re, string, ) => [#Full | #Partial | #Mismatch] diff --git a/jscomp/test/omit_trailing_undefined_in_external_calls.res b/jscomp/test/omit_trailing_undefined_in_external_calls.res index 07b4ac6e3e..d800e4abb5 100644 --- a/jscomp/test/omit_trailing_undefined_in_external_calls.res +++ b/jscomp/test/omit_trailing_undefined_in_external_calls.res @@ -16,4 +16,4 @@ let x = floatToString(42.) @new external regExpFromString: (string, ~flags: string=?) => Js.Re.t = "RegExp" -let x = regExpFromString("ab+c") \ No newline at end of file +let x = regExpFromString("ab+c") diff --git a/jscomp/test/option_repr_test.res b/jscomp/test/option_repr_test.res index 2d23dc3a1e..fe90e64f60 100644 --- a/jscomp/test/option_repr_test.res +++ b/jscomp/test/option_repr_test.res @@ -138,7 +138,7 @@ let all_true = xs => Belt.List.every(xs, x => x) ltx(None, Some(Js.null)), ltx(None, Some(x => x)), ltx(Some(Js.null), Some(Js.Null.return(3))), - }), + }) ) \"@@"( @@ -149,7 +149,7 @@ let all_true = xs => Belt.List.every(xs, x => x) eqx(Some(None), Some(None)), eqx(Some(Some(None)), Some(Some(None))), neqx(Some(Some(Some(None))), Some(Some(None))), - }), + }) ) module N0 = { diff --git a/jscomp/test/optional_ffi_test.res b/jscomp/test/optional_ffi_test.res index 6ffdbed5ec..938eb24d4f 100644 --- a/jscomp/test/optional_ffi_test.res +++ b/jscomp/test/optional_ffi_test.res @@ -21,17 +21,17 @@ let z = xx(~x=2 + 3, ~y=3, ()) let () = eq(__LOC__, ((u, z), (6, 8))) let counter = ref(0) -let side_effect = (. x) => { +let side_effect = x => { incr(x) x.contents } -let bug_to_fix = (f, x) => xx(~x=f(. x), ~y=3, ()) /* : [f x] is done once */ +let bug_to_fix = (f, x) => xx(~x=f(x), ~y=3, ()) /* : [f x] is done once */ -let bug_to_fix2 = (f, x) => xx(~x=?f(. x), ~y=3, ()) /* : [f x] is done once */ +let bug_to_fix2 = (f, x) => xx(~x=?f(x), ~y=3, ()) /* : [f x] is done once */ let counter2 = ref(0) -let side_effect2 = (. x) => { +let side_effect2 = x => { incr(x) Some(x.contents) } diff --git a/jscomp/test/pipe_send_readline.res b/jscomp/test/pipe_send_readline.res index 04ef69f0d4..b5d8403112 100644 --- a/jscomp/test/pipe_send_readline.res +++ b/jscomp/test/pipe_send_readline.res @@ -6,11 +6,11 @@ external on: ( readline as 'self, @string [ - | #line((. string) => unit) - | #close((. unit) => unit) + | #line(string => unit) + | #close(unit => unit) ], ) => 'self = "on" -let u = rl => rl->on(#line((. x) => Js.log(x)))->on(#close((. ()) => Js.log("finished"))) +let u = rl => rl->on(#line(x => Js.log(x)))->on(#close(() => Js.log("finished"))) @send external send: ({"hi": int} as 'self, string) => 'self = "send" diff --git a/jscomp/test/poly_variant_test.res b/jscomp/test/poly_variant_test.res index 1a49b579f3..05de66f6df 100644 --- a/jscomp/test/poly_variant_test.res +++ b/jscomp/test/poly_variant_test.res @@ -32,13 +32,14 @@ type u = [ | #on_closed | #on_open | #in_ - /* [@as "in"] TODO: warning test */ ] +/* [@as "in"] TODO: warning test */ /* indeed we have a warning here */ /* TODO: add warning test */ -/** when marshall, make sure location does not matter */ @val +/** when marshall, make sure location does not matter */ +@val external test_string_type: (~flag: @string [#on_closed | #on_open | @as("in") #in_]) => string = "hey_string" @@ -80,14 +81,14 @@ external on: ( readline, @string [ - | #line((. string) => unit) - | #close((. ()) => unit) + | #line(string => unit) + | #close(unit => unit) ], ) => unit = "on" let register = readline => { - on(readline, #line((. s) => Js.log(s))) - on(readline, #close((. ()) => Js.log("finished"))) + on(readline, #line(s => Js.log(s))) + on(readline, #close(() => Js.log("finished"))) } /* external on : */ @@ -101,8 +102,8 @@ external on2: ( readline, @string [ - | #line((. string) => unit) - | #close((. unit) => unit) + | #line(string => unit) + | #close(unit => unit) ], ) => unit = "on2" diff --git a/jscomp/test/poly_variant_test.resi b/jscomp/test/poly_variant_test.resi index e69de29bb2..8b13789179 100644 --- a/jscomp/test/poly_variant_test.resi +++ b/jscomp/test/poly_variant_test.resi @@ -0,0 +1 @@ + diff --git a/jscomp/test/polymorphism_test.res b/jscomp/test/polymorphism_test.res index f66e60e697..ad545196c9 100644 --- a/jscomp/test/polymorphism_test.res +++ b/jscomp/test/polymorphism_test.res @@ -2,6 +2,6 @@ let rec map = (f, x) => switch x { | list{} => list{} | list{a, ...l} => - let r = f(. a) + let r = f(a) list{r, ...map(f, l)} } diff --git a/jscomp/test/polymorphism_test.resi b/jscomp/test/polymorphism_test.resi index f74d1bcc68..5f7c7900d2 100644 --- a/jscomp/test/polymorphism_test.resi +++ b/jscomp/test/polymorphism_test.resi @@ -1 +1 @@ -let map: ((. 'a) => 'b, list<'a>) => list<'b> +let map: ('a => 'b, list<'a>) => list<'b> diff --git a/jscomp/test/ppx_apply_test.res b/jscomp/test/ppx_apply_test.res index b85c2d8a08..a7f320500c 100644 --- a/jscomp/test/ppx_apply_test.res +++ b/jscomp/test/ppx_apply_test.res @@ -6,17 +6,17 @@ let eq = (loc, x, y) => { list{(loc ++ (" id " ++ string_of_int(test_id.contents)), _ => Mt.Eq(x, y)), ...suites.contents} } -let u = ((. a, b) => a + b)(. 1, 2) +let u = ((a, b) => a + b)(1, 2) -let nullary = (. ()) => 3 +let nullary = () => 3 -let unary = (. a) => a + 3 +let unary = a => a + 3 -let xx = unary(. 3) +let xx = unary(3) let () = eq(__LOC__, u, 3) -@val external f: (. int) => int = "xx" +@val external f: int => int = "xx" -let h = a => f(. a) +let h = a => f(a) Mt.from_pair_suites(__MODULE__, suites.contents) diff --git a/jscomp/test/queue_test.res b/jscomp/test/queue_test.res index 128527366a..022a6ac1a6 100644 --- a/jscomp/test/queue_test.res +++ b/jscomp/test/queue_test.res @@ -18,9 +18,8 @@ module Test = (Queue: module type of Queue) => { } /* - TODO: Note it needs need recursive values support */ - /* let _ = queue_1 [|38|] */ - + TODO: Note it needs need recursive values support */ + /* let _ = queue_1 [|38|] */ } module T1 = Test(Queue) diff --git a/jscomp/test/random_test.res b/jscomp/test/random_test.res index 6bf9f50034..e48ccdb91a 100644 --- a/jscomp/test/random_test.res +++ b/jscomp/test/random_test.res @@ -5,8 +5,7 @@ let eq = f => Mt_global.collect_eq(id, suites, f, ...) let neq = f => Mt_global.collect_neq(id, suites, f, ...) let approx = f => Mt_global.collect_approx(id, suites, f, ...) -let () = neq( - __LOC__)( +let () = neq(__LOC__)( { Random.self_init() Random.int(10000) diff --git a/jscomp/test/raw_output_test.res b/jscomp/test/raw_output_test.res index c539e8b359..736cb3b17d 100644 --- a/jscomp/test/raw_output_test.res +++ b/jscomp/test/raw_output_test.res @@ -11,4 +11,4 @@ let mk = fn => fn() */ mk(%raw(`(_)=> console.log('should works')`)) -Js.log(((. ()) => 1)(.)) +Js.log((() => 1)()) diff --git a/jscomp/test/react.res b/jscomp/test/react.res index 7363e6b0ea..41145195a0 100644 --- a/jscomp/test/react.res +++ b/jscomp/test/react.res @@ -139,7 +139,7 @@ module SuspenseList = { * only way to safely have any type of state and be able to update it correctly. */ @module("react") -external useState: ((unit => 'state)) => ('state, ('state => 'state) => unit) = "useState" +external useState: (unit => 'state) => ('state, ('state => 'state) => unit) = "useState" @module("react") external useReducer: (('state, 'action) => 'state, 'state) => ('state, 'action => unit) = @@ -149,122 +149,99 @@ external useReducer: (('state, 'action) => 'state, 'state) => ('state, 'action = external useReducerWithMapState: ( ('state, 'action) => 'state, 'initialState, - ('initialState => 'state), + 'initialState => 'state, ) => ('state, 'action => unit) = "useReducer" @module("react") -external useEffect: ((unit => option unit>)) => unit = "useEffect" +external useEffect: (unit => option unit>) => unit = "useEffect" @module("react") -external useEffect0: ((unit => option unit>), @as(json`[]`) _) => unit = - "useEffect" +external useEffect0: (unit => option unit>, @as(json`[]`) _) => unit = "useEffect" @module("react") -external useEffect1: ((unit => option unit>), array<'a>) => unit = "useEffect" +external useEffect1: (unit => option unit>, array<'a>) => unit = "useEffect" @module("react") -external useEffect2: ((unit => option unit>), ('a, 'b)) => unit = "useEffect" +external useEffect2: (unit => option unit>, ('a, 'b)) => unit = "useEffect" @module("react") -external useEffect3: ((unit => option unit>), ('a, 'b, 'c)) => unit = "useEffect" +external useEffect3: (unit => option unit>, ('a, 'b, 'c)) => unit = "useEffect" @module("react") -external useEffect4: ((unit => option unit>), ('a, 'b, 'c, 'd)) => unit = - "useEffect" +external useEffect4: (unit => option unit>, ('a, 'b, 'c, 'd)) => unit = "useEffect" @module("react") -external useEffect5: ((unit => option unit>), ('a, 'b, 'c, 'd, 'e)) => unit = - "useEffect" +external useEffect5: (unit => option unit>, ('a, 'b, 'c, 'd, 'e)) => unit = "useEffect" @module("react") -external useEffect6: ((unit => option unit>), ('a, 'b, 'c, 'd, 'e, 'f)) => unit = - "useEffect" +external useEffect6: (unit => option unit>, ('a, 'b, 'c, 'd, 'e, 'f)) => unit = "useEffect" @module("react") -external useEffect7: ( - (unit => option unit>), - ('a, 'b, 'c, 'd, 'e, 'f, 'g), -) => unit = "useEffect" +external useEffect7: (unit => option unit>, ('a, 'b, 'c, 'd, 'e, 'f, 'g)) => unit = + "useEffect" @module("react") -external useLayoutEffect: ((unit => option unit>)) => unit = "useLayoutEffect" +external useLayoutEffect: (unit => option unit>) => unit = "useLayoutEffect" @module("react") -external useLayoutEffect0: ((unit => option unit>), @as(json`[]`) _) => unit = +external useLayoutEffect0: (unit => option unit>, @as(json`[]`) _) => unit = "useLayoutEffect" @module("react") -external useLayoutEffect1: ((unit => option unit>), array<'a>) => unit = - "useLayoutEffect" +external useLayoutEffect1: (unit => option unit>, array<'a>) => unit = "useLayoutEffect" @module("react") -external useLayoutEffect2: ((unit => option unit>), ('a, 'b)) => unit = - "useLayoutEffect" +external useLayoutEffect2: (unit => option unit>, ('a, 'b)) => unit = "useLayoutEffect" @module("react") -external useLayoutEffect3: ((unit => option unit>), ('a, 'b, 'c)) => unit = - "useLayoutEffect" +external useLayoutEffect3: (unit => option unit>, ('a, 'b, 'c)) => unit = "useLayoutEffect" @module("react") -external useLayoutEffect4: ((unit => option unit>), ('a, 'b, 'c, 'd)) => unit = +external useLayoutEffect4: (unit => option unit>, ('a, 'b, 'c, 'd)) => unit = "useLayoutEffect" @module("react") -external useLayoutEffect5: ((unit => option unit>), ('a, 'b, 'c, 'd, 'e)) => unit = +external useLayoutEffect5: (unit => option unit>, ('a, 'b, 'c, 'd, 'e)) => unit = "useLayoutEffect" @module("react") -external useLayoutEffect6: ( - (unit => option unit>), - ('a, 'b, 'c, 'd, 'e, 'f), -) => unit = "useLayoutEffect" +external useLayoutEffect6: (unit => option unit>, ('a, 'b, 'c, 'd, 'e, 'f)) => unit = + "useLayoutEffect" @module("react") -external useLayoutEffect7: ( - (unit => option unit>), - ('a, 'b, 'c, 'd, 'e, 'f, 'g), -) => unit = "useLayoutEffect" +external useLayoutEffect7: (unit => option unit>, ('a, 'b, 'c, 'd, 'e, 'f, 'g)) => unit = + "useLayoutEffect" @module("react") -external useMemo: ((unit => 'any)) => 'any = "useMemo" +external useMemo: (unit => 'any) => 'any = "useMemo" @module("react") -external useMemo0: ((unit => 'any), @as(json`[]`) _) => 'any = "useMemo" +external useMemo0: (unit => 'any, @as(json`[]`) _) => 'any = "useMemo" @module("react") -external useMemo1: ((unit => 'any), array<'a>) => 'any = "useMemo" +external useMemo1: (unit => 'any, array<'a>) => 'any = "useMemo" @module("react") -external useMemo2: ((unit => 'any), ('a, 'b)) => 'any = "useMemo" +external useMemo2: (unit => 'any, ('a, 'b)) => 'any = "useMemo" @module("react") -external useMemo3: ((unit => 'any), ('a, 'b, 'c)) => 'any = "useMemo" +external useMemo3: (unit => 'any, ('a, 'b, 'c)) => 'any = "useMemo" @module("react") -external useMemo4: ((unit => 'any), ('a, 'b, 'c, 'd)) => 'any = "useMemo" +external useMemo4: (unit => 'any, ('a, 'b, 'c, 'd)) => 'any = "useMemo" @module("react") -external useMemo5: ((unit => 'any), ('a, 'b, 'c, 'd, 'e)) => 'any = "useMemo" +external useMemo5: (unit => 'any, ('a, 'b, 'c, 'd, 'e)) => 'any = "useMemo" @module("react") -external useMemo6: ((unit => 'any), ('a, 'b, 'c, 'd, 'e, 'f)) => 'any = "useMemo" +external useMemo6: (unit => 'any, ('a, 'b, 'c, 'd, 'e, 'f)) => 'any = "useMemo" @module("react") -external useMemo7: ((unit => 'any), ('a, 'b, 'c, 'd, 'e, 'f, 'g)) => 'any = "useMemo" +external useMemo7: (unit => 'any, ('a, 'b, 'c, 'd, 'e, 'f, 'g)) => 'any = "useMemo" /* This is used as return values */ type callback<'input, 'output> = 'input => 'output @module("react") -external useCallback: (('input => 'output)) => callback<'input, 'output> = "useCallback" +external useCallback: ('input => 'output) => callback<'input, 'output> = "useCallback" @module("react") -external useCallback0: ( - ('input => 'output), - @as(json`[]`) _, -) => callback<'input, 'output> = "useCallback" -@module("react") -external useCallback1: (('input => 'output), array<'a>) => callback<'input, 'output> = +external useCallback0: ('input => 'output, @as(json`[]`) _) => callback<'input, 'output> = "useCallback" @module("react") -external useCallback2: (('input => 'output), ('a, 'b)) => callback<'input, 'output> = - "useCallback" +external useCallback1: ('input => 'output, array<'a>) => callback<'input, 'output> = "useCallback" @module("react") -external useCallback3: (('input => 'output), ('a, 'b, 'c)) => callback<'input, 'output> = +external useCallback2: ('input => 'output, ('a, 'b)) => callback<'input, 'output> = "useCallback" +@module("react") +external useCallback3: ('input => 'output, ('a, 'b, 'c)) => callback<'input, 'output> = "useCallback" @module("react") -external useCallback4: ( - ('input => 'output), - ('a, 'b, 'c, 'd), -) => callback<'input, 'output> = "useCallback" +external useCallback4: ('input => 'output, ('a, 'b, 'c, 'd)) => callback<'input, 'output> = + "useCallback" @module("react") -external useCallback5: ( - ('input => 'output), - ('a, 'b, 'c, 'd, 'e), -) => callback<'input, 'output> = "useCallback" +external useCallback5: ('input => 'output, ('a, 'b, 'c, 'd, 'e)) => callback<'input, 'output> = + "useCallback" @module("react") -external useCallback6: ( - ('input => 'output), - ('a, 'b, 'c, 'd, 'e, 'f), -) => callback<'input, 'output> = "useCallback" +external useCallback6: ('input => 'output, ('a, 'b, 'c, 'd, 'e, 'f)) => callback<'input, 'output> = + "useCallback" @module("react") external useCallback7: ( - ('input => 'output), + 'input => 'output, ('a, 'b, 'c, 'd, 'e, 'f, 'g), ) => callback<'input, 'output> = "useCallback" @@ -276,56 +253,47 @@ external useContext: Context.t<'any> => 'any = "useContext" @module("react") external useImperativeHandle0: ( Js.Nullable.t>, - (unit => 'value), + unit => 'value, @as(json`[]`) _, ) => unit = "useImperativeHandle" @module("react") -external useImperativeHandle1: ( - Js.Nullable.t>, - (unit => 'value), - array<'a>, -) => unit = "useImperativeHandle" +external useImperativeHandle1: (Js.Nullable.t>, unit => 'value, array<'a>) => unit = + "useImperativeHandle" @module("react") -external useImperativeHandle2: ( - Js.Nullable.t>, - (unit => 'value), - ('a, 'b), -) => unit = "useImperativeHandle" +external useImperativeHandle2: (Js.Nullable.t>, unit => 'value, ('a, 'b)) => unit = + "useImperativeHandle" @module("react") -external useImperativeHandle3: ( - Js.Nullable.t>, - (unit => 'value), - ('a, 'b, 'c), -) => unit = "useImperativeHandle" +external useImperativeHandle3: (Js.Nullable.t>, unit => 'value, ('a, 'b, 'c)) => unit = + "useImperativeHandle" @module("react") external useImperativeHandle4: ( Js.Nullable.t>, - (unit => 'value), + unit => 'value, ('a, 'b, 'c, 'd), ) => unit = "useImperativeHandle" @module("react") external useImperativeHandle5: ( Js.Nullable.t>, - (unit => 'value), + unit => 'value, ('a, 'b, 'c, 'd, 'e), ) => unit = "useImperativeHandle" @module("react") external useImperativeHandle6: ( Js.Nullable.t>, - (unit => 'value), + unit => 'value, ('a, 'b, 'c, 'd, 'e, 'f), ) => unit = "useImperativeHandle" @module("react") external useImperativeHandle7: ( Js.Nullable.t>, - (unit => 'value), + unit => 'value, ('a, 'b, 'c, 'd, 'e, 'f, 'g), ) => unit = "useImperativeHandle" diff --git a/jscomp/test/reactDOMRe.res b/jscomp/test/reactDOMRe.res index adb794147f..8b9b8bb68c 100644 --- a/jscomp/test/reactDOMRe.res +++ b/jscomp/test/reactDOMRe.res @@ -2141,8 +2141,7 @@ include ( external apply: ('theFunction, 'theContext, 'arguments) => 'returnTypeOfTheFunction = "apply" let createElementVariadic = (domClassName, ~props=?, children) => { - let variadicArguments = - [Obj.magic(domClassName), Obj.magic(props)] |> Js.Array.concat(children) + let variadicArguments = Js.Array.concat(children, [Obj.magic(domClassName), Obj.magic(props)]) createElementInternalHack->apply(Js.Nullable.null, variadicArguments) } }: { diff --git a/jscomp/test/reactTestUtils.res b/jscomp/test/reactTestUtils.res index 30b76182ca..74b7e62450 100644 --- a/jscomp/test/reactTestUtils.res +++ b/jscomp/test/reactTestUtils.res @@ -3,10 +3,10 @@ type undefined = Js.undefined let undefined: undefined = Js.Undefined.empty @module("react-dom/test-utils") -external reactAct: ((. ()) => undefined) => unit = "act" +external reactAct: (unit => undefined) => unit = "act" let act: (unit => unit) => unit = func => { - let reactFunc = (. ()) => { + let reactFunc = () => { func() undefined } @@ -14,10 +14,10 @@ let act: (unit => unit) => unit = func => { } @module("react-dom/test-utils") -external reactActAsync: ((. ()) => Js.Promise.t<'a>) => Js.Promise.t = "act" +external reactActAsync: (unit => Js.Promise.t<'a>) => Js.Promise.t = "act" let actAsync = func => { - let reactFunc = (. ()) => func() + let reactFunc = () => func() reactActAsync(reactFunc) } diff --git a/jscomp/test/reasonReact.res b/jscomp/test/reasonReact.res index 429803677b..e98f67767d 100644 --- a/jscomp/test/reasonReact.res +++ b/jscomp/test/reasonReact.res @@ -30,7 +30,7 @@ external cloneElement: (reactElement, ~props: {..}=?, array) => re external createElementVerbatim: 'a = "createElement" let createDomElement = (s, ~props, children) => { - let vararg = [Obj.magic(s), Obj.magic(props)] |> Js.Array.concat(children) + let vararg = Js.Array.concat(children, [Obj.magic(s), Obj.magic(props)]) /* Use varargs to avoid warnings on duplicate keys in children */ Obj.magic(createElementVerbatim)["apply"](Js.Nullable.null, vararg) } @@ -58,9 +58,11 @@ and jsPropsToReason<'jsProps, 'state, 'retainedProps, 'action> = 'jsProps => com 'retainedProps, 'action, > -and uncurriedJsPropsToReason<'jsProps, 'state, 'retainedProps, 'action> = ( - . 'jsProps, -) => component<'state, 'retainedProps, 'action> +and uncurriedJsPropsToReason<'jsProps, 'state, 'retainedProps, 'action> = 'jsProps => component< + 'state, + 'retainedProps, + 'action, +> /* ** * Type of hidden field for Reason components that use JS components */ @@ -115,7 +117,8 @@ and oldNewSelf<'state, 'retainedProps, 'action> = { type rec jsComponentThis<'state, 'props, 'retainedProps, 'action> = { "state": totalState<'state, 'retainedProps, 'action>, "props": {"reasonProps": 'props}, - "setState": @meth ( + "setState": @meth + ( ( totalState<'state, 'retainedProps, 'action>, 'props, @@ -156,7 +159,7 @@ let convertPropsIfTheyreFromJs = (props, jsPropsToReason, debugName) => { let props = Obj.magic(props) switch (Js.Nullable.toOption(props["reasonProps"]), jsPropsToReason) { | (Some(props), _) => props - | (None, Some(toReasonProps)) => Element(toReasonProps(. props)) + | (None, Some(toReasonProps)) => Element(toReasonProps(props)) | (None, None) => raise( Invalid_argument( @@ -177,7 +180,7 @@ let createClass = Obj.magic let basicComponent = debugName => { let componentTemplate = { reactClassInternal: createClass(debugName), - debugName: debugName, + debugName, /* Keep here as a way to prove that the API may be implemented soundly */ handedOffState: { contents: None, @@ -265,7 +268,7 @@ let wrapReasonForJs = ( 'state, 'retainedProps, 'action, - > = (. jsProps) => jsPropsToReason(jsProps) + > = jsProps => jsPropsToReason(jsProps) Obj.magic(component.reactClassInternal)["prototype"]["jsPropsToReason"] = Some( uncurriedJsPropsToReason, ) @@ -286,7 +289,7 @@ module WrapProps = { Js.Obj.assign(Js.Obj.empty(), Obj.magic(props)), {"ref": ref, "key": key}, ) - let varargs = [Obj.magic(reactClass), Obj.magic(props)] |> Js.Array.concat(Obj.magic(children)) + let varargs = Js.Array.concat(Obj.magic(children), [Obj.magic(reactClass), Obj.magic(props)]) /* Use varargs under the hood */ Obj.magic(createElementVerbatim)["apply"](Js.Nullable.null, varargs) } @@ -297,7 +300,7 @@ module WrapProps = { _, > => { let jsElementWrapped = Some(wrapProps(~reactClass, ~props, children, ...)) - {...dummyInteropComponent, jsElementWrapped: jsElementWrapped} + {...dummyInteropComponent, jsElementWrapped} } } diff --git a/jscomp/test/reasonReactOptimizedCreateClass.res b/jscomp/test/reasonReactOptimizedCreateClass.res index 8c4ed94a99..34350c989c 100644 --- a/jscomp/test/reasonReactOptimizedCreateClass.res +++ b/jscomp/test/reasonReactOptimizedCreateClass.res @@ -886,4 +886,4 @@ external newReactComponent: unit => {"updater": 'a} = "Component" let reactNoopUpdateQueue = newReactComponent()["updater"] -let createClass = factory(. reactComponent, reactIsValidElement, reactNoopUpdateQueue) +let createClass = factory(reactComponent, reactIsValidElement, reactNoopUpdateQueue) diff --git a/jscomp/test/reasonReactRouter.res b/jscomp/test/reasonReactRouter.res index 6f6dbe8c45..1d60ed77cb 100644 --- a/jscomp/test/reasonReactRouter.res +++ b/jscomp/test/reasonReactRouter.res @@ -69,9 +69,10 @@ let path = () => switch window { | None => list{} | Some(window) => - switch window |> location |> pathname { + switch pathname(location(window)) { | "" - | "/" => list{} + | "/" => + list{} | raw => /* remove the preceeding /, which every pathname seems to have */ let raw = Js.String.sliceToEnd(~from=1, raw) @@ -80,32 +81,32 @@ let path = () => | "/" => Js.String.slice(~from=0, ~to_=-1, raw) | _ => raw } - raw |> Js.String.split("/") |> arrayToList + arrayToList(Js.String.split("/", raw)) } } let hash = () => switch window { | None => "" | Some(window) => - switch window |> location |> hash { + switch hash(location(window)) { | "" | "#" => "" | raw => /* remove the preceeding #, which every hash seems to have. Why is this even included in location.hash?? */ - raw |> Js.String.sliceToEnd(~from=1) + Js.String.sliceToEnd(~from=1, raw) } } let search = () => switch window { | None => "" | Some(window) => - switch window |> location |> search { + switch search(location(window)) { | "" | "?" => "" | raw => /* remove the preceeding ?, which every search seems to have. */ - raw |> Js.String.sliceToEnd(~from=1) + Js.String.sliceToEnd(~from=1, raw) } } let push = path => @@ -174,9 +175,9 @@ let useUrl = (~serverUrl=?, ()) => { let watcherId = watchUrl(url => setUrl(_ => url)) /* - * check for updates that may have occured between - * the initial state and the subscribe above - */ + * check for updates that may have occured between + * the initial state and the subscribe above + */ let newUrl = dangerouslyGetInitialUrl() if urlNotEqual(newUrl, url) { setUrl(_ => newUrl) diff --git a/jscomp/test/rec_array_test.res b/jscomp/test/rec_array_test.res index 8d90b13dd1..aca69f4929 100644 --- a/jscomp/test/rec_array_test.res +++ b/jscomp/test/rec_array_test.res @@ -1,5 +1,5 @@ type rec student = {taughtBy: teacher} and teacher = {students: array} -let rec vicky = { taughtBy: teacher } -and teacher = {students: [vicky]} \ No newline at end of file +let rec vicky = {taughtBy: teacher} +and teacher = {students: [vicky]} diff --git a/jscomp/test/recmodule.res b/jscomp/test/recmodule.res index d96f2074a1..d0fbf7d45a 100644 --- a/jscomp/test/recmodule.res +++ b/jscomp/test/recmodule.res @@ -57,7 +57,7 @@ module Infra = { } module MakeLayer = (Deps: Deps): Layer => { - let presentJson = (json, ~status) => assert false + let presentJson = (json, ~status) => assert(false) let routes = () => [("/lights", Deps.handleGetLight)] } diff --git a/jscomp/test/record_debug_test.res b/jscomp/test/record_debug_test.res index 8fed66a72c..9695de86e6 100644 --- a/jscomp/test/record_debug_test.res +++ b/jscomp/test/record_debug_test.res @@ -51,9 +51,7 @@ let (a, c) = ((1, 2, 2, 4, 3), [1, 2, 3, 4, 5]) Js.log2(a, c) %%private(let i = 3) -%%private( - let a = (``, `a`) -) +%%private(let a = (``, `a`)) eq(__LOC__, a, ("", "a")) diff --git a/jscomp/test/recursive_module.res b/jscomp/test/recursive_module.res index 6e8263f6c7..48c4f03e17 100644 --- a/jscomp/test/recursive_module.res +++ b/jscomp/test/recursive_module.res @@ -32,7 +32,7 @@ module rec Inta: { and Intb: { let a: lazy_t } = { - let a = Lazy.from_fun(() => (Lazy.force(Inta.a) + 1)) + let a = Lazy.from_fun(() => Lazy.force(Inta.a) + 1) } eq( @@ -47,7 +47,7 @@ module A = { module rec Inta: { let a: lazy_t } = { - let a = Lazy.from_fun(() => (Lazy.force(Intb.a) + 1)) + let a = Lazy.from_fun(() => Lazy.force(Intb.a) + 1) } and Intb: { let a: lazy_t diff --git a/jscomp/test/res_debug.res b/jscomp/test/res_debug.res index 829c15cf2b..82d69694e5 100644 --- a/jscomp/test/res_debug.res +++ b/jscomp/test/res_debug.res @@ -1,11 +1,13 @@ @@config({ - flags: [/* "-w"; - "@A" */ - /* "-drawlambda"; */ - /* "-dtypedtree"; */ - /* "-bs-diagnose"; */ - // "-dparsetree", - /* "-dsource"; */], + flags: [ + /* "-w"; + "@A" */ + /* "-drawlambda"; */ + /* "-dtypedtree"; */ + /* "-bs-diagnose"; */ + // "-dparsetree", + /* "-dsource"; */ + ], }) type t = {x: int, y: int} @@ -15,7 +17,7 @@ type t = {x: int, y: int} // } let f = (window, a, b) => { - window["location"](. a, b) + window["location"](a, b) } // let h = () => { diff --git a/jscomp/test/set_annotation.res b/jscomp/test/set_annotation.res index e3f1ca0cd8..7d364bacfc 100644 --- a/jscomp/test/set_annotation.res +++ b/jscomp/test/set_annotation.res @@ -1,7 +1,4 @@ -type student = { - @set "age": int, - @set "name": string, -} +type student = {@set "age": int, @set "name": string} @module("MyJSFile") external student1: student = "student1" student1["name"] = "Mary" diff --git a/jscomp/test/sexpm.res b/jscomp/test/sexpm.res index cfc5422722..81b0c35fc7 100644 --- a/jscomp/test/sexpm.res +++ b/jscomp/test/sexpm.res @@ -108,7 +108,7 @@ module MakeDecode = (M: MONAD) => { /* get next char, assuming t.i < t.len */ let _get = t => { - assert (t.i < t.len) + assert(t.i < t.len) let c = Bytes.get(t.buf, t.i) t.i = t.i + 1 if c == '\n' { diff --git a/jscomp/test/small_inline_test.res b/jscomp/test/small_inline_test.res index 66a0cf357f..a32c5c30ae 100644 --- a/jscomp/test/small_inline_test.res +++ b/jscomp/test/small_inline_test.res @@ -1,12 +1,12 @@ let \"|>" = (x, f) => f(x) -let hello1 = (y, f) => y |> f +let hello1 = (y, f) => f(y) -let hello2 = (y, f) => y |> f +let hello2 = (y, f) => f(y) -let hello3 = (y, f) => y |> f +let hello3 = (y, f) => f(y) -let hello4 = (y, f) => y |> f +let hello4 = (y, f) => f(y) let hello5 = (y, f) => hello1(y, f) diff --git a/jscomp/test/stringmatch_test.res b/jscomp/test/stringmatch_test.res index eb57d1875e..8c66ee71b4 100644 --- a/jscomp/test/stringmatch_test.res +++ b/jscomp/test/stringmatch_test.res @@ -19,9 +19,9 @@ let rec tst01 = s => } let () = { - assert (tst01("") == 0) - assert (tst01("\000\000\000\003") == 1) - assert (tst01("\000\000\000\000\000\000\000\007") == 1) + assert(tst01("") == 0) + assert(tst01("\x00\x00\x00\x03") == 1) + assert(tst01("\x00\x00\x00\x00\x00\x00\x00\x07") == 1) () } @@ -39,11 +39,11 @@ let tst02 = s => { } let () = { - assert (tst02("") == 1) - assert (tst02("A") == 2) - assert (tst02("B") == 3) - assert (tst02("\000\000\000\000\000\000\000\007") == 3) - assert (tst02("\000\000\000\003") == 3) + assert(tst02("") == 1) + assert(tst02("A") == 2) + assert(tst02("B") == 3) + assert(tst02("\x00\x00\x00\x00\x00\x00\x00\x07") == 3) + assert(tst02("\x00\x00\x00\x03") == 3) () } @@ -128,54 +128,54 @@ let tst03 = s => } let () = { - assert (tst03(s00) == 0) - assert (tst03(t00) == -1) - assert (tst03(s01) == 1) - assert (tst03(t01) == -1) - assert (tst03(s02) == 2) - assert (tst03(t02) == 2) - assert (tst03(s03) == 3) - assert (tst03(t03) == -1) - assert (tst03(s04) == 4) - assert (tst03(t04) == -1) - assert (tst03(s05) == 5) - assert (tst03(t05) == -1) - assert (tst03(s06) == 6) - assert (tst03(t06) == 6) - assert (tst03(s07) == 7) - assert (tst03(t07) == -1) - assert (tst03(s08) == 8) - assert (tst03(t08) == -1) - assert (tst03(s09) == 9) - assert (tst03(t09) == 9) - assert (tst03(s10) == 10) - assert (tst03(t10) == -1) - assert (tst03(s11) == 11) - assert (tst03(t11) == -1) - assert (tst03(s12) == 12) - assert (tst03(t12) == -1) - assert (tst03(s13) == 13) - assert (tst03(t13) == -1) - assert (tst03(s14) == 14) - assert (tst03(t14) == 14) - assert (tst03(s15) == 15) - assert (tst03(t15) == -1) - assert (tst03(s16) == 16) - assert (tst03(t16) == -1) - assert (tst03(s17) == 17) - assert (tst03(t17) == 17) - assert (tst03(s18) == 18) - assert (tst03(t18) == -1) - assert (tst03(s19) == 19) - assert (tst03(t19) == -1) - assert (tst03(s20) == 20) - assert (tst03(t20) == -1) - assert (tst03(s21) == 21) - assert (tst03(t21) == -1) - assert (tst03(s22) == 22) - assert (tst03(t22) == -1) - assert (tst03(s23) == 23) - assert (tst03(t23) == -1) + assert(tst03(s00) == 0) + assert(tst03(t00) == -1) + assert(tst03(s01) == 1) + assert(tst03(t01) == -1) + assert(tst03(s02) == 2) + assert(tst03(t02) == 2) + assert(tst03(s03) == 3) + assert(tst03(t03) == -1) + assert(tst03(s04) == 4) + assert(tst03(t04) == -1) + assert(tst03(s05) == 5) + assert(tst03(t05) == -1) + assert(tst03(s06) == 6) + assert(tst03(t06) == 6) + assert(tst03(s07) == 7) + assert(tst03(t07) == -1) + assert(tst03(s08) == 8) + assert(tst03(t08) == -1) + assert(tst03(s09) == 9) + assert(tst03(t09) == 9) + assert(tst03(s10) == 10) + assert(tst03(t10) == -1) + assert(tst03(s11) == 11) + assert(tst03(t11) == -1) + assert(tst03(s12) == 12) + assert(tst03(t12) == -1) + assert(tst03(s13) == 13) + assert(tst03(t13) == -1) + assert(tst03(s14) == 14) + assert(tst03(t14) == 14) + assert(tst03(s15) == 15) + assert(tst03(t15) == -1) + assert(tst03(s16) == 16) + assert(tst03(t16) == -1) + assert(tst03(s17) == 17) + assert(tst03(t17) == 17) + assert(tst03(s18) == 18) + assert(tst03(t18) == -1) + assert(tst03(s19) == 19) + assert(tst03(t19) == -1) + assert(tst03(s20) == 20) + assert(tst03(t20) == -1) + assert(tst03(s21) == 21) + assert(tst03(t21) == -1) + assert(tst03(s22) == 22) + assert(tst03(t22) == -1) + assert(tst03(s23) == 23) + assert(tst03(t23) == -1) () } @@ -212,25 +212,25 @@ let tst04 = s => } let () = { - assert (tst04(s00) == 0) - assert (tst04(s01) == 1) - assert (tst04(s02) == 2) - assert (tst04(s03) == 3) - assert (tst04(s04) == 4) - assert (tst04(s05) == 5) - assert (tst04(s06) == 6) - assert (tst04(s07) == 7) - assert (tst04(s08) == 8) - assert (tst04(s09) == 9) - assert (tst04(s10) == 10) - assert (tst04(s11) == 11) - assert (tst04("") == -1) - assert (tst04("DDD") == -1) - assert (tst04("DDDDDDD") == -1) - assert (tst04("AAADDDD") == -1) - assert (tst04("AAAAAAADDDDDDDD") == -1) - assert (tst04("AAAAAAADDDD") == -1) - assert (tst04("AAAAAAAAAAAAAAADDDD") == -1) + assert(tst04(s00) == 0) + assert(tst04(s01) == 1) + assert(tst04(s02) == 2) + assert(tst04(s03) == 3) + assert(tst04(s04) == 4) + assert(tst04(s05) == 5) + assert(tst04(s06) == 6) + assert(tst04(s07) == 7) + assert(tst04(s08) == 8) + assert(tst04(s09) == 9) + assert(tst04(s10) == 10) + assert(tst04(s11) == 11) + assert(tst04("") == -1) + assert(tst04("DDD") == -1) + assert(tst04("DDDDDDD") == -1) + assert(tst04("AAADDDD") == -1) + assert(tst04("AAAAAAADDDDDDDD") == -1) + assert(tst04("AAAAAAADDDD") == -1) + assert(tst04("AAAAAAAAAAAAAAADDDD") == -1) () } @@ -269,28 +269,28 @@ let tst05 = s => } let () = { - assert (tst05(s00) == 0) - assert (tst05(s01) == 1) - assert (tst05(s02) == 2) - assert (tst05(s03) == 3) - assert (tst05(s04) == 4) - assert (tst05(s05) == 5) - assert (tst05(s06) == 6) - assert (tst05(s07) == 7) - assert (tst05(s08) == 8) - assert (tst05(s09) == 9) - assert (tst05(s10) == 10) - assert (tst05(s11) == 11) - assert (tst05(s12) == 12) - assert (tst05("") == -1) - assert (tst05("AAD") == -1) - assert (tst05("AAAD") == -1) - assert (tst05("AAAAAAD") == -1) - assert (tst05("AAAAAAAD") == -1) - assert (tst05("BBD") == -1) - assert (tst05("BBBD") == -1) - assert (tst05("BBBBBBD") == -1) - assert (tst05("BBBBBBBD") == -1) + assert(tst05(s00) == 0) + assert(tst05(s01) == 1) + assert(tst05(s02) == 2) + assert(tst05(s03) == 3) + assert(tst05(s04) == 4) + assert(tst05(s05) == 5) + assert(tst05(s06) == 6) + assert(tst05(s07) == 7) + assert(tst05(s08) == 8) + assert(tst05(s09) == 9) + assert(tst05(s10) == 10) + assert(tst05(s11) == 11) + assert(tst05(s12) == 12) + assert(tst05("") == -1) + assert(tst05("AAD") == -1) + assert(tst05("AAAD") == -1) + assert(tst05("AAAAAAD") == -1) + assert(tst05("AAAAAAAD") == -1) + assert(tst05("BBD") == -1) + assert(tst05("BBBD") == -1) + assert(tst05("BBBBBBD") == -1) + assert(tst05("BBBBBBBD") == -1) () } @@ -579,190 +579,190 @@ let tst06 = s => } let () = { - assert (tst06(s00) == 0) - assert (tst06(t00) == -1) - assert (tst06(s01) == 1) - assert (tst06(t01) == -1) - assert (tst06(s02) == 2) - assert (tst06(t02) == -1) - assert (tst06(s03) == 3) - assert (tst06(t03) == -1) - assert (tst06(s04) == 4) - assert (tst06(t04) == -1) - assert (tst06(s05) == 5) - assert (tst06(t05) == -1) - assert (tst06(s06) == 6) - assert (tst06(t06) == -1) - assert (tst06(s07) == 7) - assert (tst06(t07) == -1) - assert (tst06(s08) == 8) - assert (tst06(t08) == -1) - assert (tst06(s09) == 9) - assert (tst06(t09) == -1) - assert (tst06(s10) == 10) - assert (tst06(t10) == -1) - assert (tst06(s11) == 11) - assert (tst06(t11) == 11) - assert (tst06(s12) == 12) - assert (tst06(t12) == 12) - assert (tst06(s13) == 13) - assert (tst06(t13) == -1) - assert (tst06(s14) == 14) - assert (tst06(t14) == -1) - assert (tst06(s15) == 15) - assert (tst06(t15) == -1) - assert (tst06(s16) == 16) - assert (tst06(t16) == 16) - assert (tst06(s17) == 17) - assert (tst06(t17) == -1) - assert (tst06(s18) == 18) - assert (tst06(t18) == -1) - assert (tst06(s19) == 19) - assert (tst06(t19) == 19) - assert (tst06(s20) == 20) - assert (tst06(t20) == -1) - assert (tst06(s21) == 21) - assert (tst06(t21) == -1) - assert (tst06(s22) == 22) - assert (tst06(t22) == -1) - assert (tst06(s23) == 23) - assert (tst06(t23) == -1) - assert (tst06(s24) == 24) - assert (tst06(t24) == -1) - assert (tst06(s25) == 25) - assert (tst06(t25) == 25) - assert (tst06(s26) == 26) - assert (tst06(t26) == -1) - assert (tst06(s27) == 27) - assert (tst06(t27) == -1) - assert (tst06(s28) == 28) - assert (tst06(t28) == -1) - assert (tst06(s29) == 29) - assert (tst06(t29) == -1) - assert (tst06(s30) == 30) - assert (tst06(t30) == -1) - assert (tst06(s31) == 31) - assert (tst06(t31) == 31) - assert (tst06(s32) == 32) - assert (tst06(t32) == -1) - assert (tst06(s33) == 33) - assert (tst06(t33) == -1) - assert (tst06(s34) == 34) - assert (tst06(t34) == -1) - assert (tst06(s35) == 35) - assert (tst06(t35) == 35) - assert (tst06(s36) == 36) - assert (tst06(t36) == -1) - assert (tst06(s37) == 37) - assert (tst06(t37) == -1) - assert (tst06(s38) == 38) - assert (tst06(t38) == -1) - assert (tst06(s39) == 39) - assert (tst06(t39) == 39) - assert (tst06(s40) == 40) - assert (tst06(t40) == -1) - assert (tst06(s41) == 41) - assert (tst06(t41) == 41) - assert (tst06(s42) == 42) - assert (tst06(t42) == -1) - assert (tst06(s43) == 43) - assert (tst06(t43) == 43) - assert (tst06(s44) == 44) - assert (tst06(t44) == -1) - assert (tst06(s45) == 45) - assert (tst06(t45) == -1) - assert (tst06(s46) == 46) - assert (tst06(t46) == -1) - assert (tst06(s47) == 47) - assert (tst06(t47) == -1) - assert (tst06(s48) == 48) - assert (tst06(t48) == 48) - assert (tst06(s49) == 49) - assert (tst06(t49) == -1) - assert (tst06(s50) == 50) - assert (tst06(t50) == -1) - assert (tst06(s51) == 51) - assert (tst06(t51) == 51) - assert (tst06(s52) == 52) - assert (tst06(t52) == 52) - assert (tst06(s53) == 53) - assert (tst06(t53) == 53) - assert (tst06(s54) == 54) - assert (tst06(t54) == -1) - assert (tst06(s55) == 55) - assert (tst06(t55) == 55) - assert (tst06(s56) == 56) - assert (tst06(t56) == 56) - assert (tst06(s57) == 57) - assert (tst06(t57) == 57) - assert (tst06(s58) == 58) - assert (tst06(t58) == 58) - assert (tst06(s59) == 59) - assert (tst06(t59) == 59) - assert (tst06(s60) == 60) - assert (tst06(t60) == 60) - assert (tst06(s61) == 61) - assert (tst06(t61) == 61) - assert (tst06(s62) == 62) - assert (tst06(t62) == 62) - assert (tst06(s63) == 63) - assert (tst06(t63) == 63) - assert (tst06(s64) == 64) - assert (tst06(t64) == 64) - assert (tst06(s65) == 65) - assert (tst06(t65) == 65) - assert (tst06(s66) == 66) - assert (tst06(t66) == 66) - assert (tst06(s67) == 67) - assert (tst06(t67) == 67) - assert (tst06(s68) == 68) - assert (tst06(t68) == 68) - assert (tst06(s69) == 69) - assert (tst06(t69) == 69) - assert (tst06(s70) == 70) - assert (tst06(t70) == 70) - assert (tst06(s71) == 71) - assert (tst06(t71) == 71) - assert (tst06(s72) == 72) - assert (tst06(t72) == 72) - assert (tst06(s73) == 73) - assert (tst06(t73) == 73) - assert (tst06(s74) == 74) - assert (tst06(t74) == 74) - assert (tst06(s75) == 75) - assert (tst06(t75) == 75) - assert (tst06(s76) == 76) - assert (tst06(t76) == 76) - assert (tst06(s77) == 77) - assert (tst06(t77) == 77) - assert (tst06(s78) == 78) - assert (tst06(t78) == 78) - assert (tst06(s79) == 79) - assert (tst06(t79) == 79) - assert (tst06(s80) == 80) - assert (tst06(t80) == 80) - assert (tst06(s81) == 81) - assert (tst06(t81) == 81) - assert (tst06(s82) == 82) - assert (tst06(t82) == 82) - assert (tst06(s83) == 83) - assert (tst06(t83) == 83) - assert (tst06(s84) == 84) - assert (tst06(t84) == 84) - assert (tst06(s85) == 85) - assert (tst06(t85) == 85) - assert (tst06(s86) == 86) - assert (tst06(t86) == 86) - assert (tst06(s87) == 87) - assert (tst06(t87) == 87) - assert (tst06(s88) == 88) - assert (tst06(t88) == 88) - assert (tst06(s89) == 89) - assert (tst06(t89) == 89) - assert (tst06(s90) == 90) - assert (tst06(t90) == 90) - assert (tst06(s91) == 91) - assert (tst06(t91) == 91) - assert (tst06("") == -1) + assert(tst06(s00) == 0) + assert(tst06(t00) == -1) + assert(tst06(s01) == 1) + assert(tst06(t01) == -1) + assert(tst06(s02) == 2) + assert(tst06(t02) == -1) + assert(tst06(s03) == 3) + assert(tst06(t03) == -1) + assert(tst06(s04) == 4) + assert(tst06(t04) == -1) + assert(tst06(s05) == 5) + assert(tst06(t05) == -1) + assert(tst06(s06) == 6) + assert(tst06(t06) == -1) + assert(tst06(s07) == 7) + assert(tst06(t07) == -1) + assert(tst06(s08) == 8) + assert(tst06(t08) == -1) + assert(tst06(s09) == 9) + assert(tst06(t09) == -1) + assert(tst06(s10) == 10) + assert(tst06(t10) == -1) + assert(tst06(s11) == 11) + assert(tst06(t11) == 11) + assert(tst06(s12) == 12) + assert(tst06(t12) == 12) + assert(tst06(s13) == 13) + assert(tst06(t13) == -1) + assert(tst06(s14) == 14) + assert(tst06(t14) == -1) + assert(tst06(s15) == 15) + assert(tst06(t15) == -1) + assert(tst06(s16) == 16) + assert(tst06(t16) == 16) + assert(tst06(s17) == 17) + assert(tst06(t17) == -1) + assert(tst06(s18) == 18) + assert(tst06(t18) == -1) + assert(tst06(s19) == 19) + assert(tst06(t19) == 19) + assert(tst06(s20) == 20) + assert(tst06(t20) == -1) + assert(tst06(s21) == 21) + assert(tst06(t21) == -1) + assert(tst06(s22) == 22) + assert(tst06(t22) == -1) + assert(tst06(s23) == 23) + assert(tst06(t23) == -1) + assert(tst06(s24) == 24) + assert(tst06(t24) == -1) + assert(tst06(s25) == 25) + assert(tst06(t25) == 25) + assert(tst06(s26) == 26) + assert(tst06(t26) == -1) + assert(tst06(s27) == 27) + assert(tst06(t27) == -1) + assert(tst06(s28) == 28) + assert(tst06(t28) == -1) + assert(tst06(s29) == 29) + assert(tst06(t29) == -1) + assert(tst06(s30) == 30) + assert(tst06(t30) == -1) + assert(tst06(s31) == 31) + assert(tst06(t31) == 31) + assert(tst06(s32) == 32) + assert(tst06(t32) == -1) + assert(tst06(s33) == 33) + assert(tst06(t33) == -1) + assert(tst06(s34) == 34) + assert(tst06(t34) == -1) + assert(tst06(s35) == 35) + assert(tst06(t35) == 35) + assert(tst06(s36) == 36) + assert(tst06(t36) == -1) + assert(tst06(s37) == 37) + assert(tst06(t37) == -1) + assert(tst06(s38) == 38) + assert(tst06(t38) == -1) + assert(tst06(s39) == 39) + assert(tst06(t39) == 39) + assert(tst06(s40) == 40) + assert(tst06(t40) == -1) + assert(tst06(s41) == 41) + assert(tst06(t41) == 41) + assert(tst06(s42) == 42) + assert(tst06(t42) == -1) + assert(tst06(s43) == 43) + assert(tst06(t43) == 43) + assert(tst06(s44) == 44) + assert(tst06(t44) == -1) + assert(tst06(s45) == 45) + assert(tst06(t45) == -1) + assert(tst06(s46) == 46) + assert(tst06(t46) == -1) + assert(tst06(s47) == 47) + assert(tst06(t47) == -1) + assert(tst06(s48) == 48) + assert(tst06(t48) == 48) + assert(tst06(s49) == 49) + assert(tst06(t49) == -1) + assert(tst06(s50) == 50) + assert(tst06(t50) == -1) + assert(tst06(s51) == 51) + assert(tst06(t51) == 51) + assert(tst06(s52) == 52) + assert(tst06(t52) == 52) + assert(tst06(s53) == 53) + assert(tst06(t53) == 53) + assert(tst06(s54) == 54) + assert(tst06(t54) == -1) + assert(tst06(s55) == 55) + assert(tst06(t55) == 55) + assert(tst06(s56) == 56) + assert(tst06(t56) == 56) + assert(tst06(s57) == 57) + assert(tst06(t57) == 57) + assert(tst06(s58) == 58) + assert(tst06(t58) == 58) + assert(tst06(s59) == 59) + assert(tst06(t59) == 59) + assert(tst06(s60) == 60) + assert(tst06(t60) == 60) + assert(tst06(s61) == 61) + assert(tst06(t61) == 61) + assert(tst06(s62) == 62) + assert(tst06(t62) == 62) + assert(tst06(s63) == 63) + assert(tst06(t63) == 63) + assert(tst06(s64) == 64) + assert(tst06(t64) == 64) + assert(tst06(s65) == 65) + assert(tst06(t65) == 65) + assert(tst06(s66) == 66) + assert(tst06(t66) == 66) + assert(tst06(s67) == 67) + assert(tst06(t67) == 67) + assert(tst06(s68) == 68) + assert(tst06(t68) == 68) + assert(tst06(s69) == 69) + assert(tst06(t69) == 69) + assert(tst06(s70) == 70) + assert(tst06(t70) == 70) + assert(tst06(s71) == 71) + assert(tst06(t71) == 71) + assert(tst06(s72) == 72) + assert(tst06(t72) == 72) + assert(tst06(s73) == 73) + assert(tst06(t73) == 73) + assert(tst06(s74) == 74) + assert(tst06(t74) == 74) + assert(tst06(s75) == 75) + assert(tst06(t75) == 75) + assert(tst06(s76) == 76) + assert(tst06(t76) == 76) + assert(tst06(s77) == 77) + assert(tst06(t77) == 77) + assert(tst06(s78) == 78) + assert(tst06(t78) == 78) + assert(tst06(s79) == 79) + assert(tst06(t79) == 79) + assert(tst06(s80) == 80) + assert(tst06(t80) == 80) + assert(tst06(s81) == 81) + assert(tst06(t81) == 81) + assert(tst06(s82) == 82) + assert(tst06(t82) == 82) + assert(tst06(s83) == 83) + assert(tst06(t83) == 83) + assert(tst06(s84) == 84) + assert(tst06(t84) == 84) + assert(tst06(s85) == 85) + assert(tst06(t85) == 85) + assert(tst06(s86) == 86) + assert(tst06(t86) == 86) + assert(tst06(s87) == 87) + assert(tst06(t87) == 87) + assert(tst06(s88) == 88) + assert(tst06(t88) == 88) + assert(tst06(s89) == 89) + assert(tst06(t89) == 89) + assert(tst06(s90) == 90) + assert(tst06(t90) == 90) + assert(tst06(s91) == 91) + assert(tst06(t91) == 91) + assert(tst06("") == -1) () } diff --git a/jscomp/test/switch_string.res b/jscomp/test/switch_string.res index 2a164ab019..de500e0af7 100644 --- a/jscomp/test/switch_string.res +++ b/jscomp/test/switch_string.res @@ -6,8 +6,9 @@ let foo = x => let s = "😀" -let bar = x => switch x { +let bar = x => + switch x { | "\\" => "\\" | "😀" => "😀" | _ => "" -} + } diff --git a/jscomp/test/tagged_template_test.res b/jscomp/test/tagged_template_test.res index 27c25658e7..dc1cc42d23 100644 --- a/jscomp/test/tagged_template_test.res +++ b/jscomp/test/tagged_template_test.res @@ -8,7 +8,7 @@ let id = "5" let queryWithModule = Pg.sql`SELECT * FROM ${table} WHERE id = ${id}` -open Pg +open Pg let query = sql`SELECT * FROM ${table} WHERE id = ${id}` @module("./tagged_template_lib.js") @taggedTemplate @@ -39,10 +39,7 @@ Mt.from_pair_suites( "with module scoped externals, it should also return a string with the correct interpolations", () => Eq(queryWithModule, "SELECT * FROM 'users' WHERE id = '5'"), ), - ( - "with externals, it should return the result of the function", - () => Eq(length, 52), - ), + ("with externals, it should return the result of the function", () => Eq(length, 52)), ( "with rescript function, it should return a string with the correct encoding and interpolations", () => Eq(res, "| 5 × 10 = 50 |"), @@ -56,4 +53,4 @@ Mt.from_pair_suites( () => Eq(`some random ${"string"} interpolation`, "some random string interpolation"), ), }, -) \ No newline at end of file +) diff --git a/jscomp/test/test_ari.res b/jscomp/test/test_ari.res index 57835f6cc8..6fbf8ef541 100644 --- a/jscomp/test/test_ari.res +++ b/jscomp/test/test_ari.res @@ -1,4 +1,4 @@ -let f = (x,y) => \"+"(x,y) +let f = (x, y) => x + y /* {[ f = function (x){ function(x,y){x + y} (x) } diff --git a/jscomp/test/test_bs_this.res b/jscomp/test/test_bs_this.res index af32b4deb9..68358e6e03 100644 --- a/jscomp/test/test_bs_this.res +++ b/jscomp/test/test_bs_this.res @@ -2,12 +2,11 @@ let uux_this: @this ({"length": int}, int, int) => int = @this (o, x, y) => o["l let even = @this (o, x) => x + o -let bark = () => - @this - (o: 'self, x, y) => { - Js.log((o["length"], o["x"], o["y"], x, y)) - x + y - } +let bark = () => @this +(o: 'self, x, y) => { + Js.log((o["length"], o["x"], o["y"], x, y)) + x + y +} let js_obj: 'self = { "bark": @this diff --git a/jscomp/test/test_closure.res b/jscomp/test/test_closure.res index 8feacb1ad4..1c2f3e9bbb 100644 --- a/jscomp/test/test_closure.res +++ b/jscomp/test/test_closure.res @@ -49,5 +49,5 @@ let f = () => { let () = { let u = f() Array.iter(x => x(), u) - assert (v.contents == 45) + assert(v.contents == 45) } diff --git a/jscomp/test/test_ffi.res b/jscomp/test/test_ffi.res index 2b32373d80..3a8d421b0c 100644 --- a/jscomp/test/test_ffi.res +++ b/jscomp/test/test_ffi.res @@ -1,5 +1,4 @@ -@val("console.log") -/** we should also allow js function call from an external js module +@val("console.log") /** we should also allow js function call from an external js module */ external log: 'a => unit = "?ignore" diff --git a/jscomp/test/test_js_ffi.res b/jscomp/test/test_js_ffi.res index e33cf3139a..80bbbe1565 100644 --- a/jscomp/test/test_js_ffi.res +++ b/jscomp/test/test_js_ffi.res @@ -1,5 +1,4 @@ -@val("console.log") -/** we should also allow js function call from an external js module +@val("console.log") /** we should also allow js function call from an external js module */ external log: 'a => unit = "?ignore" diff --git a/jscomp/test/test_simple_include.res b/jscomp/test/test_simple_include.res index 1a891ad98f..d6325f0063 100644 --- a/jscomp/test/test_simple_include.res +++ b/jscomp/test/test_simple_include.res @@ -1,13 +1,13 @@ include Array include { - assert (1 + 2 == 3) + assert(1 + 2 == 3) let a = 3 } module N = { /* ;; prerr_endline "hello " */ - assert (1 + 2 == 3) + assert(1 + 2 == 3) let a = 3 let v = ref(32) v := 0 diff --git a/jscomp/test/test_unsafe_obj_ffi.res b/jscomp/test/test_unsafe_obj_ffi.res index 36e3d36115..f9fd0baa4b 100644 --- a/jscomp/test/test_unsafe_obj_ffi.res +++ b/jscomp/test/test_unsafe_obj_ffi.res @@ -60,4 +60,4 @@ if it is already a property read, there ? how about {[ x #.property_fun 1 2 ]} this is mostly an error in FFI binding -*/ \ No newline at end of file +*/ diff --git a/jscomp/test/test_while_closure.res b/jscomp/test/test_while_closure.res index a0981d3976..204220c713 100644 --- a/jscomp/test/test_while_closure.res +++ b/jscomp/test/test_while_closure.res @@ -52,5 +52,5 @@ let () = { f() Array.iter(x => x(), arr) print_endline(string_of_int(v.contents)) - assert (v.contents == 45) + assert(v.contents == 45) } diff --git a/jscomp/test/then_mangle_test.res b/jscomp/test/then_mangle_test.res index dcc8fa8f17..308dd63486 100644 --- a/jscomp/test/then_mangle_test.res +++ b/jscomp/test/then_mangle_test.res @@ -1,17 +1,16 @@ -@@config({no_export}) +@@config(no_export) -let suites : ref = ref (list{}) +let suites: ref = ref(list{}) let test_id = ref(0) -let {eq_suites} = module (Mt) -let eq = (loc,x,y) => eq_suites(loc,x,y,~test_id,~suites) +let {eq_suites} = module(Mt) +let eq = (loc, x, y) => eq_suites(loc, x, y, ~test_id, ~suites) -let then = (a,b)=>{ - Js.log("no inline") - a*a+b*b +let then = (a, b) => { + Js.log("no inline") + a * a + b * b } -eq(__LOC__,then(1,2),5) +eq(__LOC__, then(1, 2), 5) - -Mt.from_pair_suites(__FILE__ ,suites.contents) \ No newline at end of file +Mt.from_pair_suites(__FILE__, suites.contents) diff --git a/jscomp/test/topsort_test.res b/jscomp/test/topsort_test.res index 54e132c6cc..126fedca06 100644 --- a/jscomp/test/topsort_test.res +++ b/jscomp/test/topsort_test.res @@ -32,10 +32,10 @@ let rec dfs1 = (nodes, graph, visited) => } let () = { - assert (dfs1(list{"a"}, graph, list{}) == list{"a", "d", "e", "g", "f", "c", "b"}) + assert(dfs1(list{"a"}, graph, list{}) == list{"a", "d", "e", "g", "f", "c", "b"}) print_newline() - assert (dfs1(list{"b"}, list{("f", "d"), ...graph}, list{}) == list{"b", "e", "g", "f", "d"}) + assert(dfs1(list{"b"}, list{("f", "d"), ...graph}, list{}) == list{"b", "e", "g", "f", "d"}) } let rec dfs2 = (nodes, graph, visited) => { @@ -54,8 +54,8 @@ let rec dfs2 = (nodes, graph, visited) => { let () = { let dfs1 = dfs2 - assert (dfs1(list{"a"}, graph, list{}) == list{"a", "d", "e", "g", "f", "c", "b"}) - assert (dfs1(list{"b"}, list{("f", "d"), ...graph}, list{}) == list{"b", "e", "g", "f", "d"}) + assert(dfs1(list{"a"}, graph, list{}) == list{"a", "d", "e", "g", "f", "c", "b"}) + assert(dfs1(list{"b"}, list{("f", "d"), ...graph}, list{}) == list{"b", "e", "g", "f", "d"}) } let dfs3 = (nodes, graph) => { @@ -71,8 +71,8 @@ let dfs3 = (nodes, graph) => { let () = { let dfs1 = dfs3 - assert (dfs1(list{"a"}, graph) == list{"a", "d", "e", "g", "f", "c", "b"}) - assert (dfs1(list{"b"}, list{("f", "d"), ...graph}) == list{"b", "e", "g", "f", "d"}) + assert(dfs1(list{"a"}, graph) == list{"a", "d", "e", "g", "f", "c", "b"}) + assert(dfs1(list{"b"}, list{("f", "d"), ...graph}) == list{"b", "e", "g", "f", "d"}) } /* since [x] is recorded before visiting its successors, so even with @@ -109,7 +109,7 @@ let unsafe_topsort = graph => { visited.contents } -let () = assert (unsafe_topsort(grwork) == list{"wake", "shower", "dress", "eat", "washup", "go"}) +let () = assert(unsafe_topsort(grwork) == list{"wake", "shower", "dress", "eat", "washup", "go"}) module String_set = Set.Make(String) exception Cycle(list) @@ -141,7 +141,7 @@ let pathsort = graph => { visited.contents } -let () = assert (pathsort(grwork) == list{"wake", "shower", "dress", "eat", "washup", "go"}) +let () = assert(pathsort(grwork) == list{"wake", "shower", "dress", "eat", "washup", "go"}) let () = try { \"@@"(ignore, pathsort(list{("go", "eat"), ...grwork})) diff --git a/jscomp/test/tramp_fib.res b/jscomp/test/tramp_fib.res index 92dd521e26..72698a4103 100644 --- a/jscomp/test/tramp_fib.res +++ b/jscomp/test/tramp_fib.res @@ -4,7 +4,7 @@ let suites: ref = ref(list{}) let test_id = ref(0) let eq = (loc, x, y) => Mt.eq_suites(~test_id, ~suites, loc, x, y) -type rec bounce<'a> = Continue('a) | Suspend((. unit) => bounce<'a>) +type rec bounce<'a> = Continue('a) | Suspend(unit => bounce<'a>) /* https://eli.thegreenplace.net/2017/on-recursion-continuations-and-trampolines/ */ /* http://gallium.inria.fr/seminaires/transparents/20141027.Frederic.Bour.pdf */ /* http://www.usrsb.in/blog/blog/2012/08/12/bouncing-pythons-generators-with-a-trampoline/ */ @@ -14,30 +14,26 @@ let rec fib = (n, k) => | 0 | 1 => /* k (Continue 1) [@bs] */ /* Suspend (fun [@bs]() -> k (Continue 1 ) [@bs]) */ - k(. 1) + k(1) | _ => Suspend( - (. ()) => - fib(n - 1, (. v0) => - fib(n - 2, (. v1) => - k(. v0 + v1) - /* match v0,v1 with - | Continue v0, Continue v1 -> */ - /* k (Continue (v0 + v1)) [@bs] */ - /* Suspend (fun [@bs]() -> k (Continue (v0 + v1)) [@bs]) */ - /* | _ -> assert false */ - /* FIXME: this branch completly gone */ - ) - ), + () => + fib(n - 1, v0 => fib(n - 2, v1 => k(v0 + v1))), + /* match v0,v1 with + | Continue v0, Continue v1 -> */ + /* k (Continue (v0 + v1)) [@bs] */ + /* Suspend (fun [@bs]() -> k (Continue (v0 + v1)) [@bs]) */ + /* | _ -> assert false */ + /* FIXME: this branch completly gone */ ) } -let u = fib(10, (. x) => Continue(x)) +let u = fib(10, x => Continue(x)) let rec iter = (bounce: bounce<'a>): 'a => switch bounce { | Continue(v) => v - | Suspend(f) => iter(f(.)) + | Suspend(f) => iter(f()) } /* first it needs to be tailcall */ @@ -45,7 +41,7 @@ let rec isEven = n => switch n { | 0 => Continue(true) | 1 => Continue(false) - | _ => Suspend((. ()) => isOdd(n - 1)) + | _ => Suspend(() => isOdd(n - 1)) } and isOdd = n => switch n { diff --git a/jscomp/test/type-coercion-free-vars.res b/jscomp/test/type-coercion-free-vars.res index b41ad93eed..7619867c7c 100644 --- a/jscomp/test/type-coercion-free-vars.res +++ b/jscomp/test/type-coercion-free-vars.res @@ -7,7 +7,7 @@ module NoFreeVars = { let h = x => (g(x), (x :> int)) -// let h2 = x => ((x :> int), g(x)) + // let h2 = x => ((x :> int), g(x)) } module WithTypeArg = { @@ -18,21 +18,20 @@ module WithTypeArg = { module FunctionType = { type t = private int - let f = _ => (Obj.magic(3) : t) - let _ = f :> (_ => int) + let f = (_): t => Obj.magic(3) + let _ = (f :> _ => int) } module Contravariant = { type t = private int - let f1 = (_:int) => () - let _ = f1 :> (t => unit) - let f2 = (_:int, _) => () - let _ = f2 :> ((t, _) => unit) + let f1 = (_: int) => () + let _ = (f1 :> t => unit) + let f2 = (_: int, _) => () + let _ = (f2 :> (t, _) => unit) } - module Totallypoly = { let f = x => (x :> int) - let idint = (x:int) => x + let idint = (x: int) => x let _ = f === idint -} \ No newline at end of file +} diff --git a/jscomp/test/type_disambiguate.res b/jscomp/test/type_disambiguate.res index 02c9400b7f..bb5dcb9369 100644 --- a/jscomp/test/type_disambiguate.res +++ b/jscomp/test/type_disambiguate.res @@ -12,9 +12,9 @@ let f = (e: N.t<_>) => { a + b + c } -type e = N.t<(. int) => int> +type e = N.t int> let f1 = (e: e) => { let {a, b, c, d} = e - a + b + c + d(. c) + a + b + c + d(c) } diff --git a/jscomp/test/unboxed_attribute.res b/jscomp/test/unboxed_attribute.res index cea831c6f7..0cc4e87d86 100644 --- a/jscomp/test/unboxed_attribute.res +++ b/jscomp/test/unboxed_attribute.res @@ -1,4 +1,4 @@ -type rec func<'a, 'b, 'i> = ('i => res<'a, 'b, 'i>) +type rec func<'a, 'b, 'i> = 'i => res<'a, 'b, 'i> @unboxed and res<'a, 'b, 'i> = Val(('b, func<'a, 'b, 'i>)) -let rec u = _ => Val(3, u) \ No newline at end of file +let rec u = _ => Val(3, u) diff --git a/jscomp/test/uncurried_cast.res b/jscomp/test/uncurried_cast.res index e9ec6b5da5..95b7488120 100644 --- a/jscomp/test/uncurried_cast.res +++ b/jscomp/test/uncurried_cast.res @@ -1,8 +1,8 @@ module Uncurried = { - let raise = (. e) => raise(e) + let raise = e => raise(e) module List = { - let map = (. l, f) => Belt.List.map(l, f) + let map = (l, f) => Belt.List.map(l, f) } } @@ -13,22 +13,21 @@ module StandardNotation = { let testRaise = () => raise(E) - let l = List.map(.list{1, 2}, (. x) => x + 1) + let l = List.map(list{1, 2}, x => x + 1) let partial = x => List.map(list{1, 2}, x) - let ll = partial((. x) => x + 1) + let ll = partial(x => x + 1) - let withOpts = (. ~x=3, y, ~z=4, w) => x + y + z + w - type unc2 = (. ~z: int=?, int) => int + let withOpts = (~x=3, y, ~z=4, w) => x + y + z + w + type unc2 = (~z: int=?, int) => int } - 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.res b/jscomp/test/uncurried_default.args.res index b6973ea2c1..c776b56734 100644 --- a/jscomp/test/uncurried_default.args.res +++ b/jscomp/test/uncurried_default.args.res @@ -1,32 +1,32 @@ module StandardNotation = { - let withOpt = (. ~x=1, y) => (. ~z=1, w) => x+y+z+w - let testWithOpt = withOpt(. 3)(. 4) + 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 total = 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 foo1 = (~x=3, ~y) => x + y + let r1 = foo1(~y=11) - let foo2 = (. ~y, ~x=3, ~z=4) => x+y+z - let r2 = foo2(. ~y=11) + 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 + let r3 = foo3() } open StandardNotation -let withOpt = (~x=1, y) => (~z=1, w) => x+y+z+w +let withOpt = (~x=1, y) => (~z=1, w) => x + y + z + w let testWithOpt = withOpt(3)(4) let total = withOpt(~x=10, 3)(~z=4, 11) -let foo1 = (~x=3, ~y) => x+y +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 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 e35b054a00..11de7f0815 100644 --- a/jscomp/test/uncurried_pipe.res +++ b/jscomp/test/uncurried_pipe.res @@ -1,13 +1,13 @@ module StandardNotation = { - let add = (. x, y) => x + y + let add = (x, y) => x + y let addC = (x, y) => x + y - 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 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 unary = (. x) => x + 1 + let unary = x => x + 1 } open StandardNotation diff --git a/jscomp/test/uncurry_external_test.res b/jscomp/test/uncurry_external_test.res index 6d4f17e90e..86f9055aa9 100644 --- a/jscomp/test/uncurry_external_test.res +++ b/jscomp/test/uncurry_external_test.res @@ -12,9 +12,9 @@ function sum(a,b){ } `) -external sum: (. float, float) => float = "sum" +external sum: (float, float) => float = "sum" -let h = sum(. 1.0, 2.0) +let h = sum(1.0, 2.0) let () = eq(__LOC__, h, 3.) let () = Mt.from_pair_suites(__MODULE__, suites.contents) diff --git a/jscomp/test/uncurry_glob_test.res b/jscomp/test/uncurry_glob_test.res index dbac29209a..eda34fb5ec 100644 --- a/jscomp/test/uncurry_glob_test.res +++ b/jscomp/test/uncurry_glob_test.res @@ -1,15 +1,15 @@ module M = ( U: { - let f: (. int, string) => string + let f: (int, string) => string }, ) => { - let v = U.f(. 100, "x") + let v = U.f(100, "x") } -let f = (. ()) => 3 +let f = () => 3 -let u = f(.) +let u = f() -let \"+>" = (. a, h: (. _) => int) => h(. a) +let \"+>" = (a, h: _ => int) => h(a) -let u = h => \"+>"(. 3, h) +let u = h => \"+>"(3, h) diff --git a/jscomp/test/uncurry_test.res b/jscomp/test/uncurry_test.res index 04dd1e3dcd..271e969564 100644 --- a/jscomp/test/uncurry_test.res +++ b/jscomp/test/uncurry_test.res @@ -1,16 +1,16 @@ -type t<'a0, 'a1> = (. 'a0) => 'a1 +type t<'a0, 'a1> = 'a0 => 'a1 -let f0 = (. ()) => 0 -let f1 = (. a0) => a0 -let f2 = (. a0, a1) => (a0, a1) +let f0 = () => 0 +let f1 = a0 => a0 +let f2 = (a0, a1) => (a0, a1) -f0(.)->Js.log -f1(. 0)->Js.log +f0()->Js.log +f1(0)->Js.log -f2(. 0, 1)->Js.log +f2(0, 1)->Js.log -let rec xx = (. ()) => xx(.) +let rec xx = () => xx() -type logger = {log2: 'a. (. string, 'a) => unit} +type logger = {log2: 'a. (string, 'a) => unit} -let log2 = (logger, message, obj) => logger.log2(. message, obj) +let log2 = (logger, message, obj) => logger.log2(message, obj) diff --git a/jscomp/test/uncurry_test.resi b/jscomp/test/uncurry_test.resi index e7a17bb11c..ff37b727c1 100644 --- a/jscomp/test/uncurry_test.resi +++ b/jscomp/test/uncurry_test.resi @@ -1,10 +1,10 @@ -type t<'a0, 'a1> = (. 'a0) => 'a1 -let f0: (. unit) => int -let f1: (. 'a) => 'a -let f2: (. 'a, 'b) => ('a, 'b) +type t<'a0, 'a1> = 'a0 => 'a1 +let f0: unit => int +let f1: 'a => 'a +let f2: ('a, 'b) => ('a, 'b) -let xx: (. unit) => 'a +let xx: unit => 'a -type logger = {log2: 'a. (. string, 'a) => unit} +type logger = {log2: 'a. (string, 'a) => unit} -let log2 :(logger, string, 'a) => unit +let log2: (logger, string, 'a) => unit diff --git a/jscomp/test/unsafe_full_apply_primitive.res b/jscomp/test/unsafe_full_apply_primitive.res index b4e7de18e0..6a51dccd85 100644 --- a/jscomp/test/unsafe_full_apply_primitive.res +++ b/jscomp/test/unsafe_full_apply_primitive.res @@ -1,4 +1,4 @@ -let rec f = (. a) => f(. a) +let rec f = a => f(a) /* not allowed due to special encoding of unit */ /* let rec f1 = fun [@bs] () -> f1 () [@bs] */ diff --git a/jscomp/test/unsafe_ppx_test.res b/jscomp/test/unsafe_ppx_test.res index 2b4b48eaf6..ffaf533d30 100644 --- a/jscomp/test/unsafe_ppx_test.res +++ b/jscomp/test/unsafe_ppx_test.res @@ -1,8 +1,8 @@ let x: string = %raw(`"\\x01\\x02\\x03"`) -let max: (. float, float) => float = %raw("Math.max") +let max: (float, float) => float = %raw("Math.max") -let u = v => max(. 1., v) +let u = v => max(1., v) /* let max2 : float -> float -> float = [%raw {Math.max} ] */ %%raw(` @@ -11,9 +11,9 @@ function $$test(x,y){ } `) -let regression3: (. float, float) => float = %raw("Math.max") +let regression3: (float, float) => float = %raw("Math.max") -let regression4: (. float, (. float) => float) => float = %raw("Math.max") +let regression4: (float, float => float) => float = %raw("Math.max") let g = a => { let regression: (float, string => 'a) => string = %raw(`function(x,y){ return "" @@ -22,21 +22,21 @@ let g = a => { let regression2: (float, float) => float = %raw("Math.max") \"@@"(ignore, regression(a, failwith)) \"@@"(ignore, regression2(3., 2.)) - \"@@"(ignore, regression3(. 3., 2.)) - \"@@"(ignore, regression4(.3., (. x) => x)) + \"@@"(ignore, regression3(3., 2.)) + \"@@"(ignore, regression4(3., x => x)) } -let max2: (. float, float) => float = %raw("Math.max") +let max2: (float, float) => float = %raw("Math.max") -let umax = (a, b) => max2(. a, b) -let u = h => max2(. 3., h) +let umax = (a, b) => max2(a, b) +let u = h => max2(3., h) -let max3: (. (float, float)) => float = %raw("Math.max") -let uu = h => max2(. 3., h) +let max3: ((float, float)) => float = %raw("Math.max") +let uu = h => max2(3., h) @val("$$test") external test: (int, int) => int = "" -let empty = (%raw(` Object.keys`): (. _) => array)(. 3) +let empty = (%raw(` Object.keys`): _ => array)(3) let v = test(1, 2) @@ -46,17 +46,17 @@ let v = test(1, 2) /* end [@bs] */ /* see #570 */ -type vv = (. int) => int +type vv = int => int Mt.from_pair_suites( __MODULE__, { open Mt list{ - ("unsafe_max", _ => Eq(2., max(. 1., 2.))), + ("unsafe_max", _ => Eq(2., max(1., 2.))), ("unsafe_test", _ => Eq(3, v)), - ("unsafe_max2", _ => Eq(2, (%raw(`Math.max`): (. int, int) => int)(. 1, 2))), - ("ffi_keys", _ => Eq(["a"], Ffi_js_test.keys(. %raw(` {a : 3}`)))), + ("unsafe_max2", _ => Eq(2, (%raw(`Math.max`): (int, int) => int)(1, 2))), + ("ffi_keys", _ => Eq(["a"], Ffi_js_test.keys(%raw(` {a : 3}`)))), } }, ) diff --git a/jscomp/test/variantsMatching.res b/jscomp/test/variantsMatching.res index 7770393730..a31704cc1b 100644 --- a/jscomp/test/variantsMatching.res +++ b/jscomp/test/variantsMatching.res @@ -289,7 +289,7 @@ module UntaggedWithBool = { module UntaggedWithTuple = { @unboxed @genType - type t = String(string) | Tuple((int, float, string)) + type t = String(string) | Tuple((int, float, string)) let classify = x => switch x { diff --git a/scripts/format.sh b/scripts/format.sh index 4fbcb1bb60..ee6635327e 100755 --- a/scripts/format.sh +++ b/scripts/format.sh @@ -3,4 +3,4 @@ shopt -s extglob dune build @fmt --auto-promote -./rescript format jscomp/@(others|runtime)/*.@(res|resi) +./rescript format jscomp/@(others|runtime|test)/*.@(res|resi) diff --git a/scripts/format_check.sh b/scripts/format_check.sh index 95c0612087..3c58d6f6d3 100755 --- a/scripts/format_check.sh +++ b/scripts/format_check.sh @@ -17,7 +17,7 @@ case "$(uname -s)" in fi echo "Checking ReScript code formatting..." - if ./rescript format -check jscomp/@(others|runtime)/*.@(res|resi); then + if ./rescript format -check jscomp/@(others|runtime|test)/*.@(res|resi); then printf "${successGreen}✅ ReScript code formatting ok.${reset}\n" else printf "${warningYellow}⚠️ ReScript code formatting issues found.${reset}\n"