mirror of
https://github.com/apple/swift-collections
synced 2026-11-28 05:04:21 +00:00
Disambiguate ContainersPreview and stdlib
Adds trailing underscores to the BorrowingSequence protocols and requirements, in order to allow both parallel conformances and the ability to evolve the requirements in this package.
This commit is contained in:
1 parent
4c04822689
commit
a99a015934
49 files changed
+350
-363
No files matched your search
@@ -63,7 +63,7 @@ target_sources(${module_name} PRIVATE
|
||||
"HashTable/_HTable+Resizing.swift"
|
||||
"HashTable/_HTable+Sizing.swift"
|
||||
"RigidSet/RigidSet.swift"
|
||||
"RigidSet/RigidSet+BorrowingSequence.swift"
|
||||
"RigidSet/RigidSet+BorrowingSequence_.swift"
|
||||
"RigidSet/RigidSet+Consumption.swift"
|
||||
"RigidSet/RigidSet+Debugging.swift"
|
||||
"RigidSet/RigidSet+Equatable.swift"
|
||||
@@ -75,7 +75,7 @@ target_sources(${module_name} PRIVATE
|
||||
"RigidSet/RigidSet+Removals.swift"
|
||||
"RigidSet/RigidSet+Resizing.swift"
|
||||
"UniqueSet/UniqueSet.swift"
|
||||
"UniqueSet/UniqueSet+BorrowingSequence.swift"
|
||||
"UniqueSet/UniqueSet+BorrowingSequence_.swift"
|
||||
"UniqueSet/UniqueSet+Consumption.swift"
|
||||
"UniqueSet/UniqueSet+Debugging.swift"
|
||||
"UniqueSet/UniqueSet+Equatable.swift"
|
||||
|
||||
@@ -350,7 +350,7 @@ extension RigidArray {
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@inlinable
|
||||
internal mutating func _append<
|
||||
Source: BorrowingSequence<Element> & ~Copyable & ~Escapable
|
||||
Source: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying newElements: borrowing Source
|
||||
) {
|
||||
@@ -373,7 +373,7 @@ extension RigidArray {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func append<
|
||||
Source: BorrowingSequence<Element> & ~Copyable & ~Escapable
|
||||
Source: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying newElements: borrowing Source
|
||||
) {
|
||||
@@ -416,7 +416,7 @@ extension RigidArray {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func append<
|
||||
Source: BorrowingSequence<Element> & Sequence<Element>
|
||||
Source: BorrowingSequence_<Element> & Sequence<Element>
|
||||
>(copying newElements: Source) {
|
||||
_append(copying: newElements)
|
||||
}
|
||||
|
||||
@@ -20,11 +20,11 @@ import ContainersPreview
|
||||
|
||||
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
extension RigidArray: BorrowingSequence where Element: ~Copyable {
|
||||
public typealias BorrowingIterator = SpanIterator<Element>
|
||||
extension RigidArray: BorrowingSequence_ where Element: ~Copyable {
|
||||
public typealias BorrowingIterator_ = SpanIterator<Element>
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public func makeBorrowingIterator() -> BorrowingIterator {
|
||||
public func makeBorrowingIterator_() -> BorrowingIterator_ {
|
||||
SpanIterator(self.span)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ extension RigidArray /*where Element: Copyable*/ {
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<Source: BorrowingSequence<Element> & ~Copyable & ~Escapable>(
|
||||
public init<Source: BorrowingSequence_<Element> & ~Copyable & ~Escapable>(
|
||||
capacity: Int,
|
||||
copying contents: borrowing Source
|
||||
) {
|
||||
@@ -147,7 +147,7 @@ extension RigidArray /*where Element: Copyable*/ {
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<Source: BorrowingSequence<Element> & Sequence<Element>>(
|
||||
public init<Source: BorrowingSequence_<Element> & Sequence<Element>>(
|
||||
capacity: Int,
|
||||
copying contents: Source
|
||||
) {
|
||||
|
||||
@@ -416,15 +416,15 @@ extension RigidArray {
|
||||
copying items: borrowing C,
|
||||
newCount: Int
|
||||
) {
|
||||
var it = items.makeBorrowingIterator()
|
||||
var it = items.makeBorrowingIterator_()
|
||||
insert(addingCount: newCount, at: index) { target in
|
||||
while !target.isFull {
|
||||
let source = it.nextSpan(maximumCount: target.freeCapacity)
|
||||
let source = it.nextSpan_(maximumCount: target.freeCapacity)
|
||||
precondition(!source.isEmpty, "Broken container: mismatching count")
|
||||
target._append(copying: source)
|
||||
}
|
||||
}
|
||||
precondition(it.nextSpan().isEmpty, "Broken container: mismatching count")
|
||||
precondition(it.nextSpan_().isEmpty, "Broken container: mismatching count")
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -591,17 +591,17 @@ extension RigidArray {
|
||||
copyingContainer items: borrowing C,
|
||||
newCount: Int
|
||||
) {
|
||||
var it = items.makeBorrowingIterator()
|
||||
var it = items.makeBorrowingIterator_()
|
||||
self.replace(removing: subrange, addingCount: newCount) { target in
|
||||
while !target.isFull {
|
||||
let source = it.nextSpan(maximumCount: target.freeCapacity)
|
||||
let source = it.nextSpan_(maximumCount: target.freeCapacity)
|
||||
precondition(
|
||||
!source.isEmpty,
|
||||
"Broken Container: count doesn't match contents")
|
||||
target._append(copying: source)
|
||||
}
|
||||
precondition(
|
||||
it.nextSpan().isEmpty,
|
||||
it.nextSpan_().isEmpty,
|
||||
"Broken Container: count doesn't match contents")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ extension RigidDictionary where Key: ~Copyable, Value: ~Copyable {
|
||||
}
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension RigidDictionary.Indices: BorrowingSequence
|
||||
extension RigidDictionary.Indices: BorrowingSequence_
|
||||
where Key: ~Copyable, Value: ~Copyable
|
||||
{
|
||||
public typealias Element = RigidDictionary.Index
|
||||
|
||||
@@ -18,12 +18,12 @@ import ContainersPreview
|
||||
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_HASHED_CONTAINERS && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidSet: BorrowingSequence where Element: ~Copyable {
|
||||
extension RigidSet: BorrowingSequence_ where Element: ~Copyable {
|
||||
@inlinable
|
||||
public var underestimatedCount: Int { count }
|
||||
|
||||
@inlinable
|
||||
public func _customContainsEquatableElement(
|
||||
public func _customContainsEquatableElement_(
|
||||
_ element: borrowing Element
|
||||
) -> Bool? {
|
||||
self.contains(element)
|
||||
|
||||
@@ -86,7 +86,7 @@ extension RigidSet /* where Element: Copyable */ {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<
|
||||
S: BorrowingSequence<Element> & ~Copyable & ~Escapable
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
capacity: Int,
|
||||
copying contents: borrowing S
|
||||
@@ -121,7 +121,7 @@ extension RigidSet /* where Element: Copyable */ {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<
|
||||
S: BorrowingSequence<Element> & Sequence<Element>
|
||||
S: BorrowingSequence_<Element> & Sequence<Element>
|
||||
>(
|
||||
capacity: Int,
|
||||
copying contents: borrowing S
|
||||
@@ -134,7 +134,7 @@ extension RigidSet /* where Element: Copyable */ {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<
|
||||
S: BorrowingSequence<Element> & Collection<Element>
|
||||
S: BorrowingSequence_<Element> & Collection<Element>
|
||||
>(
|
||||
capacity: Int? = nil,
|
||||
copying contents: S
|
||||
|
||||
@@ -224,7 +224,7 @@ extension RigidSet /* where Element: Copyable */ {
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@_alwaysEmitIntoClient
|
||||
package mutating func _insert<
|
||||
S: BorrowingSequence<Element> & ~Copyable & ~Escapable
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
@@ -242,7 +242,7 @@ extension RigidSet /* where Element: Copyable */ {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func insert<
|
||||
S: BorrowingSequence<Element> & ~Copyable & ~Escapable
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
@@ -264,7 +264,7 @@ extension RigidSet /* where Element: Copyable */ {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func insert<
|
||||
S: BorrowingSequence<Element> & Sequence<Element>
|
||||
S: BorrowingSequence_<Element> & Sequence<Element>
|
||||
>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
|
||||
@@ -311,14 +311,14 @@ extension UniqueArray {
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@inlinable
|
||||
internal mutating func _append<
|
||||
Source: BorrowingSequence<Element> & ~Copyable & ~Escapable
|
||||
Source: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying newElements: borrowing Source
|
||||
) {
|
||||
_ensureFreeCapacity(newElements.underestimatedCount)
|
||||
var it = newElements.makeBorrowingIterator()
|
||||
_ensureFreeCapacity(newElements.underestimatedCount_)
|
||||
var it = newElements.makeBorrowingIterator_()
|
||||
while true {
|
||||
let span = it.nextSpan()
|
||||
let span = it.nextSpan_()
|
||||
if span.isEmpty { break }
|
||||
_ensureFreeCapacity(span.count)
|
||||
_storage.append(copying: span)
|
||||
@@ -345,7 +345,7 @@ extension UniqueArray {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func append<
|
||||
Source: BorrowingSequence<Element> & ~Copyable & ~Escapable
|
||||
Source: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying newElements: borrowing Source
|
||||
) {
|
||||
@@ -400,7 +400,7 @@ extension UniqueArray {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func append<
|
||||
Source: BorrowingSequence<Element> & Sequence<Element>
|
||||
Source: BorrowingSequence_<Element> & Sequence<Element>
|
||||
>(copying newElements: Source) {
|
||||
self._append(copying: newElements)
|
||||
}
|
||||
|
||||
@@ -20,16 +20,16 @@ import ContainersPreview
|
||||
|
||||
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
extension UniqueArray: BorrowingSequence where Element: ~Copyable {
|
||||
public typealias BorrowingIterator = RigidArray<Element>.BorrowingIterator
|
||||
extension UniqueArray: BorrowingSequence_ where Element: ~Copyable {
|
||||
public typealias BorrowingIterator_ = RigidArray<Element>.BorrowingIterator_
|
||||
|
||||
@inlinable
|
||||
public var underestimatedCount: Int { count }
|
||||
public var underestimatedCount_: Int { count }
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public func makeBorrowingIterator() -> BorrowingIterator {
|
||||
self._storage.makeBorrowingIterator()
|
||||
public func makeBorrowingIterator_() -> BorrowingIterator_ {
|
||||
self._storage.makeBorrowingIterator_()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -105,7 +105,7 @@ extension UniqueArray /*where Element: Copyable*/ {
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<Source: BorrowingSequence<Element> & ~Copyable & ~Escapable>(
|
||||
public init<Source: BorrowingSequence_<Element> & ~Copyable & ~Escapable>(
|
||||
capacity: Int? = nil,
|
||||
copying contents: borrowing Source
|
||||
) {
|
||||
@@ -142,7 +142,7 @@ extension UniqueArray /*where Element: Copyable*/ {
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<Source: BorrowingSequence<Element> & Sequence<Element>>(
|
||||
public init<Source: BorrowingSequence_<Element> & Sequence<Element>>(
|
||||
capacity: Int? = nil,
|
||||
copying contents: Source
|
||||
) {
|
||||
|
||||
@@ -19,14 +19,14 @@ import ContainersPreview
|
||||
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_HASHED_CONTAINERS && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueSet: BorrowingSequence where Element: ~Copyable {
|
||||
extension UniqueSet: BorrowingSequence_ where Element: ~Copyable {
|
||||
public typealias BorrowingIterator = RigidSet<Element>.BorrowingIterator
|
||||
|
||||
@inlinable
|
||||
public var underestimatedCount: Int { count }
|
||||
|
||||
@inlinable
|
||||
public func _customContainsEquatableElement(
|
||||
public func _customContainsEquatableElement_(
|
||||
_ element: borrowing Element
|
||||
) -> Bool? {
|
||||
self.contains(element)
|
||||
|
||||
@@ -78,7 +78,7 @@ extension UniqueSet where Element: Copyable {
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@_alwaysEmitIntoClient
|
||||
public init<
|
||||
S: BorrowingSequence<Element> & ~Copyable & ~Escapable
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
@@ -97,7 +97,7 @@ extension UniqueSet where Element: Copyable {
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@_alwaysEmitIntoClient
|
||||
public init<
|
||||
S: BorrowingSequence<Element> & Sequence<Element>
|
||||
S: BorrowingSequence_<Element> & Sequence<Element>
|
||||
>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
|
||||
@@ -133,7 +133,7 @@ extension UniqueSet /* where Element: Copyable */ {
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@_alwaysEmitIntoClient
|
||||
package mutating func _insert<
|
||||
S: BorrowingSequence<Element> & ~Copyable & ~Escapable
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
@@ -152,7 +152,7 @@ extension UniqueSet /* where Element: Copyable */ {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func insert<
|
||||
S: BorrowingSequence<Element> & ~Copyable & ~Escapable
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
@@ -175,7 +175,7 @@ extension UniqueSet /* where Element: Copyable */ {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func insert<
|
||||
S: BorrowingSequence<Element> & Sequence<Element>
|
||||
S: BorrowingSequence_<Element> & Sequence<Element>
|
||||
>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
|
||||
Reference in new issue
Block a user