Skip to content

Commit ae9f5e3

Browse files
committed
[Foundation] handle ambiguity in swift 4 mode for Data.init with byte sequences
1 parent 5e7da0e commit ae9f5e3

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
@@ -1248,11 +1248,22 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
12481248
self.init(backing: backing, range: 0..<backing._length)
12491249
}
12501250

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

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

0 commit comments

Comments
 (0)