Skip to content

Commit ca986bb

Browse files
committed
Update formatted runtimes and tests files
1 parent 97ae553 commit ca986bb

Some content is hidden

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

49 files changed

+576
-679
lines changed

runtime/Belt_Array.resi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ assertEqual(Belt.Array.reverse([10, 11, 12, 13, 14]), [14, 13, 12, 11, 10])
126126
*/
127127
let reverse: t<'a> => t<'a>
128128

129-
@new
130129
/**
131130
`makeUninitialized(n)` creates an array of length `n` filled with the undefined
132131
value. You must specify the type of data that will eventually fill the array.
@@ -139,9 +138,9 @@ let arr: array<Js.undefined<string>> = Belt.Array.makeUninitialized(5)
139138
assertEqual(Belt.Array.getExn(arr, 0), Js.undefined)
140139
```
141140
*/
141+
@new
142142
external makeUninitialized: int => array<Js.undefined<'a>> = "Array"
143143

144-
@new
145144
/**
146145
**Unsafe**
147146
@@ -157,6 +156,7 @@ Belt.Array.setExn(arr, 0, "example")
157156
assertEqual(Belt.Array.getExn(arr, 0), "example")
158157
```
159158
*/
159+
@new
160160
external makeUninitializedUnsafe: int => t<'a> = "Array"
161161

162162
/**
@@ -335,11 +335,11 @@ assertEqual(Belt.Array.sliceToEnd([10, 11, 12, 13, 14, 15, 16], -4), [13, 14, 15
335335
*/
336336
let sliceToEnd: (t<'a>, int) => t<'a>
337337

338-
@send
339338
/**
340339
`copy(a)` returns a copy of `a`; that is; a fresh array containing the same
341340
elements as `a`.
342341
*/
342+
@send
343343
external copy: (t<'a>, @as(0) _) => t<'a> = "slice"
344344

345345
/**
@@ -770,7 +770,6 @@ assertEqual(Belt.Array.eq([1, 2, 3], [(-1), (-2), (-3)], (a, b) => abs(a) == abs
770770
*/
771771
let eq: (t<'a>, t<'a>, ('a, 'a) => bool) => bool
772772

773-
@set
774773
/**
775774
Unsafe `truncateToLengthUnsafe(xs, n)` sets length of array `xs` to `n`. If `n`
776775
is greater than the length of `xs`; the extra elements are set to `Js.Null_undefined.null`.
@@ -786,6 +785,7 @@ Belt.Array.truncateToLengthUnsafe(arr, 3)
786785
assertEqual(arr, ["ant", "bee", "cat"])
787786
```
788787
*/
788+
@set
789789
external truncateToLengthUnsafe: (t<'a>, int) => unit = "length"
790790

791791
@deprecated("Use `init` instead")

runtime/Belt_Float.resi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ assertEqual(Belt.Float.fromString("1.0"), Some(1.0))
5757
*/
5858
let fromString: string => option<float>
5959

60-
@val
6160
/**
6261
Converts a given `float` to a `string`. Uses the JavaScript `String` constructor under the hood.
6362
@@ -67,6 +66,7 @@ Converts a given `float` to a `string`. Uses the JavaScript `String` constructor
6766
assertEqual(Belt.Float.toString(1.0), "1")
6867
```
6968
*/
69+
@val
7070
external toString: float => string = "String"
7171

7272
/**

runtime/Belt_List.resi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,6 @@ assertEqual(Belt.List.keep(list{None, Some(2), Some(3), None}, Belt.Option.isSom
790790
*/
791791
let keep: (t<'a>, 'a => bool) => t<'a>
792792

793-
@deprecated("This function will soon be deprecated. Please, use `List.keep` instead.")
794793
/**
795794
Returns a list of all elements in `someList` which satisfy the predicate function `pred`.
796795
@@ -804,6 +803,7 @@ assertEqual(Belt.List.filter(list{1, 2, 3, 4}, isEven), list{2, 4})
804803
assertEqual(Belt.List.filter(list{None, Some(2), Some(3), None}, Belt.Option.isSome), list{Some(2), Some(3)})
805804
```
806805
*/
806+
@deprecated("This function will soon be deprecated. Please, use `List.keep` instead.")
807807
let filter: (t<'a>, 'a => bool) => t<'a>
808808

809809
/** Uncurried version of [keepWithIndex](#keepWithIndex). */
@@ -823,10 +823,6 @@ assertEqual(Belt.List.keepWithIndex(list{1, 2, 3, 4}, (_x, index) => isEven(inde
823823
*/
824824
let keepWithIndex: (t<'a>, ('a, int) => bool) => t<'a>
825825

826-
@deprecated(
827-
"This function will soon be deprecated. Please, use `List.keepWithIndex` \
828-
instead."
829-
)
830826
/**
831827
Returns a list of all elements in `someList` which satisfy the predicate function `pred`.
832828
@@ -838,6 +834,10 @@ let isEven = x => mod(x, 2) == 0
838834
assertEqual(Belt.List.filterWithIndex(list{1, 2, 3, 4}, (_x, index) => isEven(index)), list{1, 3})
839835
```
840836
*/
837+
@deprecated(
838+
"This function will soon be deprecated. Please, use `List.keepWithIndex` \
839+
instead."
840+
)
841841
let filterWithIndex: (t<'a>, ('a, int) => bool) => t<'a>
842842

843843
/** Uncurried version of [keepMap](#keepMap). */

runtime/Js.res

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,17 @@ external undefined: undefined<'a> = "%undefined"
219219
*/
220220
external typeof: 'a => string = "%typeof"
221221

222-
@val @scope("console") /** Equivalent to console.log any value. */
222+
/** Equivalent to console.log any value. */
223+
@val @scope("console")
223224
external log: 'a => unit = "log"
224225

225226
@val @scope("console") external log2: ('a, 'b) => unit = "log"
226227
@val @scope("console") external log3: ('a, 'b, 'c) => unit = "log"
227228

228229
@val @scope("console") external log4: ('a, 'b, 'c, 'd) => unit = "log"
229230

230-
@val @scope("console") @variadic /** A convenience function to console.log more than 4 arguments */
231+
/** A convenience function to console.log more than 4 arguments */
232+
@val @scope("console") @variadic
231233
external logMany: array<'a> => unit = "log"
232234

233235
external eqNull: ('a, null<'a>) => bool = "%equal_null"

runtime/Js_array.res

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ type array_like<'a> = Js_array2.array_like<'a>
6969
type 'a array_iter = 'a array_like
7070
*/
7171

72-
@val
7372
/**
7473
Creates a shallow copy of an array from an array-like object. See [`Array.from`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from) on MDN.
7574
@@ -80,11 +79,11 @@ let strArr = Js.String.castToArrayLike("abcd")
8079
Js.Array.from(strArr) == ["a", "b", "c", "d"]
8180
```
8281
*/
82+
@val
8383
external from: array_like<'a> => array<'a> = "Array.from"
8484

8585
/* ES2015 */
8686

87-
@val
8887
/**
8988
Creates a new array by applying a function (the second argument) to each item
9089
in the `array_like` first argument. See
@@ -99,6 +98,7 @@ let code = s => Js.String.charCodeAt(0, s)
9998
Js.Array.fromMap(strArr, code) == [97.0, 98.0, 99.0, 100.0]
10099
```
101100
*/
101+
@val
102102
external fromMap: (array_like<'a>, 'a => 'b) => array<'b> = "Array.from"
103103

104104
/* ES2015 */
@@ -119,10 +119,10 @@ Js.Array.isArray("abcd") == false
119119
```
120120
*/
121121

122-
@get
123122
/**
124123
Returns the number of elements in the array. See [`Array.length`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/length) on MDN.
125124
*/
125+
@get
126126
external length: array<'a> => int = "length"
127127

128128
/* Mutator functions */
@@ -244,8 +244,7 @@ let empty: array<int> = []
244244
Js.Array.pop(empty) == None
245245
```
246246
*/
247-
@send
248-
@return(undefined_to_opt)
247+
@send @return(undefined_to_opt)
249248
external pop: t<'a> => option<'a> = "pop"
250249

251250
/**
@@ -274,8 +273,7 @@ Js.Array.pushMany(["dog", "elk"], arr) == 5
274273
arr == ["ant", "bee", "cat", "dog", "elk"]
275274
```
276275
*/
277-
@send
278-
@variadic
276+
@send @variadic
279277
external pushMany: (t<'a>, array<'a>) => int = "push"
280278
let pushMany = (arg1, obj) => pushMany(obj, arg1)
281279

@@ -307,8 +305,7 @@ let empty: array<int> = []
307305
Js.Array.shift(empty) == None
308306
```
309307
*/
310-
@send
311-
@return(undefined_to_opt)
308+
@send @return(undefined_to_opt)
312309
external shift: t<'a> => option<'a> = "shift"
313310

314311
/**
@@ -382,8 +379,7 @@ Js.Array.spliceInPlace(~pos=9, ~remove=2, ~add=["x", "y", "z"], arr3) == []
382379
arr3 == ["a", "b", "c", "d", "e", "f", "x", "y", "z"]
383380
```
384381
*/
385-
@send
386-
@variadic
382+
@send @variadic
387383
external spliceInPlace: (t<'a>, ~pos: int, ~remove: int, ~add: array<'a>) => 'this = "splice"
388384
let spliceInPlace = (~pos, ~remove, ~add, obj) => spliceInPlace(obj, ~pos, ~remove, ~add)
389385

@@ -458,8 +454,7 @@ Js.Array.unshiftMany(["a", "b", "c"], arr) == 5
458454
arr == ["a", "b", "c", "d", "e"]
459455
```
460456
*/
461-
@send
462-
@variadic
457+
@send @variadic
463458
external unshiftMany: (t<'a>, array<'a>) => int = "unshift"
464459
let unshiftMany = (arg1, obj) => unshiftMany(obj, arg1)
465460

@@ -502,8 +497,7 @@ Js.Array.concatMany([["d", "e"], ["f", "g", "h"]], ["a", "b", "c"]) == [
502497
]
503498
```
504499
*/
505-
@send
506-
@variadic
500+
@send @variadic
507501
external concatMany: (t<'a>, array<'this>) => 'this = "concat"
508502
let concatMany = (arg1, obj) => concatMany(obj, arg1)
509503

@@ -780,8 +774,7 @@ Js.Array.find(x => x < 0, [33, 22, -55, 77, -44]) == Some(-55)
780774
Js.Array.find(x => x < 0, [33, 22, 55, 77, 44]) == None
781775
```
782776
*/
783-
@send
784-
@return(undefined_to_opt)
777+
@send @return(undefined_to_opt)
785778
external find: (t<'a>, 'a => bool) => option<'a> = "find"
786779
let find = (arg1, obj) => find(obj, arg1)
787780

@@ -798,8 +791,7 @@ Js.Array.findi(positiveOddElement, [66, -33, 55, 88, 22]) == Some(88)
798791
Js.Array.findi(positiveOddElement, [66, -33, 55, -88, 22]) == None
799792
```
800793
*/
801-
@send
802-
@return(undefined_to_opt)
794+
@send @return(undefined_to_opt)
803795
external findi: (t<'a>, ('a, int) => bool) => option<'a> = "find"
804796
let findi = (arg1, obj) => findi(obj, arg1)
805797

0 commit comments

Comments
 (0)