Skip to content

Commit 4e828c6

Browse files
committed
Js.Array2 -> Array
1 parent 97e74d5 commit 4e828c6

29 files changed

+100
-1268
lines changed

tests/build_tests/uncurried-always/src/UncurriedAlways.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ let a = 3->foo(4)
1212

1313
Console.log(a) // Test automatic uncurried application
1414

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

tests/syntax_benchmarks/data/RedBlackTree.res

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ let make = (~compare) => {size: 0, root: None, compare}
515515

516516
let makeWith = (array, ~compare) => {
517517
let rbt = make(~compare)
518-
array->Js.Array2.forEach(((value, height)) => add(rbt,value, ~height)->ignore)
518+
array->Array.forEach(((value, height)) => add(rbt,value, ~height)->ignore)
519519
rbt
520520
}
521521

@@ -705,7 +705,7 @@ let onChangedVisible =
705705
let old = oldNewVisible.new
706706
let new = oldNewVisible.old
707707
// empty new
708-
new->Js.Array2.removeCountInPlace(~pos=0, ~count=new->Js.Array2.length)->ignore
708+
new->Array.removeCountInPlace(~pos=0, ~count=new->Array.length)->ignore
709709
oldNewVisible.old = old
710710
oldNewVisible.new = new
711711

@@ -718,21 +718,21 @@ let onChangedVisible =
718718
let first = firstVisibleNode(rbt.root, top)
719719
let last = lastVisibleNode(rbt.root, bottom)
720720

721-
let oldLen = old->Js.Array2.length
721+
let oldLen = old->Array.length
722722
let oldIter = ref(0)
723723
iterateWithY(~inclusive=true, first, last, ~callback=(. node, y_) => {
724724
let y = y_ +. anchorDelta
725725
if y >= 0.0 { // anchoring can make y negative
726726
while (
727727
oldIter.contents < oldLen &&
728-
rbt.compare(. Js.Array2.unsafe_get(old, oldIter.contents), node.value) < 0
728+
rbt.compare(. Array.unsafe_get(old, oldIter.contents), node.value) < 0
729729
) {
730-
disappear(. Js.Array2.unsafe_get(old, oldIter.contents))
730+
disappear(. Array.unsafe_get(old, oldIter.contents))
731731
oldIter.contents = oldIter.contents + 1
732732
}
733-
new->Js.Array2.push(node.value)->ignore
733+
new->Array.push(node.value)->ignore
734734
if (oldIter.contents < oldLen) {
735-
let cmp = rbt.compare(. Js.Array2.unsafe_get(old, oldIter.contents), node.value)
735+
let cmp = rbt.compare(. Array.unsafe_get(old, oldIter.contents), node.value)
736736
if cmp == 0 {
737737
remained(. node, y)
738738
oldIter.contents = oldIter.contents + 1
@@ -745,7 +745,7 @@ let onChangedVisible =
745745
}
746746
})
747747
while (oldIter.contents < oldLen) {
748-
disappear(. Js.Array2.unsafe_get(old, oldIter.contents))
748+
disappear(. Array.unsafe_get(old, oldIter.contents))
749749
oldIter.contents = oldIter.contents + 1
750750
}
751751
};

tests/syntax_benchmarks/data/RedBlackTreeNoComments.res

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ let make = (~compare) => {size: 0, root: None, compare: compare}
413413

414414
let makeWith = (array, ~compare) => {
415415
let rbt = make(~compare)
416-
array->Js.Array2.forEach(((value, height)) =>
416+
array->Array.forEach(((value, height)) =>
417417
add(rbt, value, ~height)->ignore
418418
)
419419
rbt
@@ -590,7 +590,7 @@ let onChangedVisible = (
590590
let new = oldNewVisible.old
591591

592592
new
593-
->Js.Array2.removeCountInPlace(~pos=0, ~count=new->Js.Array2.length)
593+
->Array.removeCountInPlace(~pos=0, ~count=new->Array.length)
594594
->ignore
595595
oldNewVisible.old = old
596596
oldNewVisible.new = new
@@ -604,25 +604,25 @@ let onChangedVisible = (
604604
let first = firstVisibleNode(rbt.root, top)
605605
let last = lastVisibleNode(rbt.root, bottom)
606606

607-
let oldLen = old->Js.Array2.length
607+
let oldLen = old->Array.length
608608
let oldIter = ref(0)
609609
iterateWithY(~inclusive=true, first, last, (. node, y_) => {
610610
let y = y_ +. anchorDelta
611611
if y >= 0.0 {
612612
while (
613613
oldIter.contents < oldLen &&
614614
rbt.compare(.
615-
Js.Array2.unsafe_get(old, oldIter.contents),
615+
Array.unsafe_get(old, oldIter.contents),
616616
node.value,
617617
) < 0
618618
) {
619-
disappear(. Js.Array2.unsafe_get(old, oldIter.contents))
619+
disappear(. Array.unsafe_get(old, oldIter.contents))
620620
oldIter.contents = oldIter.contents + 1
621621
}
622-
new->Js.Array2.push(node.value)->ignore
622+
new->Array.push(node.value)->ignore
623623
if oldIter.contents < oldLen {
624624
let cmp = rbt.compare(.
625-
Js.Array2.unsafe_get(old, oldIter.contents),
625+
Array.unsafe_get(old, oldIter.contents),
626626
node.value,
627627
)
628628
if cmp == 0 {
@@ -637,7 +637,7 @@ let onChangedVisible = (
637637
}
638638
})
639639
while oldIter.contents < oldLen {
640-
disappear(. Js.Array2.unsafe_get(old, oldIter.contents))
640+
disappear(. Array.unsafe_get(old, oldIter.contents))
641641
oldIter.contents = oldIter.contents + 1
642642
}
643643
}

tests/syntax_tests/data/conversion/reason/braces.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ let f = () => id
33

44
if isArray(children) {
55
// Scenario 1
6-
let code = children->asStringArray->Js.Array2.joinWith("")
6+
let code = children->asStringArray->Array.joinWith("")
77
<InlineCode> {code->s} </InlineCode>
88
} else if isObject(children) {
99
// Scenario 2

tests/syntax_tests/data/idempotency/reasonml.org/components/Markdown.res

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ module UrlBox = {
6161
<>
6262
<P> imgEl {headChildren->toReactElement} </P>
6363
{if length > 1 {
64-
arr->Js.Array2.slice(~start=1, ~end_=length)->Mdx.arrToReactElement
64+
arr->Array.slice(~start=1, ~end_=length)->Mdx.arrToReactElement
6565
} else {
6666
React.null
6767
}}
@@ -258,7 +258,7 @@ module Code = {
258258
*/
259259
if isArray(children) {
260260
// Scenario 1
261-
let code = children->asStringArray->Js.Array2.joinWith("")
261+
let code = children->asStringArray->Array.joinWith("")
262262
<InlineCode> {code->s} </InlineCode>
263263
} else if isObject(children) {
264264
// Scenario 2
@@ -360,7 +360,7 @@ module Li = {
360360
arr->getExn(arr->length - 1)
361361
}
362362

363-
let head = Js.Array2.slice(arr, ~start=0, ~end_=arr->Belt.Array.length - 1)
363+
let head = Array.slice(arr, ~start=0, ~end_=arr->Belt.Array.length - 1)
364364

365365
let first = Belt.Array.getExn(head, 0)
366366

tests/syntax_tests/data/idempotency/reasonml.org/layouts/SidebarLayout.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module UrlPath = {
3737
None
3838
} else {
3939
let version = Belt.Array.getExn(allPaths, 0)
40-
let (up, current) = switch Js.Array2.slice(allPaths, ~end_=total, ~start=-2) {
40+
let (up, current) = switch Array.slice(allPaths, ~end_=total, ~start=-2) {
4141
| [up, current] =>
4242
let up = up === version ? None : Some(up)
4343
(up, Some(current))

tests/syntax_tests/data/idempotency/warp/Warp_FormData.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ let set = (client, formData) => {
1313
...client,
1414
formData: Belt.List.map(formData, ((key, value)) => key ++ ("=" ++ value))
1515
->Belt.List.toArray
16-
->Js.Array2.joinWith("&")
16+
->Array.joinWith("&")
1717
->Some,
1818
requestType: "application/x-www-form-urlencoded",
1919
}
@@ -30,7 +30,7 @@ let remove = (client, keyToRemove) => {
3030
| _ => true
3131
}
3232
)
33-
->Js.Array2.joinWith("&")
33+
->Array.joinWith("&")
3434
->Some
3535
| None => None
3636
},

tests/syntax_tests/data/idempotency/warp/Warp_QueryString.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let set = (client, queryString) => {
1212
...client,
1313
queryString: Belt.List.map(queryString, ((key, value)) => key ++ ("=" ++ value))
1414
->Belt.List.toArray
15-
->Js.Array2.joinWith("&")
15+
->Array.joinWith("&")
1616
->Some,
1717
}
1818

@@ -28,7 +28,7 @@ let remove = (client, keyToRemove) => {
2828
| _ => true
2929
}
3030
)
31-
->Js.Array2.joinWith("&")
31+
->Array.joinWith("&")
3232
->Some
3333
| None => None
3434
},

tests/syntax_tests/data/idempotency/wildcards-world-ui/TotalContribution.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ let useLoadMostContributedData = () => {
3636

3737
(patron.id, totalContributedWei)
3838
})
39-
->Js.Array2.sortInPlaceWith(((_, first), (_, second)) => second->BN.cmp(first))
39+
->Array.sortInPlaceWith(((_, first), (_, second)) => second->BN.cmp(first))
4040
->Some
4141
| _ => None
4242
}

tests/syntax_tests/data/idempotency/wildcards-world-ui/TotalDaysHeld.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ let useLoadMostDaysHeldData = () => {
3030

3131
(patron.id, totalTimeHeldWei)
3232
})
33-
->Js.Array2.sortInPlaceWith(((_, first), (_, second)) => second->BN.cmp(first))
33+
->Array.sortInPlaceWith(((_, first), (_, second)) => second->BN.cmp(first))
3434
->Some
3535
| _ => None
3636
}

tests/syntax_tests/data/parsing/errors/expressions/block.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
let findThreadByIdLinearScan = (~threads, ~id) => {
2-
Js.Array2.findi(ThreadsModel.threads, (thread, i) => {
2+
Array.findi(ThreadsModel.threads, (thread, i) => {
33
let thisId = switch (thread) {
44
| ServerData.OneToOne({otherPersonIDWhichIsAlsoThreadID}) =>
55
otherPersonIDWhichIsAlsoThreadID

tests/syntax_tests/data/printer/expr/apply.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ let () = applyFunctionToArguments(
1313
superLongIdentifierWooooooowThisIsSuchLong,
1414
)
1515

16-
let cmp = rbt.compare(. Js.Array2.unsafe_get(old, oldIter.contents), node.value)
17-
let cmp = rbt.compare2(. Js.Array2.unsafe_get(old, oldIter.contents), longerNode.longValue)
16+
let cmp = rbt.compare(. Array.unsafe_get(old, oldIter.contents), node.value)
17+
let cmp = rbt.compare2(. Array.unsafe_get(old, oldIter.contents), longerNode.longValue)
1818
let uncurriedUnit = apply(.)
1919

2020
let coordinate = make2dCoordinate({x: 1, y: 2})

tests/syntax_tests/data/printer/expr/binary.res

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ while (continuePrefix.contents && aPrefixLen.contents && bPrefixLen.contents &&
1313

1414
// uncurried attribute shouldn't result in parens
1515
while (
16-
rbt.compare(. Js.Array2.unsafe_get(old, oldIter.contents), node.value) < 0
16+
rbt.compare(. Array.unsafe_get(old, oldIter.contents), node.value) < 0
1717
) {
1818
()
1919
}
@@ -276,28 +276,28 @@ let x = (true ? 0 : 1) + (false ? 1 : 0) + (false ? 1 : 0)
276276
while (
277277
oldIter.contents < oldLen &&
278278
rbt.compare(.
279-
Js.Array2.unsafe_get(old, oldIter.contents),
279+
Array.unsafe_get(old, oldIter.contents),
280280
node.value,
281281
)
282282
) {
283-
disappear(. Js.Array2.unsafe_get(old, oldIter.contents))
283+
disappear(. Array.unsafe_get(old, oldIter.contents))
284284
oldIter.contents = oldIter.contents + 1
285285
}
286286

287287
while (
288288
oldIter.contents < oldLen &&
289289
rbt.compare(.
290-
Js.Array2.unsafe_get(old, oldIter.contents),
290+
Array.unsafe_get(old, oldIter.contents),
291291
node.value,
292292
) < 0
293293
) {
294-
disappear(. Js.Array2.unsafe_get(old, oldIter.contents))
294+
disappear(. Array.unsafe_get(old, oldIter.contents))
295295
oldIter.contents = oldIter.contents + 1
296296
}
297297

298298
let x =
299299
oldIter.contents < oldLen &&
300-
rbt.compare(Js.Array2.unsafe_get(old, oldIter.contents), node.value) < veryLongIdentifier;
300+
rbt.compare(Array.unsafe_get(old, oldIter.contents), node.value) < veryLongIdentifier;
301301

302302
// should be formatted on one line, i.e. NOT break
303303
let fullCircle = 2. *. pi

tests/syntax_tests/data/printer/expr/callback.res

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
array->Js.Array2.forEach(((value, height)) =>
1+
array->Array.forEach(((value, height)) =>
22
add(rbt, value, ~height)->ignore
33
)
4-
someArray->Js.Array2.forEach(((value, height)) => add(rbt, value, ~height)->ignore)
5-
someArraaaaaaayWithAVeryLooooooooooooooooooooooooooooooooooooooongName->Js.Array2.forEach(((value, height)) => add(rbt, value, ~height)->ignore)
4+
someArray->Array.forEach(((value, height)) => add(rbt, value, ~height)->ignore)
5+
someArraaaaaaayWithAVeryLooooooooooooooooooooooooooooooooooooooongName->Array.forEach(((value, height)) => add(rbt, value, ~height)->ignore)
66

77
let make = (arr, ~compare) => {
88
let rbt = make(~compare)
9-
array->Js.Array2.forEach(((value, height)) => add(rbt,value, ~height)->ignore)
9+
array->Array.forEach(((value, height)) => add(rbt,value, ~height)->ignore)
1010
rbt
1111
}
1212

@@ -31,12 +31,12 @@ Fooooooooooooooooooo.baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
3131

3232
let make = (arr, ~compare) => {
3333
let rbt = make(~compare)
34-
array->Js.Array2.forEach(((value, height)) => add(rbt, value, ~height)->ignore
34+
array->Array.forEach(((value, height)) => add(rbt, value, ~height)->ignore
3535
)
3636
rbt
3737
}
3838

39-
let tbl = data->Js.Array2.reduce(
39+
let tbl = data->Array.reduce(
4040
(map, curr) => {
4141
let (website, user) = curr
4242
if map->Belt.Map.String.has(website) {
@@ -55,7 +55,7 @@ let _ = {
5555
let similarity = (a, b) => {
5656
// nbr of users in common/number of users who have visited either in total
5757
let tbl =
58-
data->Js.Array2.reduce(
58+
data->Array.reduce(
5959
(map, curr) => {
6060
let (website, user) = curr
6161
if map->Belt.Map.String.has(website) {
@@ -233,7 +233,7 @@ myPromise->Js.Promise.then_(value => {
233233
}, _)
234234

235235
let decoratorTags =
236-
items->Js.Array2.filter(items => {items.category === Decorators})->Belt.Array.map(item => {
236+
items->Array.filter(items => {items.category === Decorators})->Belt.Array.map(item => {
237237
<span className="mr-2" key=item.name> <Tag text={item.name} /> </span>
238238
})
239239

@@ -312,9 +312,9 @@ let make = fn(
312312

313313
// comments should not disappear on the pattern
314314
let /* a */ decoratorTags /* b */ = items
315-
->Js.Array2.filter(items => {items.category === Decorators})
315+
->Array.filter(items => {items.category === Decorators})
316316

317-
let /* a */ decoratorTags /* b */ = items->Js.Array2.filter(items => {
317+
let /* a */ decoratorTags /* b */ = items->Array.filter(items => {
318318
items.category === Decorators
319319
|| items.category === ChristmasLighting
320320
|| items.category === Unknown

tests/syntax_tests/data/printer/other/nesting.res

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
let unitsCommands = state.units->Js.Array2.mapi(({
1+
let unitsCommands = state.units->Array.mapi(({
22
unit: targetUnit,
33
coordinates: targetCoordinates,
44
}, i) => {
55
// n^2
66
let res = []
7-
state.units->Js.Array2.forEachi(({
7+
state.units->Array.forEachi(({
88
unit: unitThatMightBeAttacking,
99
coordinates: unitThatMightBeAttackingCoordinates,
1010
}, j) => {
1111
if i !== j {
12-
switch Js.Array2.unsafe_get(
12+
switch Array.unsafe_get(
1313
unitThatMightBeAttacking.timeline,
1414
unitThatMightBeAttacking.currentFrame,
1515
).effect {
@@ -41,9 +41,9 @@ let unitsCommands = state.units->Js.Array2.mapi(({
4141
),
4242
coordinates: {x: sparksX, y: sparksY, z: 0.},
4343
}
44-
particlesToAdd->Js.Array2.push(spark)->ignore
44+
particlesToAdd->Array.push(spark)->ignore
4545

46-
res->Js.Array2.push(Unit.CommandAttacked({damage: damage}))->ignore
46+
res->Array.push(Unit.CommandAttacked({damage: damage}))->ignore
4747
}
4848
| _ => ()
4949
}

tests/tests/src/UncurriedAlways.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ let a = 3->foo(4)
1414

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

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

1919
let ptl = foo(10, ...) // force partial application
2020

0 commit comments

Comments
 (0)