Skip to content

Commit 444aaf2

Browse files
author
Dave Abrahams
committed
[stdlib] Declare conformance of Random-Access Collections
Some of these collections were still only declared to conform to Collection.
1 parent 98b3bf8 commit 444aaf2

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

stdlib/public/core/Character.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public struct Character :
136136
return UInt64(Builtin.zext_Int63_Int64(value)) | (1<<63)
137137
}
138138

139-
internal struct _SmallUTF8 : Collection {
139+
internal struct _SmallUTF8 : RandomAccessCollection {
140140
init(_ u8: UInt64) {
141141
let utf8Count = Character._smallSize(u8)
142142
_sanityCheck(utf8Count <= 8, "Character with more than 8 UTF-8 code units")
@@ -198,7 +198,7 @@ public struct Character :
198198
var data: UInt64
199199
}
200200

201-
struct _SmallUTF16 : Collection {
201+
struct _SmallUTF16 : RandomAccessCollection {
202202
init(_ u8: UInt64) {
203203
let count = UTF16.transcodedLength(
204204
of: _SmallUTF8(u8).makeIterator(),

stdlib/public/core/CocoaArray.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import SwiftShims
2525
/// `Collection` conformance. Why not make
2626
/// `_NSArrayCore` conform directly? It's a class, and I
2727
/// don't want to pay for the dynamic dispatch overhead.
28-
internal struct _CocoaArrayWrapper : Collection {
28+
internal struct _CocoaArrayWrapper : RandomAccessCollection {
2929
var startIndex: Int {
3030
return 0
3131
}

stdlib/public/core/Mirror.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ internal extension Mirror {
525525
/// appropriate for random access! To avoid this pitfall, convert
526526
/// mirrors to use the new style, which only present forward
527527
/// traversal in general.
528-
internal struct LegacyChildren : Collection {
528+
internal struct LegacyChildren : RandomAccessCollection {
529529
init(_ oldMirror: _Mirror) {
530530
self._oldMirror = oldMirror
531531
}

0 commit comments

Comments
 (0)