Skip to content

Commit 6b2dfad

Browse files
committed
[Unit test] Introduce type annotations for one-way closure parameters.
1 parent 275875c commit 6b2dfad

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

stdlib/private/StdlibCollectionUnittest/CheckCollectionInstance.swift

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -418,15 +418,15 @@ public func checkOneLevelOfForwardCollection<
418418
// Check Index semantics
419419
//===------------------------------------------------------------------===//
420420

421-
let succ = { collection.index(after: $0) }
421+
let succ: (C.Index) -> C.Index = { collection.index(after: $0) }
422422
// Advances up to 1 positions without passing endIndex. Don't use
423423
// advanced(by: n) to do this because it's under test here.
424-
let next = { $0 == collection.endIndex ? $0 : succ($0) }
424+
let next: (C.Index) -> C.Index = { $0 == collection.endIndex ? $0 : succ($0) }
425425

426426
// advances up to 5 positions without passing endIndex. Picking a
427427
// small constant to avoid complexity explosion on large input
428428
// collections.
429-
let next5 = { next(next(next(next(next($0))))) }
429+
let next5: (C.Index) -> C.Index = { next(next(next(next(next($0))))) }
430430

431431
let partWay0 = next5(collection.startIndex)
432432
let partWay1 = next5(partWay0)
@@ -528,7 +528,7 @@ Expected: Collection, S : Collection
528528

529529
let expectedArray = Array(expected)
530530

531-
let succ = { sliceable.index(after: $0) }
531+
let succ: (S.Index) -> S.Index = { sliceable.index(after: $0) }
532532

533533
var start = sliceable.startIndex
534534
for startNumericIndex in 0...expectedArray.count {
@@ -642,16 +642,16 @@ public func checkOneLevelOfBidirectionalCollection<
642642
// Check Index semantics
643643
//===------------------------------------------------------------------===//
644644

645-
let succ = { collection.index(after: $0) }
646-
let pred = { collection.index(before: $0) }
645+
let succ: (C.Index) -> C.Index = { collection.index(after: $0) }
646+
let pred: (C.Index) -> C.Index = { collection.index(before: $0) }
647647
// Advances up to 1 positions without passing endIndex. Don't use
648648
// advanced(by: n) to do this because it's under test here.
649-
let next = { $0 == collection.endIndex ? $0 : succ($0) }
649+
let next: (C.Index) -> C.Index = { $0 == collection.endIndex ? $0 : succ($0) }
650650

651651
// advances up to 5 positions without passing endIndex. Picking a
652652
// small constant to avoid complexity explosion on large input
653653
// collections.
654-
let next5 = { next(next(next(next(next($0))))) }
654+
let next5: (C.Index) -> C.Index = { next(next(next(next(next($0))))) }
655655

656656
let partWay0 = next5(collection.startIndex)
657657
let partWay1 = next5(partWay0)
@@ -778,8 +778,8 @@ Expected: Collection, S : BidirectionalCollection
778778

779779
let expectedArray = Array(expected)
780780

781-
let succ = { sliceable.index(after: $0) }
782-
let pred = { sliceable.index(before: $0) }
781+
let succ: (S.Index) -> S.Index = { sliceable.index(after: $0) }
782+
let pred: (S.Index) -> S.Index = { sliceable.index(before: $0) }
783783

784784
var start = sliceable.startIndex
785785
for startNumericIndex in 0...expectedArray.count {
@@ -905,15 +905,15 @@ public func checkOneLevelOfRandomAccessCollection<
905905
// Check Index semantics
906906
//===------------------------------------------------------------------===//
907907

908-
let succ = { collection.index(after: $0) }
908+
let succ: (C.Index) -> C.Index = { collection.index(after: $0) }
909909
// Advances up to 1 positions without passing endIndex. Don't use
910910
// advanced(by: n) to do this because it's under test here.
911-
let next = { $0 == collection.endIndex ? $0 : succ($0) }
911+
let next: (C.Index) -> C.Index = { $0 == collection.endIndex ? $0 : succ($0) }
912912

913913
// advances up to 5 positions without passing endIndex. Picking a
914914
// small constant to avoid complexity explosion on large input
915915
// collections.
916-
let next5 = { next(next(next(next(next($0))))) }
916+
let next5: (C.Index) -> C.Index = { next(next(next(next(next($0))))) }
917917

918918
let partWay0 = next5(collection.startIndex)
919919
let partWay1 = next5(partWay0)
@@ -1037,8 +1037,8 @@ Expected: Collection, S : RandomAccessCollection
10371037

10381038
let expectedArray = Array(expected)
10391039

1040-
let succ = { sliceable.index(after: $0) }
1041-
let pred = { sliceable.index(before: $0) }
1040+
let succ: (S.Index) -> S.Index = { sliceable.index(after: $0) }
1041+
let pred: (S.Index) -> S.Index = { sliceable.index(before: $0) }
10421042

10431043
var start = sliceable.startIndex
10441044
for startNumericIndex in 0...expectedArray.count {
@@ -1186,15 +1186,15 @@ public func checkOneLevelOfForwardCollection<
11861186
// Check Index semantics
11871187
//===------------------------------------------------------------------===//
11881188

1189-
let succ = { collection.index(after: $0) }
1189+
let succ: (C.Index) -> C.Index = { collection.index(after: $0) }
11901190
// Advances up to 1 positions without passing endIndex. Don't use
11911191
// advanced(by: n) to do this because it's under test here.
1192-
let next = { $0 == collection.endIndex ? $0 : succ($0) }
1192+
let next: (C.Index) -> C.Index = { $0 == collection.endIndex ? $0 : succ($0) }
11931193

11941194
// advances up to 5 positions without passing endIndex. Picking a
11951195
// small constant to avoid complexity explosion on large input
11961196
// collections.
1197-
let next5 = { next(next(next(next(next($0))))) }
1197+
let next5: (C.Index) -> C.Index = { next(next(next(next(next($0))))) }
11981198

11991199
let partWay0 = next5(collection.startIndex)
12001200
let partWay1 = next5(partWay0)
@@ -1296,7 +1296,7 @@ Element, S : Collection
12961296

12971297
let expectedArray = Array(expected)
12981298

1299-
let succ = { sliceable.index(after: $0) }
1299+
let succ: (S.Index) -> S.Index = { sliceable.index(after: $0) }
13001300

13011301
var start = sliceable.startIndex
13021302
for startNumericIndex in 0...expectedArray.count {
@@ -1410,16 +1410,16 @@ public func checkOneLevelOfBidirectionalCollection<
14101410
// Check Index semantics
14111411
//===------------------------------------------------------------------===//
14121412

1413-
let succ = { collection.index(after: $0) }
1414-
let pred = { collection.index(before: $0) }
1413+
let succ: (C.Index) -> C.Index = { collection.index(after: $0) }
1414+
let pred: (C.Index) -> C.Index = { collection.index(before: $0) }
14151415
// Advances up to 1 positions without passing endIndex. Don't use
14161416
// advanced(by: n) to do this because it's under test here.
1417-
let next = { $0 == collection.endIndex ? $0 : succ($0) }
1417+
let next: (C.Index) -> C.Index = { $0 == collection.endIndex ? $0 : succ($0) }
14181418

14191419
// advances up to 5 positions without passing endIndex. Picking a
14201420
// small constant to avoid complexity explosion on large input
14211421
// collections.
1422-
let next5 = { next(next(next(next(next($0))))) }
1422+
let next5: (C.Index) -> C.Index = { next(next(next(next(next($0))))) }
14231423

14241424
let partWay0 = next5(collection.startIndex)
14251425
let partWay1 = next5(partWay0)
@@ -1546,8 +1546,8 @@ Element, S : BidirectionalCollection
15461546

15471547
let expectedArray = Array(expected)
15481548

1549-
let succ = { sliceable.index(after: $0) }
1550-
let pred = { sliceable.index(before: $0) }
1549+
let succ: (S.Index) -> S.Index = { sliceable.index(after: $0) }
1550+
let pred: (S.Index) -> S.Index = { sliceable.index(before: $0) }
15511551

15521552
var start = sliceable.startIndex
15531553
for startNumericIndex in 0...expectedArray.count {
@@ -1673,15 +1673,15 @@ public func checkOneLevelOfRandomAccessCollection<
16731673
// Check Index semantics
16741674
//===------------------------------------------------------------------===//
16751675

1676-
let succ = { collection.index(after: $0) }
1676+
let succ: (C.Index) -> C.Index = { collection.index(after: $0) }
16771677
// Advances up to 1 positions without passing endIndex. Don't use
16781678
// advanced(by: n) to do this because it's under test here.
1679-
let next = { $0 == collection.endIndex ? $0 : succ($0) }
1679+
let next: (C.Index) -> C.Index = { $0 == collection.endIndex ? $0 : succ($0) }
16801680

16811681
// advances up to 5 positions without passing endIndex. Picking a
16821682
// small constant to avoid complexity explosion on large input
16831683
// collections.
1684-
let next5 = { next(next(next(next(next($0))))) }
1684+
let next5: (C.Index) -> C.Index = { next(next(next(next(next($0))))) }
16851685

16861686
let partWay0 = next5(collection.startIndex)
16871687
let partWay1 = next5(partWay0)
@@ -1805,8 +1805,8 @@ Element, S : RandomAccessCollection
18051805

18061806
let expectedArray = Array(expected)
18071807

1808-
let succ = { sliceable.index(after: $0) }
1809-
let pred = { sliceable.index(before: $0) }
1808+
let succ: (S.Index) -> S.Index = { sliceable.index(after: $0) }
1809+
let pred: (S.Index) -> S.Index = { sliceable.index(before: $0) }
18101810

18111811
var start = sliceable.startIndex
18121812
for startNumericIndex in 0...expectedArray.count {

0 commit comments

Comments
 (0)