Skip to content

Commit b46d170

Browse files
committed
[Foundation] handle ambiguity in swift 4 mode for Data.init with byte sequences
1 parent 44a88d4 commit b46d170

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

stdlib/public/SDK/Foundation/Data.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,11 +1249,22 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
12491249
self.init(backing: backing, range: 0..<backing._length)
12501250
}
12511251

1252+
@available(swift, introduced: 4.2)
12521253
@inlinable
12531254
public init<S: Sequence>(bytes elements: S) where S.Iterator.Element == UInt8 {
12541255
self.init(elements)
12551256
}
12561257

1258+
@available(swift, obsoleted: 4.2)
1259+
public init(bytes: Array<UInt8>) {
1260+
self.init(bytes)
1261+
}
1262+
1263+
@available(swift, obsoleted: 4.2)
1264+
public init(bytes: ArraySlice<UInt8>) {
1265+
self.init(bytes)
1266+
}
1267+
12571268
@usableFromInline
12581269
internal init(backing: _DataStorage, range: Range<Index>) {
12591270
_backing = backing

0 commit comments

Comments
 (0)