Skip to content

Commit 42968b2

Browse files
committed
Eliminate a number of uses of the *Indexable protocols.
1 parent fb253b1 commit 42968b2

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

stdlib/private/StdlibCollectionUnittest/CheckCollectionInstance.swift.gyb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public struct CollectionMisuseResiliencyChecks {
4040
}
4141

4242
% for inc, protocol, direction, end in (
43-
% ('inc', '_Indexable', 'after', 'end'),
44-
% ('dec', '_BidirectionalIndexable', 'before', 'start')):
43+
% ('inc', 'Collection', 'after', 'end'),
44+
% ('dec', 'BidirectionalCollection', 'before', 'start')):
4545

4646
/// Test that the elements of `instances` satisfy
4747
/// ${'some of ' if inc == 'dec' else ''}the semantic
@@ -88,7 +88,7 @@ internal func _checkIncrementalAdvance<Instances, BaseCollection>(
8888
${TRACE}
8989
) where
9090
Instances : Collection,
91-
BaseCollection : _Indexable,
91+
BaseCollection : Collection,
9292
Instances.Iterator.Element == BaseCollection.Index {
9393
for i in instances {
9494
let d: BaseCollection.IndexDistance = sign > 0 ?
@@ -122,7 +122,7 @@ public func checkForwardIndex<Instances, BaseCollection>(
122122
endIndex: Instances.Iterator.Element, ${TRACE}
123123
) where
124124
Instances : Collection,
125-
BaseCollection : _Indexable,
125+
BaseCollection : Collection,
126126
Instances.Iterator.Element == BaseCollection.Index {
127127

128128
checkIncrementable(instances, of: baseCollection,
@@ -149,7 +149,7 @@ public func checkBidirectionalIndex<Instances, BaseCollection>(
149149
${TRACE}
150150
) where
151151
Instances: Collection,
152-
BaseCollection : _BidirectionalIndexable,
152+
BaseCollection : BidirectionalCollection,
153153
Instances.Iterator.Element == BaseCollection.Index {
154154

155155
checkForwardIndex(instances, of: baseCollection,
@@ -185,7 +185,7 @@ public func checkRandomAccessIndex<Instances, Distances, BaseCollection>(
185185
) where
186186
Instances : Collection,
187187
Distances : Collection,
188-
BaseCollection : _RandomAccessIndexable,
188+
BaseCollection : RandomAccessCollection,
189189
Instances.Iterator.Element == BaseCollection.Index,
190190
Distances.Iterator.Element == BaseCollection.IndexDistance {
191191

@@ -214,7 +214,7 @@ public func checkAdvancesAndDistances<Instances, Distances, BaseCollection>(
214214
) where
215215
Instances : Collection,
216216
Distances : Collection,
217-
BaseCollection : _Indexable,
217+
BaseCollection : Collection,
218218
Instances.Iterator.Element == BaseCollection.Index,
219219
Distances.Iterator.Element == BaseCollection.IndexDistance {
220220

stdlib/public/SDK/Foundation/IndexSet.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ public struct IndexSet : ReferenceConvertible, Equatable, BidirectionalCollectio
371371
public func intersects(integersIn range: CountableClosedRange<Element>) -> Bool { return self.intersects(integersIn: Range(range)) }
372372

373373
// MARK: -
374-
// Indexable
374+
// Collection
375375

376376
public func index(after i: Index) -> Index {
377377
if i.value + 1 == i.extent.upperBound {

stdlib/public/core/UnsafeBufferPointer.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public struct UnsafeBufferPointerIterator<Element>
5959
/// referenced memory and into the new collection.
6060
@_fixed_layout
6161
public struct Unsafe${Mutable}BufferPointer<Element>
62-
: _${Mutable}Indexable, ${Mutable}Collection, RandomAccessCollection {
62+
: ${Mutable}Collection, RandomAccessCollection {
6363
// FIXME: rdar://18157434 - until this is fixed, this has to be fixed layout
6464
// to avoid a hang in Foundation, which has the following setup:
6565
// struct A { struct B { let x: UnsafeMutableBufferPointer<...> } let b: B }

0 commit comments

Comments
 (0)