Skip to content

Commit 5748d14

Browse files
authored
Format jscomp/test (#6983)
1 parent c8ed227 commit 5748d14

File tree

180 files changed

+1654
-1613
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+1654
-1613
lines changed

jscomp/test/AsInUncurriedExternals.res

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ let mo = makeOptions
1212

1313
let options = mo(~name="foo", ())
1414

15-
let shouldNotFail: (~objectMode: _, ~name: string) => int = (~objectMode, ~name) =>
16-
3
15+
let shouldNotFail: (~objectMode: _, ~name: string) => int = (~objectMode, ~name) => 3

jscomp/test/Coercion.res

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ let x = 1
22

33
let xx = (x :> float)
44

5-
type r1 = {x:int}
6-
type r2 = {x:int}
5+
type r1 = {x: int}
6+
type r2 = {x: int}
77

88
type t1 = array<r1>
99
type t2 = array<r2>
1010

11-
let foo = (x: t1) => { x :> t2 }
11+
let foo = (x: t1) => {(x :> t2)}

jscomp/test/DerivingAccessorsCurried.res

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
//In curried mode
33

44
@deriving(accessors)
5-
type myRecord = { myField: int }
5+
type myRecord = {myField: int}
66

77
@deriving(accessors)
8-
type variant = | NoParam | Num(int) | DoubleNum(int, int)
8+
type variant = NoParam | Num(int) | DoubleNum(int, int)
99

1010
//Asserts the correct signature for derived accessor
1111
let _myFieldAlias: myRecord => int = myField
@@ -16,6 +16,5 @@ let _doubleNumAlias: (int, int) => variant = doubleNum
1616
//Asserts that inference works when composing
1717
//with derived functions
1818
let compose = (a, accessor) => accessor(a)
19-
let _composedMyField = compose({ myField: 1 }, myField)
19+
let _composedMyField = compose({myField: 1}, myField)
2020
let _composedNum = compose(1, num)
21-

jscomp/test/DerivingAccessorsUncurried.res

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
@@uncurried
44

55
@deriving(accessors)
6-
type myRecord = { myField: int }
6+
type myRecord = {myField: int}
77

88
@deriving(accessors)
9-
type variant = | NoParam | Num(int) | DoubleNum(int, int)
9+
type variant = NoParam | Num(int) | DoubleNum(int, int)
1010

1111
//Asserts the correct signature for derived accessor
1212
let _myFieldAlias: myRecord => int = myField
@@ -17,6 +17,5 @@ let _doubleNumAlias: (int, int) => variant = doubleNum
1717
//Asserts that inference works when composing
1818
//with derived functions
1919
let compose = (a, accessor) => accessor(a)
20-
let _composedMyField = compose({ myField: 1 }, myField)
20+
let _composedMyField = compose({myField: 1}, myField)
2121
let _composedNum = compose(1, num)
22-
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
type t1 = {x:int, y:int}
2-
type t2 = {x:int, y:int, z?:int}
1+
type t1 = {x: int, y: int}
2+
type t2 = {x: int, y: int, z?: int}
33

4-
let f1 = (v:t1) => v.x
5-
let f2 = (v:t2) => v.x
4+
let f1 = (v: t1) => v.x
5+
let f2 = (v: t2) => v.x
66

7-
let v = {x:3, y:4}
7+
let v = {x: 3, y: 4}
88
let res = f2(v) // Check that t2 shadows t1

jscomp/test/EmptyRecord.res

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
type allOptRec = {n?: int, s?:string}
1+
type allOptRec = {n?: int, s?: string}
22

3-
let construct = (b) => b ? {n:0} : {}
3+
let construct = b => b ? {n: 0} : {}
44

55
// let z = {}
66
// Error: Empty record literal {} should be type annotated or used in a record context.
77

88
type emptyrec = {}
99

10-
let er : emptyrec = {}
10+
let er: emptyrec = {}

jscomp/test/Import.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ let eachIntAsync = async (list: list<int>, f: int => unit) => {
33
}
44

55
let eachIntLazy = (list: list<int>, f: int => unit) =>
6-
Js.import(Belt.List.forEach) |> Js.Promise.then_(each => list->each(f)->Js.Promise.resolve)
6+
Js.Promise.then_(each => list->each(f)->Js.Promise.resolve, Js.import(Belt.List.forEach))
77

88
let _ = list{1, 2, 3}->eachIntLazy(n => Js.log2("lazy", n))
99
let _ = list{1, 2, 3}->eachIntAsync(n => Js.log2("async", n))

jscomp/test/RecordOrObject.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
type rx = {x: int}
22
type ry = {y: string}
3-
type rxi = {...rx, i?:int}
3+
type rxi = {...rx, i?: int}
44
type rxy = {...rx, ...ry} // this is a record
55

66
let vxy: rxy = {x: 10, y: "abc"}
7-
let xxi : rxi = {x:10}
7+
let xxi: rxi = {x: 10}
88

99
type ox = {"x": int}
1010
type oy = {"y": int}

jscomp/test/SafePromises.res

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
let nestedPromise = async (xxx: promise<promise<int>>) => {
44
let xx = await xxx
55

6-
let _ = xx->Js.Promise2.then(x => Js.log2("Promise2.then", x) |> Js.Promise.resolve)
6+
let _ = xx->Js.Promise2.then(x => Js.Promise.resolve(Js.log2("Promise2.then", x)))
77
let _ = xx->Js.Promise2.catch(x => {
88
Js.log2("Promise2.catch_", x)
9-
0 |> Js.Promise.resolve
9+
Js.Promise.resolve(0)
1010
})
1111

1212
// This crashes
13-
let _ = Js.Promise.then_(x => Js.log2("Promise.then_", x) |> Js.Promise.resolve, xx)
13+
let _ = Js.Promise.then_(x => Js.Promise.resolve(Js.log2("Promise.then_", x)), xx)
1414
}
1515

16-
let create = async (x) => {
16+
let create = async x => {
1717
Js.log2("create", x)
1818
x
1919
}

jscomp/test/UncurriedAlways.res

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
let foo = (x, y) => x + y
44

5-
let z = foo(. 3, 4)
5+
let z = foo(3, 4)
66

7-
let bar = (. x, y) => x + y
7+
let bar = (x, y) => x + y
88

99
let b = bar(3, 4)
1010

1111
let w = 3->foo(4)
1212

13-
let a = 3->foo(. 4)
13+
let a = 3->foo(4)
1414

1515
Js.log(a) // Test automatic uncurried application
1616

17-
let _ = Js.Array2.map([1], (. x) => x + 1)
17+
let _ = Js.Array2.map([1], x => x + 1)
1818

19-
let ptl = @res.partial foo(10) // force partial application
19+
let ptl = foo(10, ...) // force partial application
2020

2121
let foo2 = (x, y) => x + y
2222
let bar2: _ => _ = foo2(_, 3)
@@ -31,7 +31,7 @@ let q: cmp = _ => Jsx.null // Check that subtyping works past type definitions
3131
let inl = () => ()
3232

3333
@inline
34-
let inl2 = (x,y) => x+y
34+
let inl2 = (x, y) => x + y
3535

3636
module AllLabels = {
3737
let foo = (~x, ~y, ~z) => (x, y, z)
@@ -54,7 +54,17 @@ module OptAtEnd = {
5454
}
5555

5656
module OptMixed = {
57-
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)
57+
let foo = (~d1="d1=0", ~x, ~d2="d2=0", ~y, ~d3="d3=0", ~z, ~d4="d4=0", ~w, ~d5="d5=0") => (
58+
d1,
59+
x,
60+
d2,
61+
y,
62+
d3,
63+
z,
64+
d4,
65+
w,
66+
d5,
67+
)
5868

5969
let ptl = foo(~y="y", ~w="w", ...)
6070

@@ -72,7 +82,7 @@ let fn = cb => {
7282

7383
fn(s => Js.log(#foo(s)))
7484

75-
let fn1 = (a, b, ()) => a() + b
85+
let fn1 = (a, b, ()) => a() + b
7686

7787
let a = fn1(() => 1, 2, _)
7888

@@ -93,7 +103,7 @@ module PartialApplication = {
93103

94104
module ReverseApplication = {
95105
let hello1 = (y, f) => f(y)
96-
let hello2 = (y, f) => y |> f
106+
let hello2 = (y, f) => f(y)
97107
}
98108

99109
module Pipe = {
@@ -104,4 +114,4 @@ module Pipe = {
104114
let f3 = (foo, x) => foo(x)
105115

106116
let f4 = (x, f) => x->f(3)
107-
}
117+
}

0 commit comments

Comments
 (0)