@@ -56,11 +56,11 @@ public func check${inc.capitalize()}rementable<Instances, BaseCollection>(
56
56
_ instances: Instances,
57
57
of baseCollection: BaseCollection,
58
58
equalityOracle: ( Instances . Index, Instances . Index) - > Bool,
59
- ${ end} Index: Instances. Iterator . Element, ${ TRACE}
59
+ ${ end} Index: Instances. Element, ${ TRACE}
60
60
) where
61
61
Instances : Collection,
62
62
BaseCollection : ${ protocol} ,
63
- Instances . Iterator . Element == BaseCollection . Index {
63
+ Instances . Element == BaseCollection . Index {
64
64
65
65
checkEquatable ( instances, oracle: equalityOracle, ${ trace} )
66
66
for i in instances {
@@ -82,20 +82,20 @@ internal func _checkIncrementalAdvance<Instances, BaseCollection>(
82
82
_ instances: Instances ,
83
83
of baseCollection : BaseCollection ,
84
84
equalityOracle: ( Instances . Index , Instances . Index ) -> Bool ,
85
- limit: Instances . Iterator . Element ,
86
- sign: BaseCollection . IndexDistance , // 1 or -1
87
- next: ( Instances . Iterator . Element ) -> Instances . Iterator . Element ,
85
+ limit: Instances . Element ,
86
+ sign: Int , // 1 or -1
87
+ next: ( Instances . Element ) -> Instances . Element ,
88
88
${ TRACE}
89
89
) where
90
90
Instances : Collection ,
91
91
BaseCollection : Collection ,
92
- Instances. Iterator . Element == BaseCollection . Index {
92
+ Instances. Element == BaseCollection . Index {
93
93
for i in instances {
94
- let d : BaseCollection . IndexDistance = sign > 0 ?
94
+ let d : Int = sign > 0 ?
95
95
baseCollection. distance ( from: i, to: limit) :
96
96
- baseCollection. distance ( from: limit, to: i)
97
97
98
- var offset : BaseCollection . IndexDistance = 0
98
+ var offset : Int = 0
99
99
for _ in 0 ... Int64 ( d * sign) {
100
100
let j = baseCollection. index ( i, offsetBy: offset)
101
101
let k = baseCollection. index ( i, offsetBy: offset + sign, limitedBy: limit) ?? limit
@@ -119,11 +119,11 @@ public func checkForwardIndex<Instances, BaseCollection>(
119
119
_ instances: Instances ,
120
120
of baseCollection: BaseCollection ,
121
121
equalityOracle: ( Instances . Index , Instances . Index ) -> Bool ,
122
- endIndex: Instances . Iterator . Element , ${ TRACE}
122
+ endIndex: Instances . Element , ${ TRACE}
123
123
) where
124
124
Instances : Collection ,
125
125
BaseCollection : Collection ,
126
- Instances. Iterator . Element == BaseCollection . Index {
126
+ Instances. Element == BaseCollection . Index {
127
127
128
128
checkIncrementable ( instances, of: baseCollection,
129
129
equalityOracle: equalityOracle, endIndex: endIndex, ${ trace} )
@@ -144,13 +144,13 @@ public func checkBidirectionalIndex<Instances, BaseCollection>(
144
144
_ instances: Instances ,
145
145
of baseCollection: BaseCollection ,
146
146
equalityOracle: ( Instances . Index , Instances . Index ) -> Bool ,
147
- startIndex: Instances . Iterator . Element ,
148
- endIndex: Instances . Iterator . Element ,
147
+ startIndex: Instances . Element ,
148
+ endIndex: Instances . Element ,
149
149
${ TRACE}
150
150
) where
151
151
Instances: Collection ,
152
152
BaseCollection : BidirectionalCollection ,
153
- Instances. Iterator . Element == BaseCollection . Index {
153
+ Instances. Element == BaseCollection . Index {
154
154
155
155
checkForwardIndex ( instances, of: baseCollection,
156
156
equalityOracle: equalityOracle, endIndex: endIndex)
@@ -176,18 +176,18 @@ public func checkRandomAccessIndex<Instances, Distances, BaseCollection>(
176
176
_ instances: Instances , distances: Distances ,
177
177
of baseCollection: BaseCollection ,
178
178
distanceOracle:
179
- ( Instances . Index , Instances . Index ) -> Distances . Iterator . Element ,
179
+ ( Instances . Index , Instances . Index ) -> Distances . Element ,
180
180
advanceOracle:
181
- ( Instances . Index , Distances . Index ) -> Instances . Iterator . Element ,
181
+ ( Instances . Index , Distances . Index ) -> Instances . Element ,
182
182
startIndex: Instances . Iterator . Element ,
183
183
endIndex: Instances . Iterator . Element ,
184
184
${ TRACE}
185
185
) where
186
186
Instances : Collection ,
187
187
Distances : Collection ,
188
188
BaseCollection : RandomAccessCollection ,
189
- Instances. Iterator . Element == BaseCollection . Index ,
190
- Distances. Iterator . Element == BaseCollection . IndexDistance {
189
+ Instances. Element == BaseCollection . Index ,
190
+ Distances. Element == Int {
191
191
192
192
checkBidirectionalIndex ( instances, of: baseCollection,
193
193
equalityOracle: { distanceOracle ( $0, $1) == 0 } ,
@@ -207,16 +207,16 @@ public func checkAdvancesAndDistances<Instances, Distances, BaseCollection>(
207
207
_ instances: Instances , distances: Distances ,
208
208
of baseCollection: BaseCollection ,
209
209
distanceOracle:
210
- ( Instances . Index , Instances . Index ) -> Distances . Iterator . Element ,
210
+ ( Instances . Index , Instances . Index ) -> Distances . Element ,
211
211
advanceOracle:
212
- ( Instances . Index , Distances . Index ) -> Instances . Iterator . Element ,
212
+ ( Instances . Index , Distances . Index ) -> Instances . Element ,
213
213
${ TRACE}
214
214
) where
215
215
Instances : Collection ,
216
216
Distances : Collection ,
217
217
BaseCollection : Collection ,
218
- Instances. Iterator . Element == BaseCollection . Index ,
219
- Distances. Iterator . Element == BaseCollection . IndexDistance {
218
+ Instances. Element == BaseCollection . Index ,
219
+ Distances. Element == Int {
220
220
221
221
checkComparable (
222
222
instances,
@@ -246,7 +246,7 @@ public func checkAdvancesAndDistances<Instances, Distances, BaseCollection>(
246
246
// picked up when the caller passes a literal), and another that
247
247
// accepts any appropriate Collection type.
248
248
% for genericParam , Element, Expected in [
249
- % ( 'Expected: Collection', 'Expected. Iterator . Element', 'Expected') ,
249
+ % ( 'Expected: Collection', 'Expected. Element', 'Expected') ,
250
250
% ( 'Element' , 'Element' , 'Array< Element> ') ] :
251
251
252
252
// Top-level check for Collection instances. Alias for checkForwardCollection.
@@ -257,7 +257,7 @@ public func checkCollection<${genericParam}, C : Collection>(
257
257
${ TRACE} ,
258
258
resiliencyChecks: CollectionMisuseResiliencyChecks = . all,
259
259
sameValue: ( ${ Element} , ${ Element} ) - > Bool
260
- ) where C. Iterator . Element == ${ Element} {
260
+ ) where C . Element == ${ Element} {
261
261
262
262
checkForwardCollection ( expected, collection, message ( ) ,
263
263
stackTrace: stackTrace, showFrame: showFrame, file: file, line: line,
@@ -276,7 +276,7 @@ public func check${Traversal}Collection<
276
276
${ TRACE} ,
277
277
resiliencyChecks: CollectionMisuseResiliencyChecks = . all
278
278
) where
279
- C . Iterator . Element == ${ Element} ,
279
+ C . Element == ${ Element} ,
280
280
${ Element} : Equatable {
281
281
282
282
check ${ Traversal} Collection(
@@ -296,7 +296,7 @@ public func check${Traversal}Collection<
296
296
resiliencyChecks: CollectionMisuseResiliencyChecks = . all,
297
297
sameValue: ( ${ Element} , ${ Element} ) - > Bool
298
298
) where
299
- C . Iterator . Element == ${ Element} {
299
+ C . Element == ${ Element} {
300
300
301
301
checkOneLevelOf ${ Traversal} Collection( expected, collection, ${ trace} ,
302
302
resiliencyChecks: resiliencyChecks, sameValue: sameValue)
@@ -324,7 +324,7 @@ public func checkOneLevelOf${Traversal}Collection<
324
324
${ TRACE} ,
325
325
resiliencyChecks: CollectionMisuseResiliencyChecks = . all,
326
326
sameValue: ( ${ Element} , ${ Element} ) - > Bool
327
- ) where C. Iterator . Element == ${ Element} {
327
+ ) where C. Element == ${ Element} {
328
328
329
329
// A `Collection` is a multi-pass `Sequence`.
330
330
for _ in 0 ..< 3 {
@@ -370,7 +370,7 @@ public func checkOneLevelOf${Traversal}Collection<
370
370
371
371
% else:
372
372
% assert( Traversal == 'Rando mAccess')
373
- typealias Distance = C . IndexDistance
373
+ typealias Distance = Int
374
374
375
375
let count: Distance = collection. count
376
376
let offset0 = min ( 5 , count)
@@ -501,7 +501,7 @@ ${genericParam}, S : ${TraversalCollection}
501
501
resiliencyChecks: CollectionMisuseResiliencyChecks = . all,
502
502
sameValue: ( ${ Element} , ${ Element} ) - > Bool
503
503
) where
504
- S . Iterator . Element == ${ Element} {
504
+ S . Element == ${ Element} {
505
505
506
506
let expectedArray = Array ( expected)
507
507
@@ -564,14 +564,14 @@ public func checkRangeReplaceable<C, N>(
564
564
) where
565
565
C : RangeReplaceableCollection,
566
566
N : Collection,
567
- C . Iterator . Element : Equatable,
568
- C . Iterator . Element == N . Iterator . Element {
567
+ C . Element : Equatable,
568
+ C . Element == N . Element {
569
569
570
570
typealias A = C
571
571
572
572
// First make an independent copy of the array that we can use for
573
573
// comparison later.
574
- let source = Array < A . Iterator . Element > ( makeCollection ( ) )
574
+ let source = Array < A . Element > ( makeCollection ( ) )
575
575
576
576
for (ix, i) in source. indices. enumerated ( ) {
577
577
for (jx_, j) in ( i..< source. endIndex) . enumerated ( ) {
0 commit comments