From ff695132eda9ef3453cb4e911d71b7de78197a2a Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Tue, 7 Jul 2026 14:10:26 -0700 Subject: [PATCH] Bump availability of Iterable_ and Container protocols to SwiftStdlib 6.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is preparing for switching over to the stdlib’s definition of `protocol Iterable`, assuming it will land with macOS 27/iOS 27 etc availability; `Container` is refining `Iterable`, so it needs matching availability. If `Iterable` won’t ship in Swift 6.4, then we’ll need to bump this again. --- .../RigidArray/RigidArray+Append.swift | 3 + .../RigidArray/RigidArray+Container.swift | 14 +- .../RigidArray/RigidArray+Initializers.swift | 2 + .../RigidArray/RigidArray+Insertions.swift | 7 +- .../RigidArray/RigidArray+Removals.swift | 2 - .../RigidArray/RigidArray+Replacements.swift | 3 + .../RigidSet/RigidSet+Initializers.swift | 3 + .../RigidSet/RigidSet+Insertions.swift | 3 + .../UniqueArray/UniqueArray+Append.swift | 3 + .../UniqueArray/UniqueArray+Container.swift | 16 +- .../UniqueArray+Initializers.swift | 2 + .../UniqueArray/UniqueArray+Removals.swift | 2 - .../UniqueArray+Replacements.swift | 2 + .../UniqueSet/UniqueSet+Initializers.swift | 2 + .../UniqueSet/UniqueSet+Insertions.swift | 3 + Sources/ContainersPreview/CMakeLists.txt | 10 +- .../Conformances/Array+Iterable.swift | 31 +++ .../Conformances/ClosedRange+Iterable.swift | 69 ++++++ .../Conformances/InlineArray+Iterable.swift | 31 +++ .../Conformances/InputSpan+Container.swift | 2 +- .../Conformances/InputSpan+Iterable.swift | 30 +++ .../Conformances/MutableSpan+Container.swift | 12 +- .../Conformances/MutableSpan+Iterable.swift | 35 +++ .../Conformances/OutputSpan+Container.swift | 2 +- .../Conformances/OutputSpan+Iterable.swift | 31 +++ .../Conformances/Range+Iterable.swift | 68 ++++++ .../Conformances/Span+Container.swift | 7 +- .../Conformances/Span+Iterable.swift | 79 +++++++ ...rowingIteratorProtocol+ElementsEqual.swift | 8 +- .../Container/BidirectionalContainer.swift | 4 +- .../Container/Container+SpanwiseZip.swift | 2 +- .../Protocols/Container/Container.swift | 8 +- .../Container/DynamicContainer.swift | 6 +- .../Container/MutableContainer.swift | 4 +- .../Container/PermutableContainer.swift | 2 +- .../Container/RandomAccessContainer.swift | 8 +- .../Container/RangeExpression2.swift | 12 +- .../Container/RangeReplaceableContainer.swift | 22 +- .../Protocols/Iterable+Algorithms.swift | 8 +- .../Iterable+Standard Conformances.swift | 223 ------------------ .../Protocols/Iterable+Utilities.swift | 2 +- .../Protocols/Iterable.swift | 12 +- .../Protocols/Producer+Collect.swift | 3 + .../Types/SpanIterator.swift | 61 ----- .../RigidDeque/RigidDeque+Append.swift | 3 + .../RigidDeque/RigidDeque+Equatable.swift | 7 +- .../RigidDeque/RigidDeque+Initializers.swift | 5 + .../RigidDeque/RigidDeque+Insertions.swift | 3 + .../RigidDeque/RigidDeque+Prepend.swift | 8 + .../RigidDeque/RigidDeque+Removals.swift | 4 +- .../RigidDeque/RigidDeque+Replacements.swift | 3 + .../UniqueDeque/UniqueDeque+Append.swift | 3 + .../UniqueDeque+Initializers.swift | 3 + .../UniqueDeque/UniqueDeque+Insertions.swift | 3 + .../UniqueDeque/UniqueDeque+Prepend.swift | 8 + .../UniqueDeque/UniqueDeque+Removals.swift | 4 +- .../UniqueDeque+Replacements.swift | 3 + .../RigidArrayTests.swift | 6 +- .../UniqueArrayTests.swift | 4 +- .../BorrowingSequenceTests.swift | 4 +- Tests/DequeTests/RigidDequeTests.swift | 28 ++- Tests/DequeTests/UniqueDequeTests.swift | 24 +- .../Assertions+Containers.swift | 12 +- .../ConformanceCheckers/CheckContainer.swift | 4 +- .../MinimalTypes/StaccatoContainer.swift | 25 +- Xcode/Collections.xcodeproj/project.pbxproj | 40 +++- 66 files changed, 645 insertions(+), 418 deletions(-) create mode 100644 Sources/ContainersPreview/Conformances/Array+Iterable.swift create mode 100644 Sources/ContainersPreview/Conformances/ClosedRange+Iterable.swift create mode 100644 Sources/ContainersPreview/Conformances/InlineArray+Iterable.swift create mode 100644 Sources/ContainersPreview/Conformances/InputSpan+Iterable.swift create mode 100644 Sources/ContainersPreview/Conformances/MutableSpan+Iterable.swift create mode 100644 Sources/ContainersPreview/Conformances/OutputSpan+Iterable.swift create mode 100644 Sources/ContainersPreview/Conformances/Range+Iterable.swift create mode 100644 Sources/ContainersPreview/Conformances/Span+Iterable.swift delete mode 100644 Sources/ContainersPreview/Protocols/Iterable+Standard Conformances.swift delete mode 100644 Sources/ContainersPreview/Types/SpanIterator.swift diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Append.swift b/Sources/BasicContainers/RigidArray/RigidArray+Append.swift index e1a78649..f0df517b 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Append.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Append.swift @@ -253,6 +253,7 @@ extension RigidArray { } #if compiler(>=6.4) && UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @inlinable internal mutating func _append< Source: Iterable_ & ~Copyable & ~Escapable @@ -275,6 +276,7 @@ extension RigidArray { /// - newElements: A container whose contents to copy into the array. /// /// - Complexity: O(`newElements.count`) + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public mutating func append< @@ -318,6 +320,7 @@ extension RigidArray { /// - newElements: The new elements to copy into the array. /// /// - Complexity: O(*m*), where *m* is the length of `newElements`. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public mutating func append< diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Container.swift b/Sources/BasicContainers/RigidArray/RigidArray+Container.swift index 4b6c7167..6aa3b7e4 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Container.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Container.swift @@ -19,9 +19,9 @@ import ContainersPreview #if compiler(>=6.2) #if compiler(>=6.4) && UnstableContainersPreview -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension RigidArray: Iterable_ where Element: ~Copyable { - public typealias BorrowingIterator_ = SpanIterator + public typealias BorrowingIterator_ = Span.BorrowingIterator_ @_alwaysEmitIntoClient @inline(__always) @@ -35,7 +35,7 @@ extension RigidArray: Iterable_ where Element: ~Copyable { #endif #if compiler(>=6.4) && UnstableContainersPreview -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension RigidArray: Container where Element: ~Copyable { @_alwaysEmitIntoClient @_lifetime(borrow self) @@ -57,17 +57,17 @@ extension RigidArray: Container where Element: ~Copyable { } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension RigidArray: BidirectionalContainer where Element: ~Copyable {} -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension RigidArray: RandomAccessContainer where Element: ~Copyable {} #if compiler(>=6.4) -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension RigidArray: MutableContainer where Element: ~Copyable {} -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension RigidArray: RangeReplaceableContainer where Element: ~Copyable {} #endif #endif diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Initializers.swift b/Sources/BasicContainers/RigidArray/RigidArray+Initializers.swift index 62976415..c06037db 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Initializers.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Initializers.swift @@ -122,6 +122,7 @@ extension RigidArray /*where Element: Copyable*/ { /// just enough capacity to store the contents. /// - contents: The container whose contents to copy into the new array. /// The container must not contain more than `capacity` elements. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public init( @@ -144,6 +145,7 @@ extension RigidArray /*where Element: Copyable*/ { /// just enough capacity to store the contents. /// - contents: The container whose contents to copy into the new array. /// The container must not contain more than `capacity` elements. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public init>( diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Insertions.swift b/Sources/BasicContainers/RigidArray/RigidArray+Insertions.swift index 980a0460..80599107 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Insertions.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Insertions.swift @@ -330,13 +330,14 @@ extension RigidArray { } } -#if !UnstableContainersPreview @_alwaysEmitIntoClient package mutating func _insertCollection( addingCount newCount: Int, copying items: some Collection, at index: Index ) { + // FIXME: Remove this -- RangeReplaceContainer already has this algorithm, + // albeit with stricter availability. let done: Void? = items.withContiguousStorageIfAvailable { buffer in precondition(buffer.count == newCount, "Broken Collection: mismatching count") self.insert(addingCount: buffer.count, at: index) { target in @@ -353,7 +354,6 @@ extension RigidArray { } precondition(it.next() == nil, "Broken Collection") } -#endif /// Copies the elements of a collection into this array at the specified /// position. @@ -379,9 +379,6 @@ extension RigidArray { public mutating func insert( copying items: some Collection, at index: Int ) { - // FIXME: Remove this -- RangeReplaceContainer already has this algorithm. - // (Note that this would be source breaking while RRC lives in the separate - // ContainersPreview module.) _insertCollection(addingCount: items.count, copying: items, at: index) } } diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Removals.swift b/Sources/BasicContainers/RigidArray/RigidArray+Removals.swift index 1d502fe6..1b41f517 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Removals.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Removals.swift @@ -121,7 +121,6 @@ extension RigidArray where Element: ~Copyable { @available(SwiftStdlib 5.0, *) extension RigidArray where Element: ~Copyable { -#if !UnstableContainersPreview /// Removes and returns the last element of the array, if there is one. /// /// - Returns: The last element of the array if the array is not empty; @@ -134,7 +133,6 @@ extension RigidArray where Element: ~Copyable { if isEmpty { return nil } return removeLast() } -#endif } #endif diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Replacements.swift b/Sources/BasicContainers/RigidArray/RigidArray+Replacements.swift index ba99611c..b193c14e 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Replacements.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Replacements.swift @@ -583,6 +583,7 @@ extension RigidArray { } #if compiler(>=6.4) && UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @inlinable internal mutating func _replace< C: Container & ~Copyable & ~Escapable @@ -661,6 +662,7 @@ extension RigidArray { /// - newElements: The new elements to copy into the collection. /// /// - Complexity: O(`self.count` + `newElements.count`) + @available(SwiftStdlib 6.4, *) @inlinable @inline(__always) public mutating func replace< @@ -742,6 +744,7 @@ extension RigidArray { /// /// - Complexity: O(*n* + *m*), where *n* is count of this array and /// *m* is the count of `newElements`. + @available(SwiftStdlib 6.4, *) @inlinable @inline(__always) public mutating func replace< diff --git a/Sources/BasicContainers/RigidSet/RigidSet+Initializers.swift b/Sources/BasicContainers/RigidSet/RigidSet+Initializers.swift index d7bc1cf8..4bb4f0dd 100644 --- a/Sources/BasicContainers/RigidSet/RigidSet+Initializers.swift +++ b/Sources/BasicContainers/RigidSet/RigidSet+Initializers.swift @@ -82,6 +82,7 @@ extension RigidSet where Element: ~Copyable { @available(SwiftStdlib 5.0, *) extension RigidSet /* where Element: Copyable */ { #if UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public init< @@ -117,6 +118,7 @@ extension RigidSet /* where Element: Copyable */ { } #if UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public init< @@ -130,6 +132,7 @@ extension RigidSet /* where Element: Copyable */ { try self._insert(copying: contents) } + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public init< diff --git a/Sources/BasicContainers/RigidSet/RigidSet+Insertions.swift b/Sources/BasicContainers/RigidSet/RigidSet+Insertions.swift index 0f64bdc7..1415bfd9 100644 --- a/Sources/BasicContainers/RigidSet/RigidSet+Insertions.swift +++ b/Sources/BasicContainers/RigidSet/RigidSet+Insertions.swift @@ -235,6 +235,7 @@ extension RigidSet /* where Element: Copyable */ { } #if UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient package mutating func _insert< S: Iterable_ & ~Copyable & ~Escapable @@ -252,6 +253,7 @@ extension RigidSet /* where Element: Copyable */ { #endif #if UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public mutating func insert< @@ -274,6 +276,7 @@ extension RigidSet /* where Element: Copyable */ { } #if UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public mutating func insert< diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Append.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Append.swift index b80ed3bc..56027fe9 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Append.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Append.swift @@ -258,6 +258,7 @@ extension UniqueArray { } #if compiler(>=6.4) && UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @inlinable internal mutating func _append< Source: Iterable_ & ~Copyable & ~Escapable @@ -291,6 +292,7 @@ extension UniqueArray { /// /// - Complexity: O(`newElements.count`), when amortized over many invocations /// over the same array. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public mutating func append< @@ -346,6 +348,7 @@ extension UniqueArray { /// /// - Complexity: O(`newElements.count`), when amortized over many invocations /// over the same array. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public mutating func append< diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Container.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Container.swift index 6d158025..03a596c4 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Container.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Container.swift @@ -19,9 +19,9 @@ import ContainersPreview #if compiler(>=6.2) #if compiler(>=6.4) && UnstableContainersPreview -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension UniqueArray: Iterable_ where Element: ~Copyable { - public typealias BorrowingIterator_ = RigidArray.BorrowingIterator_ + public typealias BorrowingIterator_ = Span.BorrowingIterator_ @inlinable public var underestimatedCount_: Int { count } @@ -35,7 +35,7 @@ extension UniqueArray: Iterable_ where Element: ~Copyable { #endif #if compiler(>=6.4) && UnstableContainersPreview -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension UniqueArray: Container where Element: ~Copyable { @_alwaysEmitIntoClient @_lifetime(borrow self) @@ -51,20 +51,20 @@ extension UniqueArray: Container where Element: ~Copyable { } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension UniqueArray: BidirectionalContainer where Element: ~Copyable {} -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension UniqueArray: RandomAccessContainer where Element: ~Copyable {} -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension UniqueArray: MutableContainer where Element: ~Copyable {} #if compiler(>=6.4) -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension UniqueArray: RangeReplaceableContainer where Element: ~Copyable {} -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension UniqueArray: DynamicContainer where Element: ~Copyable {} #endif #endif diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Initializers.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Initializers.swift index 678933f1..ce4ce62a 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Initializers.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Initializers.swift @@ -94,6 +94,7 @@ extension UniqueArray /*where Element: Copyable*/ { /// just enough capacity to store the contents. /// - contents: A sequence whose contents to copy into the new array. /// The sequence must not contain more than `capacity` elements. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public init( @@ -131,6 +132,7 @@ extension UniqueArray /*where Element: Copyable*/ { /// - capacity: The storage capacity of the new array, or nil to allocate /// just enough capacity to store the contents. /// - contents: The container whose contents to copy into the new array. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public init>( diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Removals.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Removals.swift index 25b488e8..deaa5bc1 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Removals.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Removals.swift @@ -110,7 +110,6 @@ extension UniqueArray where Element: ~Copyable { @available(SwiftStdlib 5.0, *) extension UniqueArray where Element: ~Copyable { -#if !UnstableContainersPreview /// Removes and returns the last element of the array, if there is one. /// /// - Returns: The last element of the array if the array is not empty; @@ -123,7 +122,6 @@ extension UniqueArray where Element: ~Copyable { if isEmpty { return nil } return removeLast() } -#endif } #endif diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Replacements.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Replacements.swift index 816e5818..9c6603e9 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Replacements.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Replacements.swift @@ -551,6 +551,7 @@ extension UniqueArray { /// /// - Complexity: O(*n* + *m*), where *n* is count of this array and /// *m* is the count of `newElements`. + @available(SwiftStdlib 6.4, *) @inlinable @inline(__always) public mutating func replace< @@ -641,6 +642,7 @@ extension UniqueArray { /// /// - Complexity: O(*n* + *m*), where *n* is count of this array and /// *m* is the count of `newElements`. + @available(SwiftStdlib 6.4, *) @inlinable @inline(__always) public mutating func replace< diff --git a/Sources/BasicContainers/UniqueSet/UniqueSet+Initializers.swift b/Sources/BasicContainers/UniqueSet/UniqueSet+Initializers.swift index c6855e27..a4b65a36 100644 --- a/Sources/BasicContainers/UniqueSet/UniqueSet+Initializers.swift +++ b/Sources/BasicContainers/UniqueSet/UniqueSet+Initializers.swift @@ -75,6 +75,7 @@ extension UniqueSet where Element: ~Copyable { extension UniqueSet where Element: Copyable { #if UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient public init< S: Iterable_ & ~Copyable & ~Escapable @@ -94,6 +95,7 @@ extension UniqueSet where Element: Copyable { } #if UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient public init< S: Iterable_ & Sequence diff --git a/Sources/BasicContainers/UniqueSet/UniqueSet+Insertions.swift b/Sources/BasicContainers/UniqueSet/UniqueSet+Insertions.swift index 6686459b..ac095a70 100644 --- a/Sources/BasicContainers/UniqueSet/UniqueSet+Insertions.swift +++ b/Sources/BasicContainers/UniqueSet/UniqueSet+Insertions.swift @@ -131,6 +131,7 @@ extension UniqueSet /* where Element: Copyable */ { } #if UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient package mutating func _insert< S: Iterable_ & ~Copyable & ~Escapable @@ -149,6 +150,7 @@ extension UniqueSet /* where Element: Copyable */ { #endif #if UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public mutating func insert< @@ -171,6 +173,7 @@ extension UniqueSet /* where Element: Copyable */ { } #if UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public mutating func insert< diff --git a/Sources/ContainersPreview/CMakeLists.txt b/Sources/ContainersPreview/CMakeLists.txt index ece38517..7d85b8d3 100644 --- a/Sources/ContainersPreview/CMakeLists.txt +++ b/Sources/ContainersPreview/CMakeLists.txt @@ -25,10 +25,18 @@ else() endif() target_sources(${module_name} PRIVATE + "Conformances/Array+Iterable.swift" + "Conformances/ClosedRange+Iterable.swift" + "Conformances/InlineArray+Iterable.swift" "Conformances/InputSpan+Container.swift" + "Conformances/InputSpan+Iterable.swift" "Conformances/MutableSpan+Container.swift" + "Conformances/MutableSpan+Iterable.swift" "Conformances/OutputSpan+Container.swift" + "Conformances/OutputSpan+Iterable.swift" + "Conformances/Range+Iterable.swift" "Conformances/Span+Container.swift" + "Conformances/Span+Iterable.swift" "Protocols/Container/BidirectionalContainer.swift" "Protocols/Container/Container.swift" "Protocols/Container/Container+Filter.swift" @@ -51,7 +59,6 @@ target_sources(${module_name} PRIVATE "Protocols/BorrowingIteratorProtocol+SpanwiseZip.swift" "Protocols/Iterable.swift" "Protocols/Iterable+Algorithms.swift" - "Protocols/Iterable+Standard Conformances.swift" "Protocols/Iterable+Utilities.swift" "Protocols/CountedProducer.swift" "Protocols/Drain.swift" @@ -66,6 +73,5 @@ target_sources(${module_name} PRIVATE "Types/MutableRef.swift" "Types/OutputSpan+Helpers.swift" "Types/Shared.swift" - "Types/SpanIterator.swift" "Types/UniqueBox.swift" ) diff --git a/Sources/ContainersPreview/Conformances/Array+Iterable.swift b/Sources/ContainersPreview/Conformances/Array+Iterable.swift new file mode 100644 index 00000000..5d6f4b2b --- /dev/null +++ b/Sources/ContainersPreview/Conformances/Array+Iterable.swift @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift Collections open source project +// +// Copyright (c) 2026 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// +// SPDX-License-Identifier: Apache-2.0 WITH Swift-exception +// +//===----------------------------------------------------------------------===// + +#if compiler(>=6.4) && UnstableContainersPreview + +@available(SwiftStdlib 6.4, *) +extension Array: Iterable_ { + public typealias Element_ = Element + public typealias BorrowingIterator_ = Span.BorrowingIterator_ + + @inlinable + public var underestimatedCount_: Int { count } + + @_lifetime(borrow self) + @inlinable + public func makeBorrowingIterator_() -> BorrowingIterator_ { + BorrowingIterator_(self.span) + } +} + +#endif diff --git a/Sources/ContainersPreview/Conformances/ClosedRange+Iterable.swift b/Sources/ContainersPreview/Conformances/ClosedRange+Iterable.swift new file mode 100644 index 00000000..c4e199b2 --- /dev/null +++ b/Sources/ContainersPreview/Conformances/ClosedRange+Iterable.swift @@ -0,0 +1,69 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift Collections open source project +// +// Copyright (c) 2026 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// +// SPDX-License-Identifier: Apache-2.0 WITH Swift-exception +// +//===----------------------------------------------------------------------===// + +#if compiler(>=6.4) && UnstableContainersPreview + +@available(SwiftStdlib 6.2, *) +extension ClosedRange: Iterable_ +where Bound: Strideable, Bound.Stride: SignedInteger +{ + public typealias Element_ = Bound + + @frozen + public struct BorrowingIterator_: BorrowingIteratorProtocol_, ~Copyable { + @usableFromInline + internal var _current: InlineArray<1, Bound> + + @usableFromInline + internal var _last: Bound + + @usableFromInline + internal var _progress: Bool + + @inlinable + internal init(_ base: ClosedRange) { + self._current = .init(repeating: base.lowerBound) + self._last = base.upperBound + self._progress = false + } + @inlinable + @_lifetime(&self) + public mutating func nextSpan_(maxCount: Int) -> Span { + if _progress { + _current[0] = _current[0].advanced(by: 1) + } + guard _current[0] <= _last else { + _progress = false + return .init() + } + _progress = true + return _current.span + } + } + + @inlinable + public var underestimatedCount_: Int { + guard let distance = Int(exactly: lowerBound.distance(to: upperBound)) + else { return 0 } + let advanced = distance.addingReportingOverflow(1) + guard !advanced.overflow else { return 0 } + return advanced.partialValue + } + + @inlinable + public func makeBorrowingIterator_() -> BorrowingIterator_ { + BorrowingIterator_(self) + } +} + +#endif diff --git a/Sources/ContainersPreview/Conformances/InlineArray+Iterable.swift b/Sources/ContainersPreview/Conformances/InlineArray+Iterable.swift new file mode 100644 index 00000000..b503e97d --- /dev/null +++ b/Sources/ContainersPreview/Conformances/InlineArray+Iterable.swift @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift Collections open source project +// +// Copyright (c) 2026 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// +// SPDX-License-Identifier: Apache-2.0 WITH Swift-exception +// +//===----------------------------------------------------------------------===// + +#if compiler(>=6.4) && UnstableContainersPreview + +@available(SwiftStdlib 6.4, *) +extension InlineArray: Iterable_ where Element: ~Copyable { + public typealias Element_ = Element + public typealias BorrowingIterator_ = Span.BorrowingIterator_ + + @inlinable + public var underestimatedCount_: Int { count } + + @_lifetime(borrow self) + @inlinable + public func makeBorrowingIterator_() -> BorrowingIterator_ { + BorrowingIterator_(self.span) + } +} + +#endif diff --git a/Sources/ContainersPreview/Conformances/InputSpan+Container.swift b/Sources/ContainersPreview/Conformances/InputSpan+Container.swift index 24bd2cc4..d2b97f7f 100644 --- a/Sources/ContainersPreview/Conformances/InputSpan+Container.swift +++ b/Sources/ContainersPreview/Conformances/InputSpan+Container.swift @@ -17,7 +17,7 @@ import InternalCollectionsUtilities #if compiler(>=6.2) && UnstableContainersPreview -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension InputSpan: RandomAccessContainer, MutableContainer where Element: ~Copyable { diff --git a/Sources/ContainersPreview/Conformances/InputSpan+Iterable.swift b/Sources/ContainersPreview/Conformances/InputSpan+Iterable.swift new file mode 100644 index 00000000..98d1d49c --- /dev/null +++ b/Sources/ContainersPreview/Conformances/InputSpan+Iterable.swift @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift Collections open source project +// +// Copyright (c) 2026 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// +// SPDX-License-Identifier: Apache-2.0 WITH Swift-exception +// +//===----------------------------------------------------------------------===// + +#if compiler(>=6.4) && UnstableContainersPreview + +@available(SwiftStdlib 6.4, *) +extension InputSpan: Iterable_ where Element: ~Copyable { + public typealias BorrowingIterator_ = Span.BorrowingIterator_ + + @inlinable + public var underestimatedCount_: Int { count } + + @_lifetime(borrow self) + @inlinable + public func makeBorrowingIterator_() -> BorrowingIterator_ { + BorrowingIterator_(self.span) + } +} + +#endif diff --git a/Sources/ContainersPreview/Conformances/MutableSpan+Container.swift b/Sources/ContainersPreview/Conformances/MutableSpan+Container.swift index 52d2723c..c16a28c3 100644 --- a/Sources/ContainersPreview/Conformances/MutableSpan+Container.swift +++ b/Sources/ContainersPreview/Conformances/MutableSpan+Container.swift @@ -17,11 +17,14 @@ import InternalCollectionsUtilities #endif +@available(SwiftStdlib 6.4, *) extension MutableSpan: RandomAccessContainer where Element: ~Copyable { @_alwaysEmitIntoClient @_lifetime(borrow self) - public func makeBorrowingIterator(from start: Int) -> SpanIterator { - var it = SpanIterator(self.span) + public func makeBorrowingIterator( + from start: Int + ) -> BorrowingIterator_ { + var it = Span.BorrowingIterator_(self.span) var remainder = start while remainder > 0 { let d = it.skip_(by: remainder) @@ -32,7 +35,9 @@ extension MutableSpan: RandomAccessContainer where Element: ~Copyable { } @_alwaysEmitIntoClient - public func currentIndex(of iterator: borrowing SpanIterator) -> Int { + public func currentIndex( + of iterator: borrowing BorrowingIterator_ + ) -> Int { precondition( self.span.isTriviallyIdentical(to: iterator._span), "Invalid iterator") @@ -72,6 +77,7 @@ extension MutableSpan: RandomAccessContainer where Element: ~Copyable { } } +@available(SwiftStdlib 6.4, *) extension MutableSpan: MutableContainer where Element: ~Copyable { @_alwaysEmitIntoClient @_lifetime(&self) diff --git a/Sources/ContainersPreview/Conformances/MutableSpan+Iterable.swift b/Sources/ContainersPreview/Conformances/MutableSpan+Iterable.swift new file mode 100644 index 00000000..d736962f --- /dev/null +++ b/Sources/ContainersPreview/Conformances/MutableSpan+Iterable.swift @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift Collections open source project +// +// Copyright (c) 2026 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// +// SPDX-License-Identifier: Apache-2.0 WITH Swift-exception +// +//===----------------------------------------------------------------------===// + +#if compiler(>=6.4) && UnstableContainersPreview + +@available(SwiftStdlib 6.4, *) +extension MutableSpan: Iterable_ where Element: ~Copyable { + public typealias BorrowingIterator_ = Span.BorrowingIterator_ + public typealias Element_ = Element + + @inlinable + public var underestimatedCount_: Int { count } + + @_lifetime(borrow self) + @inlinable + public func makeBorrowingIterator_() -> BorrowingIterator_ { + // FIXME: This should be declared to return BorrowingIterator, but it + // clashes with the stdlib's alternate definition: + // error: 'BorrowingIterator' is ambiguous for type lookup in this context + // Two different typealiases with the same name wreaks havoc with inference? + BorrowingIterator_(self.span) + } +} + +#endif diff --git a/Sources/ContainersPreview/Conformances/OutputSpan+Container.swift b/Sources/ContainersPreview/Conformances/OutputSpan+Container.swift index 2368855b..ec0b2171 100644 --- a/Sources/ContainersPreview/Conformances/OutputSpan+Container.swift +++ b/Sources/ContainersPreview/Conformances/OutputSpan+Container.swift @@ -16,7 +16,7 @@ import InternalCollectionsUtilities #endif #if compiler(>=6.2) && UnstableContainersPreview -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension OutputSpan: RandomAccessContainer, MutableContainer where Element: ~Copyable { diff --git a/Sources/ContainersPreview/Conformances/OutputSpan+Iterable.swift b/Sources/ContainersPreview/Conformances/OutputSpan+Iterable.swift new file mode 100644 index 00000000..60f6f170 --- /dev/null +++ b/Sources/ContainersPreview/Conformances/OutputSpan+Iterable.swift @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift Collections open source project +// +// Copyright (c) 2026 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// +// SPDX-License-Identifier: Apache-2.0 WITH Swift-exception +// +//===----------------------------------------------------------------------===// + +#if compiler(>=6.4) && UnstableContainersPreview + +@available(SwiftStdlib 6.4, *) +extension OutputSpan: Iterable_ where Element: ~Copyable { + public typealias Element_ = Element + public typealias BorrowingIterator_ = Span.BorrowingIterator_ + + @inlinable + public var underestimatedCount_: Int { count } + + @_lifetime(borrow self) + @inlinable + public func makeBorrowingIterator_() -> BorrowingIterator_ { + BorrowingIterator_(self.span) + } +} + +#endif diff --git a/Sources/ContainersPreview/Conformances/Range+Iterable.swift b/Sources/ContainersPreview/Conformances/Range+Iterable.swift new file mode 100644 index 00000000..d44995dc --- /dev/null +++ b/Sources/ContainersPreview/Conformances/Range+Iterable.swift @@ -0,0 +1,68 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift Collections open source project +// +// Copyright (c) 2026 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// +// SPDX-License-Identifier: Apache-2.0 WITH Swift-exception +// +//===----------------------------------------------------------------------===// + +#if compiler(>=6.4) && UnstableContainersPreview + +@available(SwiftStdlib 6.4, *) +extension Range: Iterable_ +where Bound: Strideable, Bound.Stride: SignedInteger +{ + public typealias Element_ = Bound + + @frozen + public struct BorrowingIterator_: BorrowingIteratorProtocol_, ~Copyable { + @usableFromInline + internal var _current: InlineArray<1, Bound> + + @usableFromInline + internal var _end: Bound + + @usableFromInline + internal var _progress: Bool + + @inlinable + internal init(_ base: Range) { + self._current = .init(repeating: base.lowerBound) + self._end = base.upperBound + self._progress = false + } + @inlinable + @_lifetime(&self) + public mutating func nextSpan_(maxCount: Int) -> Span { + if _progress { + _current[0] = _current[0].advanced(by: 1) + } + guard _current[0] < _end else { + _progress = false + return .init() + } + _progress = true + return _current.span + } + } + + @inlinable + public var underestimatedCount_: Int { + guard let count = Int(exactly: lowerBound.distance(to: upperBound)) else { + return 0 + } + return count + } + + @inlinable + public func makeBorrowingIterator_() -> BorrowingIterator_ { + BorrowingIterator_(self) + } +} + +#endif diff --git a/Sources/ContainersPreview/Conformances/Span+Container.swift b/Sources/ContainersPreview/Conformances/Span+Container.swift index 9276491d..ab24c195 100644 --- a/Sources/ContainersPreview/Conformances/Span+Container.swift +++ b/Sources/ContainersPreview/Conformances/Span+Container.swift @@ -13,13 +13,14 @@ #if compiler(>=6.4) && UnstableContainersPreview +@available(SwiftStdlib 6.4, *) extension Span: RandomAccessContainer where Element: ~Copyable { @_alwaysEmitIntoClient @_lifetime(borrow self) - public func makeBorrowingIterator(from start: Int) -> SpanIterator { + public func makeBorrowingIterator(from start: Int) -> BorrowingIterator_ { precondition(start >= 0 && start <= self.count, "Index out of bounds") // FIXME: SpanIterator needs to have a direct initializer that takes `start` - var it = SpanIterator(self) + var it = BorrowingIterator_(self) var remainder = start while remainder > 0 { let d = it.skip_(by: remainder) @@ -30,7 +31,7 @@ extension Span: RandomAccessContainer where Element: ~Copyable { } @_alwaysEmitIntoClient - public func currentIndex(of iterator: borrowing SpanIterator) -> Int { + public func currentIndex(of iterator: borrowing BorrowingIterator_) -> Int { // FIXME: SpanIterator needs to have public `base` and `position` properties precondition( self.isTriviallyIdentical(to: iterator._span), diff --git a/Sources/ContainersPreview/Conformances/Span+Iterable.swift b/Sources/ContainersPreview/Conformances/Span+Iterable.swift new file mode 100644 index 00000000..c23f7911 --- /dev/null +++ b/Sources/ContainersPreview/Conformances/Span+Iterable.swift @@ -0,0 +1,79 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift Collections open source project +// +// Copyright (c) 2026 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// +// SPDX-License-Identifier: Apache-2.0 WITH Swift-exception +// +//===----------------------------------------------------------------------===// + +#if compiler(>=6.4) && UnstableContainersPreview + +@available(SwiftStdlib 6.4, *) +extension Span: Iterable_ where Element: ~Copyable { + public typealias Element_ = Element + + @inlinable + public var underestimatedCount_: Int { count } + + @inlinable + @_lifetime(borrow self) + public func makeBorrowingIterator_() -> BorrowingIterator_ { + BorrowingIterator_(self) + } +} + +@available(SwiftStdlib 5.0, *) +extension Span where Element: ~Copyable { + /// A borrowing iterator that provides access to the elements of a single + /// span through a `BorrowingIteratorProtocol` interface. + @available(SwiftStdlib 6.4, *) + public struct BorrowingIterator_: + BorrowingIteratorProtocol_, ~Copyable, ~Escapable + { + public typealias Element_ = Element + + @usableFromInline + internal var _span: Span + @usableFromInline + internal var _start: Int + @usableFromInline + internal var _count: Int + + @_lifetime(copy elements) + public init(_ elements: Span) { + _span = elements + _start = 0 + _count = elements.count + } + + @_alwaysEmitIntoClient + @_lifetime(&self) + @_lifetime(self: copy self) + @_transparent + public mutating func nextSpan_(maxCount: Int) -> Span { + let c = Swift.min(maxCount, _count) + defer { + _start &+= c + _count &-= c + } + return _span.extracting(droppingFirst: _start).extracting(first: c) + } + + @_alwaysEmitIntoClient + @_lifetime(self: copy self) + public mutating func skip_(by offset: Int) -> Int { + let c = Swift.min(offset, _count) + defer { + _start &+= c + _count &-= c + } + return c + } + } +} +#endif diff --git a/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+ElementsEqual.swift b/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+ElementsEqual.swift index c947c90a..d2f57623 100644 --- a/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+ElementsEqual.swift +++ b/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+ElementsEqual.swift @@ -17,7 +17,7 @@ import InternalCollectionsUtilities #if compiler(>=6.4) && UnstableContainersPreview -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension Iterable_ where Self: ~Copyable & ~Escapable, Element_: Equatable, @@ -37,7 +37,7 @@ where } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension Iterable_ where Self: ~Copyable & ~Escapable, @@ -79,7 +79,7 @@ where } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension BorrowingIteratorProtocol_ where Self: ~Copyable & ~Escapable, @@ -173,7 +173,7 @@ where } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension BorrowingIteratorProtocol_ where Self: ~Copyable & ~Escapable, diff --git a/Sources/ContainersPreview/Protocols/Container/BidirectionalContainer.swift b/Sources/ContainersPreview/Protocols/Container/BidirectionalContainer.swift index 6c1e3535..d141dea9 100644 --- a/Sources/ContainersPreview/Protocols/Container/BidirectionalContainer.swift +++ b/Sources/ContainersPreview/Protocols/Container/BidirectionalContainer.swift @@ -13,7 +13,7 @@ #if compiler(>=6.4) && UnstableContainersPreview -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) public protocol BidirectionalContainer: Container, ~Copyable, ~Escapable where Element: ~Copyable, Index: Comparable { @@ -66,7 +66,7 @@ where Element: ~Copyable, Index: Comparable } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension BidirectionalContainer where Self: ~Copyable & ~Escapable, Element: ~Copyable { @inlinable diff --git a/Sources/ContainersPreview/Protocols/Container/Container+SpanwiseZip.swift b/Sources/ContainersPreview/Protocols/Container/Container+SpanwiseZip.swift index 32e53ebd..e5e46726 100644 --- a/Sources/ContainersPreview/Protocols/Container/Container+SpanwiseZip.swift +++ b/Sources/ContainersPreview/Protocols/Container/Container+SpanwiseZip.swift @@ -17,7 +17,7 @@ import InternalCollectionsUtilities #if compiler(>=6.4) && UnstableContainersPreview -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension Container where Self: ~Copyable & ~Escapable, Element: ~Copyable { @_alwaysEmitIntoClient internal func _spanwiseZip( diff --git a/Sources/ContainersPreview/Protocols/Container/Container.swift b/Sources/ContainersPreview/Protocols/Container/Container.swift index ed7be60c..38a7b2bd 100644 --- a/Sources/ContainersPreview/Protocols/Container/Container.swift +++ b/Sources/ContainersPreview/Protocols/Container/Container.swift @@ -13,7 +13,7 @@ #if compiler(>=6.4) && UnstableContainersPreview -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) public protocol Container: Iterable_, ~Copyable, ~Escapable where Element: ~Copyable, Element == Element_, Failure_ == Never @@ -217,7 +217,7 @@ public protocol Container: func _customLastIndexOfEquatableElement(_ element: borrowing Element) -> Index?? } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension Container where Self: ~Copyable & ~Escapable, Element: ~Copyable { /// Return a span over the container's storage that begins with the element at /// the given index, and extends to the end of the contiguous storage chunk @@ -260,7 +260,7 @@ extension Container where Self: ~Copyable & ~Escapable, Element: ~Copyable { } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension Container where Self: ~Copyable & ~Escapable, Element: ~Copyable { @_alwaysEmitIntoClient public var isEmpty: Bool { @@ -422,7 +422,7 @@ extension Container where Self: ~Copyable & ~Escapable, Element: ~Copyable { } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension Container where Self: ~Copyable & ~Escapable, Element: ~Copyable { @_alwaysEmitIntoClient @_transparent diff --git a/Sources/ContainersPreview/Protocols/Container/DynamicContainer.swift b/Sources/ContainersPreview/Protocols/Container/DynamicContainer.swift index c2b5f6c1..08b2b425 100644 --- a/Sources/ContainersPreview/Protocols/Container/DynamicContainer.swift +++ b/Sources/ContainersPreview/Protocols/Container/DynamicContainer.swift @@ -13,7 +13,7 @@ #if compiler(>=6.4) && UnstableContainersPreview -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) public protocol DynamicContainer: RangeReplaceableContainer, ~Copyable where Element: ~Copyable { @@ -41,7 +41,7 @@ where Element: ~Copyable var freeCapacity: Int { get } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension DynamicContainer where Self: ~Copyable, Element: ~Copyable { @_alwaysEmitIntoClient public init() { @@ -104,7 +104,7 @@ extension DynamicContainer where Self: ~Copyable, Element: ~Copyable { } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension DynamicContainer where Self: ~Copyable, Element: Copyable { @_alwaysEmitIntoClient public init(repeating repeatedValue: Element, count: Int) { diff --git a/Sources/ContainersPreview/Protocols/Container/MutableContainer.swift b/Sources/ContainersPreview/Protocols/Container/MutableContainer.swift index c0000f95..2cc9b208 100644 --- a/Sources/ContainersPreview/Protocols/Container/MutableContainer.swift +++ b/Sources/ContainersPreview/Protocols/Container/MutableContainer.swift @@ -13,7 +13,7 @@ #if compiler(>=6.4) && UnstableContainersPreview -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) public protocol MutableContainer: PermutableContainer, ~Copyable, ~Escapable where @@ -97,7 +97,7 @@ where ) -> MutableSpan } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension MutableContainer where Self: ~Copyable & ~Escapable, Element: ~Copyable { diff --git a/Sources/ContainersPreview/Protocols/Container/PermutableContainer.swift b/Sources/ContainersPreview/Protocols/Container/PermutableContainer.swift index 8cfe7224..cf96d0e9 100644 --- a/Sources/ContainersPreview/Protocols/Container/PermutableContainer.swift +++ b/Sources/ContainersPreview/Protocols/Container/PermutableContainer.swift @@ -13,7 +13,7 @@ #if compiler(>=6.4) && UnstableContainersPreview -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) public protocol PermutableContainer: Container, ~Copyable, ~Escapable where Element: ~Copyable { diff --git a/Sources/ContainersPreview/Protocols/Container/RandomAccessContainer.swift b/Sources/ContainersPreview/Protocols/Container/RandomAccessContainer.swift index c77801ad..5443bb20 100644 --- a/Sources/ContainersPreview/Protocols/Container/RandomAccessContainer.swift +++ b/Sources/ContainersPreview/Protocols/Container/RandomAccessContainer.swift @@ -13,7 +13,7 @@ #if compiler(>=6.4) && UnstableContainersPreview -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) public protocol RandomAccessContainer : BidirectionalContainer, ~Copyable, ~Escapable where Element: ~Copyable { @@ -70,7 +70,7 @@ extension RandomAccessCollection { } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension RandomAccessContainer where Self: ~Copyable & ~Escapable, @@ -129,7 +129,7 @@ where } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension RandomAccessContainer where Self: ~Copyable & ~Escapable, @@ -198,7 +198,7 @@ where // Disambiguate parallel extensions on RandomAccessContainer and RandomAccessCollection -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension RandomAccessCollection where Self: RandomAccessContainer, diff --git a/Sources/ContainersPreview/Protocols/Container/RangeExpression2.swift b/Sources/ContainersPreview/Protocols/Container/RangeExpression2.swift index c847d61d..84c61e8d 100644 --- a/Sources/ContainersPreview/Protocols/Container/RangeExpression2.swift +++ b/Sources/ContainersPreview/Protocols/Container/RangeExpression2.swift @@ -15,7 +15,7 @@ // FIXME: Figure out if it would be possible to add the container-based // `relative(to:)` to the existing `RangeExpression`. -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) public protocol RangeExpression2: RangeExpression { override associatedtype Bound: Comparable @@ -26,7 +26,7 @@ public protocol RangeExpression2: RangeExpression { override func contains(_ element: Bound) -> Bool } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension Range: RangeExpression2 { @inlinable public func relative( @@ -36,7 +36,7 @@ extension Range: RangeExpression2 { } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension ClosedRange: RangeExpression2 { @inlinable public func relative( @@ -47,7 +47,7 @@ extension ClosedRange: RangeExpression2 { } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension PartialRangeFrom: RangeExpression2 { @inlinable public func relative( @@ -57,7 +57,7 @@ extension PartialRangeFrom: RangeExpression2 { } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension PartialRangeUpTo: RangeExpression2 { @inlinable public func relative( @@ -67,7 +67,7 @@ extension PartialRangeUpTo: RangeExpression2 { } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension PartialRangeThrough: RangeExpression2 { @inlinable public func relative( diff --git a/Sources/ContainersPreview/Protocols/Container/RangeReplaceableContainer.swift b/Sources/ContainersPreview/Protocols/Container/RangeReplaceableContainer.swift index 3b93a057..dd032b47 100644 --- a/Sources/ContainersPreview/Protocols/Container/RangeReplaceableContainer.swift +++ b/Sources/ContainersPreview/Protocols/Container/RangeReplaceableContainer.swift @@ -19,7 +19,7 @@ import InternalCollectionsUtilities //MARK: - Protocol Definition -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) public protocol RangeReplaceableContainer : Container, ~Copyable, ~Escapable where @@ -70,7 +70,7 @@ where //MARK: - Default Implementations -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension RangeReplaceableContainer where Self: ~Copyable & ~Escapable, Element: ~Copyable { @@ -170,7 +170,7 @@ where Self: ~Copyable & ~Escapable, Element: ~Copyable //MARK: - Standard Extensions -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension RangeReplaceableContainer where Self: ~Copyable & ~Escapable, Element: ~Copyable { @@ -291,7 +291,7 @@ where Self: ~Copyable & ~Escapable, Element: ~Copyable } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension RangeReplaceableContainer where Self: ~Copyable & ~Escapable, Element: ~Copyable { @_alwaysEmitIntoClient @@ -353,7 +353,7 @@ where Self: ~Copyable & ~Escapable, Element: ~Copyable { } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension RangeReplaceableContainer where Self: BidirectionalContainer, @@ -373,7 +373,7 @@ where } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension RangeReplaceableContainer where Self: ~Copyable & ~Escapable, Element: ~Copyable { @@ -397,7 +397,7 @@ where Self: ~Copyable & ~Escapable, Element: ~Copyable } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension RangeReplaceableContainer where Self: BidirectionalContainer & ~Copyable & ~Escapable, Element: ~Copyable { @@ -427,7 +427,7 @@ where Self: BidirectionalContainer & ~Copyable & ~Escapable, Element: ~Copyable } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension RangeReplaceableContainer where Self: BidirectionalContainer & ~Copyable & ~Escapable, Element: ~Copyable { @@ -439,7 +439,7 @@ where Self: BidirectionalContainer & ~Copyable & ~Escapable, Element: ~Copyable } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension RangeReplaceableContainer where Self: ~Copyable & ~Escapable, Element: ~Copyable { @@ -556,7 +556,7 @@ where Self: ~Copyable & ~Escapable, Element: ~Copyable } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension RangeReplaceableContainer where Self: ~Copyable & ~Escapable, Element: ~Copyable { /// Appends at most `newItemCount` items generated by a producer to the end of @@ -663,7 +663,7 @@ where Self: ~Copyable & ~Escapable, Element: ~Copyable { //MARK: - Standard Extensions Requiring Copyability -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension RangeReplaceableContainer where Self: ~Copyable & ~Escapable, diff --git a/Sources/ContainersPreview/Protocols/Iterable+Algorithms.swift b/Sources/ContainersPreview/Protocols/Iterable+Algorithms.swift index 92ecd192..01780d9c 100644 --- a/Sources/ContainersPreview/Protocols/Iterable+Algorithms.swift +++ b/Sources/ContainersPreview/Protocols/Iterable+Algorithms.swift @@ -13,7 +13,7 @@ #if compiler(>=6.4) && UnstableContainersPreview -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension Iterable_ where Self: ~Copyable & ~Escapable, Element_: ~Copyable { @@ -37,7 +37,7 @@ extension Iterable_ } // Ambiguity breakers -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension Sequence where Self: Iterable_ { public func reduce( _ initialResult: consuming Result, @@ -57,7 +57,7 @@ extension Sequence where Self: Iterable_ { } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension Iterable_ where Self: ~Copyable & ~Escapable, Element_: ~Copyable { @@ -92,7 +92,7 @@ extension Iterable_ } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension Iterable_ where Self: ~Copyable & ~Escapable, Element_: ~Copyable & Equatable { @inlinable diff --git a/Sources/ContainersPreview/Protocols/Iterable+Standard Conformances.swift b/Sources/ContainersPreview/Protocols/Iterable+Standard Conformances.swift deleted file mode 100644 index 6fd17844..00000000 --- a/Sources/ContainersPreview/Protocols/Iterable+Standard Conformances.swift +++ /dev/null @@ -1,223 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Swift Collections open source project -// -// Copyright (c) 2026 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See https://swift.org/LICENSE.txt for license information -// -// SPDX-License-Identifier: Apache-2.0 WITH Swift-exception -// -//===----------------------------------------------------------------------===// - -#if compiler(>=6.4) && UnstableContainersPreview - -@available(SwiftStdlib 5.0, *) -extension Span: Iterable_ where Element: ~Copyable { - public typealias BorrowingIterator_ = SpanIterator - public typealias Element_ = Element - - @inlinable - public var underestimatedCount_: Int { count } - - @_lifetime(borrow self) - @inlinable - public func makeBorrowingIterator_() -> SpanIterator { - SpanIterator(self) - } -} - -@available(SwiftStdlib 5.0, *) -extension MutableSpan: Iterable_ where Element: ~Copyable { - public typealias BorrowingIterator_ = SpanIterator - public typealias Element_ = Element - - @inlinable - public var underestimatedCount_: Int { count } - - @_lifetime(borrow self) - @inlinable - public func makeBorrowingIterator_() -> SpanIterator { - // FIXME: This should be declared to return BorrowingIterator, but it - // clashes with the stdlib's alternate definition: - // error: 'BorrowingIterator' is ambiguous for type lookup in this context - // Two different typealiases with the same name wreaks havoc with inference? - SpanIterator(self.span) - } -} - -@available(SwiftStdlib 5.0, *) -extension OutputSpan: Iterable_ where Element: ~Copyable { - public typealias BorrowingIterator_ = SpanIterator - - @inlinable - public var underestimatedCount_: Int { count } - - @_lifetime(borrow self) - @inlinable - public func makeBorrowingIterator_() -> BorrowingIterator_ { - SpanIterator(self.span) - } -} - -@available(SwiftStdlib 5.0, *) -extension InputSpan: Iterable_ where Element: ~Copyable { - public typealias BorrowingIterator_ = SpanIterator - - @inlinable - public var underestimatedCount_: Int { count } - - @_lifetime(borrow self) - @inlinable - public func makeBorrowingIterator_() -> BorrowingIterator_ { - SpanIterator(self.span) - } -} - -@available(SwiftStdlib 6.2, *) -extension Array: Iterable_ { - public typealias BorrowingIterator_ = SpanIterator - - @inlinable - public var underestimatedCount_: Int { count } - - @_lifetime(borrow self) - @inlinable - public func makeBorrowingIterator_() -> BorrowingIterator_ { - SpanIterator(self.span) - } -} - -@available(SwiftStdlib 6.2, *) -extension InlineArray: Iterable_ where Element: ~Copyable { - public typealias BorrowingIterator_ = SpanIterator - - @inlinable - public var underestimatedCount_: Int { count } - - @_lifetime(borrow self) - @inlinable - public func makeBorrowingIterator_() -> SpanIterator { - // FIXME: This should be declared to return BorrowingIterator, but it - // clashes with the stdlib's alternate definition: - // error: 'BorrowingIterator' is ambiguous for type lookup in this context - // Two different typealiases with the same name wreaks havoc with inference? - SpanIterator(self.span) - } -} - -@available(SwiftStdlib 6.2, *) -extension Range: Iterable_ -where Bound: Strideable, Bound.Stride: SignedInteger -{ - public typealias Element = Bound - - @frozen - public struct BorrowingIterator_: BorrowingIteratorProtocol_, ~Copyable { - @usableFromInline - internal var _current: InlineArray<1, Bound> - - @usableFromInline - internal var _end: Bound - - @usableFromInline - internal var _progress: Bool - - @inlinable - internal init(_ base: Range) { - self._current = .init(repeating: base.lowerBound) - self._end = base.upperBound - self._progress = false - } - @inlinable - @_lifetime(&self) - public mutating func nextSpan_(maxCount: Int) -> Span { - if _progress { - _current[0] = _current[0].advanced(by: 1) - } - guard _current[0] < _end else { - _progress = false - return .init() - } - _progress = true - return _current.span - } - } - - @_alwaysEmitIntoClient - @_transparent - package var _borrowingUnderestimatedCount: Int { - guard let count = Int(exactly: lowerBound.distance(to: upperBound)) else { - return 0 - } - return count - } - - @inlinable - public var underestimatedCount_: Int { _borrowingUnderestimatedCount } - - @inlinable - public func makeBorrowingIterator_() -> BorrowingIterator_ { - BorrowingIterator_(self) - } -} - -@available(SwiftStdlib 6.2, *) -extension ClosedRange: Iterable_ -where Bound: Strideable, Bound.Stride: SignedInteger -{ - public typealias Element = Bound - - @frozen - public struct BorrowingIterator_: BorrowingIteratorProtocol_, ~Copyable { - @usableFromInline - internal var _current: InlineArray<1, Bound> - - @usableFromInline - internal var _last: Bound - - @usableFromInline - internal var _progress: Bool - - @inlinable - internal init(_ base: ClosedRange) { - self._current = .init(repeating: base.lowerBound) - self._last = base.upperBound - self._progress = false - } - @inlinable - @_lifetime(&self) - public mutating func nextSpan_(maxCount: Int) -> Span { - if _progress { - _current[0] = _current[0].advanced(by: 1) - } - guard _current[0] <= _last else { - _progress = false - return .init() - } - _progress = true - return _current.span - } - } - - @_alwaysEmitIntoClient - @_transparent - package var _borrowingUnderestimatedCount: Int { - guard let distance = Int(exactly: lowerBound.distance(to: upperBound)) - else { return 0 } - let advanced = distance.addingReportingOverflow(1) - guard !advanced.overflow else { return 0 } - return advanced.partialValue - } - - @inlinable - public var underestimatedCount_: Int { _borrowingUnderestimatedCount } - - @inlinable - public func makeBorrowingIterator_() -> BorrowingIterator_ { - BorrowingIterator_(self) - } -} - -#endif diff --git a/Sources/ContainersPreview/Protocols/Iterable+Utilities.swift b/Sources/ContainersPreview/Protocols/Iterable+Utilities.swift index f2cb3053..b1f4de7a 100644 --- a/Sources/ContainersPreview/Protocols/Iterable+Utilities.swift +++ b/Sources/ContainersPreview/Protocols/Iterable+Utilities.swift @@ -17,7 +17,7 @@ import InternalCollectionsUtilities #if compiler(>=6.4) && UnstableContainersPreview -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension Iterable_ where Self: ~Copyable & ~Escapable, Element_: Copyable { @inlinable package func _copyContents( diff --git a/Sources/ContainersPreview/Protocols/Iterable.swift b/Sources/ContainersPreview/Protocols/Iterable.swift index 380262d9..e6c97554 100644 --- a/Sources/ContainersPreview/Protocols/Iterable.swift +++ b/Sources/ContainersPreview/Protocols/Iterable.swift @@ -13,8 +13,14 @@ #if compiler(>=6.4) && UnstableContainersPreview -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) public protocol Iterable_: ~Copyable, ~Escapable { + // FIXME: None of these names should not have trailing underscores, but that + // would clash with the stdlib's versions: + // error: 'BorrowingIterator' is ambiguous for type lookup in this context + // + // This is likely best resolved by removing these definitions as soon as they + // appear in the stdlib. associatedtype Element_: ~Copyable associatedtype Failure_: Error = Never @@ -30,7 +36,7 @@ public protocol Iterable_: ~Copyable, ~Escapable { ) -> Bool? } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension Iterable_ where Self: ~Copyable & ~Escapable, Element_: ~Copyable @@ -44,7 +50,7 @@ where } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension Iterable_ where Self: Sequence { @inlinable public var underestimatedCount_: Int { 0 } diff --git a/Sources/ContainersPreview/Protocols/Producer+Collect.swift b/Sources/ContainersPreview/Protocols/Producer+Collect.swift index a1d169dd..da3caf38 100644 --- a/Sources/ContainersPreview/Protocols/Producer+Collect.swift +++ b/Sources/ContainersPreview/Protocols/Producer+Collect.swift @@ -15,6 +15,7 @@ @available(SwiftStdlib 5.0, *) extension Producer where Self: ~Copyable & ~Escapable, Element: ~Copyable { + @available(SwiftStdlib 6.4, *) @inlinable public consuming func collect< R: DynamicContainer & ~Copyable @@ -27,6 +28,7 @@ extension Producer where Self: ~Copyable & ~Escapable, Element: ~Copyable { /// Collect all items generated by this producer into the provided /// range-replaceable container instance, which must be able to accommodate /// every new element. + @available(SwiftStdlib 6.4, *) @inlinable public consuming func collect( into container: inout some RangeReplaceableContainer & ~Copyable & ~Escapable @@ -49,6 +51,7 @@ extension Producer where Self: ~Copyable & ~Escapable, Element: ~Copyable { /// Collect all items generated by this producer into the provided /// dynamic container instance, resizing it if necessary. + @available(SwiftStdlib 6.4, *) @inlinable public consuming func collect( into container: inout some DynamicContainer & ~Copyable diff --git a/Sources/ContainersPreview/Types/SpanIterator.swift b/Sources/ContainersPreview/Types/SpanIterator.swift deleted file mode 100644 index 6e59e785..00000000 --- a/Sources/ContainersPreview/Types/SpanIterator.swift +++ /dev/null @@ -1,61 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Swift Collections open source project -// -// Copyright (c) 2026 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See https://swift.org/LICENSE.txt for license information -// -// SPDX-License-Identifier: Apache-2.0 WITH Swift-exception -// -//===----------------------------------------------------------------------===// - -#if compiler(>=6.4) && UnstableContainersPreview - -/// A borrowing iterator that provides access to the elements of a single -/// span through a `BorrowingIteratorProtocol` interface. -@available(SwiftStdlib 5.0, *) -public struct SpanIterator: BorrowingIteratorProtocol_, ~Copyable, ~Escapable - where Element_: ~Copyable -{ - @usableFromInline - internal var _span: Span - @usableFromInline - internal var _start: Int - @usableFromInline - internal var _count: Int - - @_lifetime(copy elements) - public init(_ elements: Span) { - _span = elements - _start = 0 - _count = elements.count - } - - @_alwaysEmitIntoClient - @_lifetime(&self) - @_lifetime(self: copy self) - @_transparent - public mutating func nextSpan_(maxCount: Int) -> Span { - let c = Swift.min(maxCount, _count) - defer { - _start &+= c - _count &-= c - } - return _span.extracting(droppingFirst: _start).extracting(first: c) - } - - @_alwaysEmitIntoClient - @_lifetime(self: copy self) - public mutating func skip_(by offset: Int) -> Int { - let c = Swift.min(offset, _count) - defer { - _start &+= c - _count &-= c - } - return c - } -} - -#endif diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Append.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Append.swift index 229e31a8..98193fac 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Append.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Append.swift @@ -311,6 +311,7 @@ extension RigidDeque /*where Element: Copyable*/ { } #if compiler(>=6.4) && UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient internal mutating func _append< S: Iterable_ & ~Copyable & ~Escapable @@ -334,6 +335,7 @@ extension RigidDeque /*where Element: Copyable*/ { /// - newElements: The new elements to copy into the deque. /// /// - Complexity: O(*m*), where *m* is the length of `newElements`. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient public mutating func append( copying newElements: borrowing S @@ -375,6 +377,7 @@ extension RigidDeque /*where Element: Copyable*/ { /// - items: The new elements to copy into the deque. /// /// - Complexity: O(*m*), where *m* is the length of `items`. @available(SwiftStdlib 5.0, *) + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient public mutating func append< S: Iterable_ & Sequence diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Equatable.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Equatable.swift index 6b82a90b..8935f6db 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Equatable.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Equatable.swift @@ -40,13 +40,14 @@ extension RigidDeque where Element: Equatable & ~Copyable { guard !left.isTriviallyIdentical(to: right) else { return true } #if compiler(>=6.4) && UnstableContainersPreview - return left._elementsEqual(right) -#else + if #available(anyAppleOS 27, *) { + return left._elementsEqual(right) + } +#endif for i in 0 ..< left.count { guard left[i] == right[i] else { return false } } return true -#endif } } diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Initializers.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Initializers.swift index fb1a09f8..f5f8bb00 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Initializers.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Initializers.swift @@ -129,6 +129,7 @@ extension RigidDeque /*where Element: Copyable*/ { /// - capacity: The storage capacity of the new deque. /// - contents: A sequence whose contents to copy into the new deque. /// The sequence must not contain more than `capacity` elements. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public init( @@ -183,6 +184,7 @@ extension RigidDeque /*where Element: Copyable*/ { /// - capacity: The storage capacity of the new deque. /// - contents: A sequence whose contents to copy into the new deque. /// The sequence must not contain more than `capacity` elements. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public init>( @@ -193,7 +195,9 @@ extension RigidDeque /*where Element: Copyable*/ { self.init(capacity: capacity) try self._append(copying: contents) } +#endif +#if compiler(>=6.4) && UnstableContainersPreview /// Creates a new deque with the specified capacity, holding a copy /// of the contents of a given collection. /// @@ -203,6 +207,7 @@ extension RigidDeque /*where Element: Copyable*/ { /// than or equal to the count of the collection. /// - contents: A collection whose contents to copy into the new deque. /// The sequence must not contain more than `capacity` elements. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public init>( diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Insertions.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Insertions.swift index f68a6235..d3c2f951 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Insertions.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Insertions.swift @@ -356,6 +356,7 @@ extension RigidDeque /* where Element: Copyable */ { } #if compiler(>=6.4) && UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @inlinable internal mutating func _insertContainer< C: Container & ~Copyable & ~Escapable @@ -418,6 +419,7 @@ extension RigidDeque /* where Element: Copyable */ { /// a valid index of the deque. /// /// - Complexity: O(`self.count` + `items.count`). + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public mutating func insert< @@ -480,6 +482,7 @@ extension RigidDeque /* where Element: Copyable */ { /// a valid index of the deque. /// /// - Complexity: O(`self.count` + `items.count`) + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public mutating func insert< diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift index c31d5496..7ed7e432 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift @@ -288,6 +288,7 @@ extension RigidDeque /*where Element: Copyable*/ { } #if compiler(>=6.4) && UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @inlinable internal mutating func _prepend< S: Iterable_ & ~Copyable & ~Escapable @@ -307,6 +308,7 @@ extension RigidDeque /*where Element: Copyable*/ { _handle.rotate(toStartAtOffset: oldCount) } + @available(SwiftStdlib 6.4, *) @inlinable internal mutating func _prepend< S: Iterable_ & ~Copyable & ~Escapable @@ -336,6 +338,7 @@ extension RigidDeque /*where Element: Copyable*/ { /// - items: The new elements to copy into the deque. /// /// - Complexity: O(*m*), where *m* is the length of `items`. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient public mutating func prepend( copying items: borrowing S @@ -354,6 +357,7 @@ extension RigidDeque /*where Element: Copyable*/ { /// - items: The new elements to copy into the deque. /// /// - Complexity: O(`items.count`) + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient public mutating func prepend & ~Copyable & ~Escapable>( copying items: borrowing C @@ -441,6 +445,7 @@ extension RigidDeque /*where Element: Copyable*/ { /// - items: The new elements to copy into the deque. /// /// - Complexity: O(*m*), where *m* is the length of `items`. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient public mutating func prepend>( copying items: borrowing S @@ -458,6 +463,7 @@ extension RigidDeque /*where Element: Copyable*/ { /// - items: The new elements to copy into the deque. /// /// - Complexity: O(*m*), where *m* is the length of `items`. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient public mutating func prepend>( copying items: borrowing S @@ -475,6 +481,7 @@ extension RigidDeque /*where Element: Copyable*/ { /// - items: The new elements to copy into the deque. /// /// - Complexity: O(*m*), where *m* is the length of `items`. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient public mutating func prepend & Sequence>( copying items: borrowing C @@ -491,6 +498,7 @@ extension RigidDeque /*where Element: Copyable*/ { /// - items: The new elements to copy into the deque. /// /// - Complexity: O(*m*), where *m* is the length of `items`. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient public mutating func prepend & Collection>( copying items: borrowing C diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Removals.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Removals.swift index ea5c1d1a..09ef16db 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Removals.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Removals.swift @@ -153,7 +153,6 @@ extension RigidDeque where Element: ~Copyable { return _handle.uncheckedRemoveFirst() } -#if !UnstableContainersPreview /// Removes and returns the last element of the deque, if there is one. /// /// - Returns: The last element of the original deque if it was not empty; @@ -162,10 +161,11 @@ extension RigidDeque where Element: ~Copyable { /// - Complexity: O(1) @_alwaysEmitIntoClient public mutating func popLast() -> Element? { + // FIXME: Remove this algorithm; it is already provided by + // RangeReplaceableContainer, albeit with stricter availability. guard !isEmpty else { return nil } return _handle.uncheckedRemoveLast() } -#endif } #endif diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Replacements.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Replacements.swift index ad64df6a..1e44dcb2 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Replacements.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Replacements.swift @@ -456,6 +456,7 @@ extension RigidDeque /* where Element: Copyable */ { } #if compiler(>=6.4) && UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @inlinable internal mutating func _replace< C: Container & ~Copyable & ~Escapable @@ -529,6 +530,7 @@ extension RigidDeque /* where Element: Copyable */ { /// - items: The new elements to copy into the collection. /// /// - Complexity: O(`self.count` + `items.count`) + @available(SwiftStdlib 6.4, *) @inlinable @inline(__always) public mutating func replace< @@ -606,6 +608,7 @@ extension RigidDeque /* where Element: Copyable */ { /// /// - Complexity: O(*n* + *m*), where *n* is count of this deque and /// *m* is the count of `items`. + @available(SwiftStdlib 6.4, *) @inlinable @inline(__always) public mutating func replace< diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Append.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Append.swift index 58ced3b3..d4a36811 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Append.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Append.swift @@ -298,6 +298,7 @@ extension UniqueDeque /*where Element: Copyable*/ { } #if compiler(>=6.4) && UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient internal mutating func _append( copying items: borrowing S @@ -323,6 +324,7 @@ extension UniqueDeque /*where Element: Copyable*/ { /// /// - Complexity: O(*m*), where *m* is the length of `items`, when amortized /// over many similar invocations on the same deque + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient public mutating func append( copying items: borrowing S @@ -374,6 +376,7 @@ extension UniqueDeque /*where Element: Copyable*/ { /// /// - Complexity: O(*m*), where *m* is the length of `items`, when /// amortized over many similar invocations over the same deque. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient public mutating func append>( copying items: S diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Initializers.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Initializers.swift index ec6eb187..0d52fb11 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Initializers.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Initializers.swift @@ -142,6 +142,7 @@ extension UniqueDeque /*where Element: Copyable*/ { /// - capacity: The storage capacity of the new deque, or nil to let the /// deque grow itself as needed to accomodate all items in `contents`. /// - contents: A sequence whose contents to copy into the new deque. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public init( @@ -180,6 +181,7 @@ extension UniqueDeque /*where Element: Copyable*/ { /// deque grow itself as needed to accomodate all items in `contents`. /// - contents: A sequence whose contents to copy into the new deque. /// The sequence must not contain more than `capacity` elements. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public init>( @@ -198,6 +200,7 @@ extension UniqueDeque /*where Element: Copyable*/ { /// - capacity: The storage capacity of the new deque. /// - contents: A sequence whose contents to copy into the new deque. /// The sequence must not contain more than `capacity` elements. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public init>( diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Insertions.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Insertions.swift index c452c931..813ddf21 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Insertions.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Insertions.swift @@ -374,6 +374,7 @@ extension UniqueDeque /* where Element: Copyable */ { } #if compiler(>=6.4) && UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @inlinable internal mutating func _insertContainer< C: Container & ~Copyable & ~Escapable @@ -439,6 +440,7 @@ extension UniqueDeque /* where Element: Copyable */ { /// /// - Complexity: O(`self.count` + `items.count`) when amortized over many /// similar invocations on the same deque. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public mutating func insert< @@ -505,6 +507,7 @@ extension UniqueDeque /* where Element: Copyable */ { /// /// - Complexity: O(`self.count` + `items.count`) when amortized over many /// similar invocations on the same deque. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @inline(__always) public mutating func insert< diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift index 62aa8de1..45e5da0a 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift @@ -320,6 +320,7 @@ extension UniqueDeque /*where Element: Copyable*/ { } #if compiler(>=6.4) && UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @inlinable internal mutating func _prepend( copying items: borrowing S @@ -338,6 +339,7 @@ extension UniqueDeque /*where Element: Copyable*/ { _storage._handle.rotate(toStartAtOffset: oldCount) } + @available(SwiftStdlib 6.4, *) @inlinable internal mutating func _prepend( copying items: borrowing S, @@ -366,6 +368,7 @@ extension UniqueDeque /*where Element: Copyable*/ { /// /// - Complexity: O(*m*), where *m* is the length of `items`, as amortized /// over many similar invocations on the same deque. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient public mutating func prepend( copying items: borrowing S @@ -385,6 +388,7 @@ extension UniqueDeque /*where Element: Copyable*/ { /// /// - Complexity: O(`items.count`) when amortized over many similar /// invocations on the same deque. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient public mutating func prepend & ~Copyable & ~Escapable>( copying items: borrowing C @@ -477,6 +481,7 @@ extension UniqueDeque /*where Element: Copyable*/ { /// /// - Complexity: O(*m*), where *m* is the length of `items`, as amortized /// over many similar invocations on the same deque. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient public mutating func prepend>( copying items: borrowing S @@ -495,6 +500,7 @@ extension UniqueDeque /*where Element: Copyable*/ { /// /// - Complexity: O(*m*), where *m* is the length of `items` when amortized /// over many similar invocations on the same deque. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient public mutating func prepend>( copying items: borrowing S @@ -513,6 +519,7 @@ extension UniqueDeque /*where Element: Copyable*/ { /// /// - Complexity: O(*m*), where *m* is the length of `items` when amortized /// over many similar invocations on the same deque. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient public mutating func prepend & Sequence>( copying items: borrowing C @@ -530,6 +537,7 @@ extension UniqueDeque /*where Element: Copyable*/ { /// /// - Complexity: O(*m*), where *m* is the length of `items` when amortized /// over many similar invocations on the same deque. + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient public mutating func prepend & Collection>( copying items: C diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Removals.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Removals.swift index c86c82a5..302b0934 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Removals.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Removals.swift @@ -136,7 +136,6 @@ extension UniqueDeque where Element: ~Copyable { _storage.popFirst() } -#if !UnstableContainersPreview /// Removes and returns the last element of the deque, if there is one. /// /// - Returns: The last element of the original deque if it was not empty; @@ -146,9 +145,10 @@ extension UniqueDeque where Element: ~Copyable { @_alwaysEmitIntoClient @inline(__always) public mutating func popLast() -> Element? { + // FIXME: Remove this algorithm; it is already provided by + // RangeReplaceableContainer, albeit with stricter availability. _storage.popLast() } -#endif } #endif diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Replacements.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Replacements.swift index 75d6d47f..ca0579ad 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Replacements.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Replacements.swift @@ -465,6 +465,7 @@ extension UniqueDeque /* where Element: Copyable */ { } #if compiler(>=6.4) && UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @inlinable internal mutating func _replace< C: Container & ~Copyable & ~Escapable @@ -539,6 +540,7 @@ extension UniqueDeque /* where Element: Copyable */ { /// - items: The new elements to copy into the collection. /// /// - Complexity: O(`self.count` + `items.count`) + @available(SwiftStdlib 6.4, *) @inlinable @inline(__always) public mutating func replace< @@ -618,6 +620,7 @@ extension UniqueDeque /* where Element: Copyable */ { /// /// - Complexity: O(*n* + *m*), where *n* is count of this deque and /// *m* is the count of `items`. + @available(SwiftStdlib 6.4, *) @inlinable @inline(__always) public mutating func replace< diff --git a/Tests/BasicContainersTests/RigidArrayTests.swift b/Tests/BasicContainersTests/RigidArrayTests.swift index 01a7cc96..617a9893 100644 --- a/Tests/BasicContainersTests/RigidArrayTests.swift +++ b/Tests/BasicContainersTests/RigidArrayTests.swift @@ -74,7 +74,9 @@ class RigidArrayTests: CollectionTestCase { expectEqual(tracker.instances, 2 * layout.count) expectRigidArrayContents(items, equalTo: expected) #if compiler(>=6.4) && UnstableContainersPreview - checkIterable(items, expectedContents: expected) + if #available(SwiftStdlib 6.4, *) { + checkIterable(items, expectedContents: expected) + } #endif } } @@ -1206,6 +1208,7 @@ class RigidArrayTests: CollectionTestCase { } #if compiler(>=6.4) && UnstableContainersPreview + @available(SwiftStdlib 6.4, *) func test_insert_copying_Container() { withSomeArrayLayouts("layout", ofCapacities: [0, 5, 10]) { layout in withEvery("i", in: 0 ... layout.count) { i in @@ -1438,6 +1441,7 @@ class RigidArrayTests: CollectionTestCase { } #if compiler(>=6.4) && UnstableContainersPreview + @available(SwiftStdlib 6.4, *) func test_replace_Container() { withSomeArrayLayouts("layout", ofCapacities: [0, 5, 10]) { layout in withEveryRange("range", in: 0 ..< layout.count) { range in diff --git a/Tests/BasicContainersTests/UniqueArrayTests.swift b/Tests/BasicContainersTests/UniqueArrayTests.swift index a1af5e0f..3571c02b 100644 --- a/Tests/BasicContainersTests/UniqueArrayTests.swift +++ b/Tests/BasicContainersTests/UniqueArrayTests.swift @@ -76,7 +76,9 @@ class UniqueArrayTests: CollectionTestCase { expectEqual(tracker.instances, 2 * layout.count) expectUniqueArrayContents(items, equalTo: expected) #if compiler(>=6.4) && UnstableContainersPreview - checkIterable(items, expectedContents: expected) + if #available(SwiftStdlib 6.4, *) { + checkIterable(items, expectedContents: expected) + } #endif } } diff --git a/Tests/ContainersTests/BorrowingSequenceTests.swift b/Tests/ContainersTests/BorrowingSequenceTests.swift index bafe236c..f89a48fa 100644 --- a/Tests/ContainersTests/BorrowingSequenceTests.swift +++ b/Tests/ContainersTests/BorrowingSequenceTests.swift @@ -22,7 +22,7 @@ import ContainersPreview #if compiler(>=6.4) && UnstableContainersPreview final class IterableTests: XCTestCase { - @available(SwiftStdlib 6.2, *) + @available(SwiftStdlib 6.4, *) func testBasic() { let array = [1, 2, 3, 4, 5, 6, 7, 8] @@ -63,7 +63,7 @@ final class IterableTests: XCTestCase { } } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) extension Iterable_ where Self: ~Copyable & ~Escapable, Element_: Copyable { func collectViaBorrowing() throws(Failure_) -> [Element_] { var borrowIterator = makeBorrowingIterator_() diff --git a/Tests/DequeTests/RigidDequeTests.swift b/Tests/DequeTests/RigidDequeTests.swift index b558f4c7..0a3ce02d 100644 --- a/Tests/DequeTests/RigidDequeTests.swift +++ b/Tests/DequeTests/RigidDequeTests.swift @@ -82,16 +82,19 @@ internal func expectRigidDequeContents< line: UInt = #line ) { #if compiler(>=6.4) && UnstableContainersPreview - expectIterableContents( - left, - equivalentTo: right, - by: areEquivalent, - printer: printer, - message(), - trapping: trapping, - file: file, - line: line) -#else + if #available(SwiftStdlib 6.4, *) { + expectIterableContents( + left, + equivalentTo: right, + by: areEquivalent, + printer: printer, + message(), + trapping: trapping, + file: file, + line: line) + return + } +#endif var c = 0 var j = right.startIndex for i in 0 ..< left.count { @@ -106,7 +109,6 @@ internal func expectRigidDequeContents< right.formIndex(after: &j) c += 1 } -#endif } final class RigidDequeTests: CollectionTestCase { @@ -424,6 +426,7 @@ final class RigidDequeTests: CollectionTestCase { } #if compiler(>=6.4) && UnstableContainersPreview + @available(SwiftStdlib 6.4, *) func test_initCopyingBorrowingSequence() { withEvery("c", in: 0 ..< 10) { c in withEvery("capacity", in: [c, c + 1]) { capacity in @@ -534,7 +537,7 @@ final class RigidDequeTests: CollectionTestCase { } } } - + func test_popLast() { withEveryDeque("layout", ofCapacities: [0, 1, 2, 3, 5, 10]) { layout in withLifetimeTracking { tracker in @@ -1274,6 +1277,7 @@ final class RigidDequeTests: CollectionTestCase { } #if compiler(>=6.4) && UnstableContainersPreview + @available(SwiftStdlib 6.4, *) func test_insert_RigidArray() { withEveryDeque("layout", ofCapacities: [0, 1, 2, 3, 5, 10]) { layout in withEvery("i", in: 0 ... layout.count) { i in diff --git a/Tests/DequeTests/UniqueDequeTests.swift b/Tests/DequeTests/UniqueDequeTests.swift index 08774ba3..3df8d6bb 100644 --- a/Tests/DequeTests/UniqueDequeTests.swift +++ b/Tests/DequeTests/UniqueDequeTests.swift @@ -82,16 +82,19 @@ internal func expectUniqueDequeContents< line: UInt = #line ) { #if compiler(>=6.4) && UnstableContainersPreview - expectIterableContents( - left, - equivalentTo: right, - by: areEquivalent, - printer: printer, - message(), - trapping: trapping, - file: file, - line: line) -#else + if #available(SwiftStdlib 6.4, *) { + expectIterableContents( + left, + equivalentTo: right, + by: areEquivalent, + printer: printer, + message(), + trapping: trapping, + file: file, + line: line) + return + } +#endif var c = 0 var j = right.startIndex for i in 0 ..< left.count { @@ -106,7 +109,6 @@ internal func expectUniqueDequeContents< right.formIndex(after: &j) c += 1 } -#endif } final class UniqueDequeTests: CollectionTestCase { diff --git a/Tests/_CollectionsTestSupport/AssertionContexts/Assertions+Containers.swift b/Tests/_CollectionsTestSupport/AssertionContexts/Assertions+Containers.swift index 929ac9e5..2a7522a5 100644 --- a/Tests/_CollectionsTestSupport/AssertionContexts/Assertions+Containers.swift +++ b/Tests/_CollectionsTestSupport/AssertionContexts/Assertions+Containers.swift @@ -124,7 +124,7 @@ public func expectIterableContents< #if compiler(>=6.4) && UnstableContainersPreview /// Check if `left` contains lifetime tracked instances whose payloads equal /// the elements in `right`. -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) public func expectIterablePayloads< Payload: Equatable, E1: Iterable_, E> & ~Copyable & ~Escapable, @@ -172,7 +172,7 @@ public func expectIterablePayloads< /// Check if `left` contains lifetime tracked instances whose payloads equal /// the elements in `right`. -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) public func expectIterablePayloads< Payload: Equatable, E1: Iterable_, E> & ~Copyable & ~Escapable, @@ -220,7 +220,7 @@ public func expectIterablePayloads< #endif #if compiler(>=6.4) && UnstableContainersPreview -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) public func expectIterablesWithEquivalentElements< S1: Iterable_ & ~Copyable & ~Escapable, S2: Iterable_ & ~Copyable & ~Escapable @@ -245,7 +245,7 @@ where } /// Check if `left` and `right` contain equal elements in the same order. -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) public func expectIterablesWithEqualElements< Element: Equatable, S1: Iterable_ & ~Copyable & ~Escapable, @@ -270,7 +270,7 @@ where } /// Check if `left` and `right` contain equal elements in the same order. -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) public func expectIterableContents< Element: Equatable, S1: Iterable_ & ~Copyable & ~Escapable, @@ -313,7 +313,7 @@ public func expectIterableContents< } /// Check if `left` and `right` contain equal elements in the same order. -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) public func expectIterableContents< S1: Iterable_ & ~Copyable & ~Escapable, C2: Collection, diff --git a/Tests/_CollectionsTestSupport/ConformanceCheckers/CheckContainer.swift b/Tests/_CollectionsTestSupport/ConformanceCheckers/CheckContainer.swift index e922a6c6..7f264011 100644 --- a/Tests/_CollectionsTestSupport/ConformanceCheckers/CheckContainer.swift +++ b/Tests/_CollectionsTestSupport/ConformanceCheckers/CheckContainer.swift @@ -19,7 +19,7 @@ import Collections import ContainersPreview #endif -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) @inlinable public func checkIterable< S: Iterable_ & ~Copyable & ~Escapable, @@ -37,7 +37,7 @@ public func checkIterable< file: file, line: line) } -@available(SwiftStdlib 5.0, *) +@available(SwiftStdlib 6.4, *) @inlinable public func checkIterable< S: Iterable_ & ~Copyable & ~Escapable, diff --git a/Tests/_CollectionsTestSupport/MinimalTypes/StaccatoContainer.swift b/Tests/_CollectionsTestSupport/MinimalTypes/StaccatoContainer.swift index 7e20eb98..df021524 100644 --- a/Tests/_CollectionsTestSupport/MinimalTypes/StaccatoContainer.swift +++ b/Tests/_CollectionsTestSupport/MinimalTypes/StaccatoContainer.swift @@ -84,10 +84,15 @@ public struct _StaccatoBorrowingIterator: BorrowingIteratorP internal var _offset: Int @_lifetime(copy contents) - internal init(contents: Span, params: _StaccatoParameters) { + internal init( + contents: Span, + params: _StaccatoParameters, + start: _StaccatoIndex = .init(_offset: 0) + ) { + precondition(start._offset >= 0 && start._offset <= params._count) self._contents = contents self._params = params - self._offset = 0 + self._offset = start._offset } @_lifetime(&self) // FIXME: Should be `@_lifetime(copy self)` @@ -97,6 +102,10 @@ public struct _StaccatoBorrowingIterator: BorrowingIteratorP _offset = endOffset return _contents.extracting(startOffset ..< endOffset) } + + public var currentIndex: _StaccatoIndex { + _StaccatoIndex(_offset: _offset) + } } @available(SwiftStdlib 5.0, *) @@ -132,8 +141,16 @@ extension StaccatoContainer: Container where Element: ~Copyable { public var isEmpty: Bool { _contents.isEmpty } public var count: Int { _contents.count } - - + + @_lifetime(borrow self) + public func makeBorrowingIterator(from start: Index) -> BorrowingIterator_ { + BorrowingIterator_(contents: _contents.span, params: _params, start: start) + } + + public func currentIndex(of iterator: borrowing BorrowingIterator_) -> Index { + iterator.currentIndex + } + package func _isValid(_ index: Index) -> Bool { index._offset >= 0 && index._offset <= count } diff --git a/Xcode/Collections.xcodeproj/project.pbxproj b/Xcode/Collections.xcodeproj/project.pbxproj index ffc840f3..46bcf490 100644 --- a/Xcode/Collections.xcodeproj/project.pbxproj +++ b/Xcode/Collections.xcodeproj/project.pbxproj @@ -7,6 +7,10 @@ objects = { /* Begin PBXBuildFile section */ + 7D0DC7BF2FFD929900BEE8B2 /* Array+Iterable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D0DC7BE2FFD929500BEE8B2 /* Array+Iterable.swift */; }; + 7D0DC7C12FFD92BB00BEE8B2 /* InlineArray+Iterable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D0DC7C02FFD92B500BEE8B2 /* InlineArray+Iterable.swift */; }; + 7D0DC7C32FFD987800BEE8B2 /* Range+Iterable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D0DC7C22FFD987400BEE8B2 /* Range+Iterable.swift */; }; + 7D0DC7C52FFD990E00BEE8B2 /* ClosedRange+Iterable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D0DC7C42FFD990E00BEE8B2 /* ClosedRange+Iterable.swift */; }; 7D12E33D2FF5CC2A003050AB /* OutputSpan+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D12E33C2FF5CC2A003050AB /* OutputSpan+Helpers.swift */; }; 7D12E33F2FF5DAE4003050AB /* _HTable+Deprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D12E33E2FF5DADE003050AB /* _HTable+Deprecated.swift */; }; 7D12E3412FF5DD0B003050AB /* RigidSet+Deprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D12E3402FF5DD07003050AB /* RigidSet+Deprecated.swift */; }; @@ -157,6 +161,10 @@ 7D77E6252FD0F880003FA63B /* UnsafePointer+Extras.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D77E6242FD0F87B003FA63B /* UnsafePointer+Extras.swift */; }; 7D77E6272FD0F94B003FA63B /* UnsafeMutablePointer+Extras.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D77E6262FD0F940003FA63B /* UnsafeMutablePointer+Extras.swift */; }; 7D945E6B2FF5E0D1001041A6 /* UniqueSet+Deprecations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D945E6A2FF5E0CB001041A6 /* UniqueSet+Deprecations.swift */; }; + 7D945E6D2FF71D76001041A6 /* Span+Iterable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D945E6C2FF71D76001041A6 /* Span+Iterable.swift */; }; + 7D945E6F2FF71DFF001041A6 /* MutableSpan+Iterable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D945E6E2FF71DF8001041A6 /* MutableSpan+Iterable.swift */; }; + 7D945E712FF71E58001041A6 /* OutputSpan+Iterable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D945E702FF71E53001041A6 /* OutputSpan+Iterable.swift */; }; + 7D945E732FF71E8C001041A6 /* InputSpan+Iterable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D945E722FF71E86001041A6 /* InputSpan+Iterable.swift */; }; 7D9748D42E9748930098631A /* BigString+Chunk+UTF16.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D9748D32E9748930098631A /* BigString+Chunk+UTF16.swift */; }; 7D9748D52E9748930098631A /* BigString+Chunk+UnicodeScalar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D9748D12E9748930098631A /* BigString+Chunk+UnicodeScalar.swift */; }; 7D9748D62E9748930098631A /* BigString+Chunk+Character.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D9748CF2E9748930098631A /* BigString+Chunk+Character.swift */; }; @@ -189,7 +197,6 @@ 7DA23F5A2F32C68300E4C03A /* RigidArray+Hashable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DA23F592F32C67D00E4C03A /* RigidArray+Hashable.swift */; }; 7DA23F5C2F32C69100E4C03A /* RigidArray+Descriptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DA23F5B2F32C68B00E4C03A /* RigidArray+Descriptions.swift */; }; 7DA296012FB79DC5005042B0 /* CollectionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DA295FF2FB79DC5005042B0 /* CollectionsTests.swift */; }; - 7DACFA122F75FBF100291F2E /* SpanIterator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DACFA112F75FBF100291F2E /* SpanIterator.swift */; }; 7DAD899E2E8B09C300DD5786 /* UInt+first and last set bit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DAD899C2E8B09C300DD5786 /* UInt+first and last set bit.swift */; }; 7DAD899F2E8B09C300DD5786 /* UInt+reversed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DAD899D2E8B09C300DD5786 /* UInt+reversed.swift */; }; 7DAD89A02E8B09C300DD5786 /* FixedWidthInteger+roundUpToPowerOfTwo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DAD899A2E8B09C300DD5786 /* FixedWidthInteger+roundUpToPowerOfTwo.swift */; }; @@ -209,7 +216,6 @@ 7DB257A32F58B1D3007B539F /* UniqueDictionary+Debugging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DB257A22F58B1CC007B539F /* UniqueDictionary+Debugging.swift */; }; 7DC037B72FE3492D00CF0CB8 /* BorrowingIteratorProtocol+Copy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DC037B12FE3492D00CF0CB8 /* BorrowingIteratorProtocol+Copy.swift */; }; 7DC037B82FE3492D00CF0CB8 /* Iterable+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DC037AF2FE3492D00CF0CB8 /* Iterable+Utilities.swift */; }; - 7DC037B92FE3492D00CF0CB8 /* Iterable+Standard Conformances.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DC037AE2FE3492D00CF0CB8 /* Iterable+Standard Conformances.swift */; }; 7DC037BA2FE3492D00CF0CB8 /* BorrowingIteratorProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DC037B02FE3492D00CF0CB8 /* BorrowingIteratorProtocol.swift */; }; 7DC037BB2FE3492D00CF0CB8 /* Iterable+Algorithms.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DC037AD2FE3492D00CF0CB8 /* Iterable+Algorithms.swift */; }; 7DC037BC2FE3492D00CF0CB8 /* BorrowingIteratorProtocol+Filter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DC037B32FE3492D00CF0CB8 /* BorrowingIteratorProtocol+Filter.swift */; }; @@ -619,6 +625,10 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 7D0DC7BE2FFD929500BEE8B2 /* Array+Iterable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Array+Iterable.swift"; sourceTree = ""; }; + 7D0DC7C02FFD92B500BEE8B2 /* InlineArray+Iterable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "InlineArray+Iterable.swift"; sourceTree = ""; }; + 7D0DC7C22FFD987400BEE8B2 /* Range+Iterable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Range+Iterable.swift"; sourceTree = ""; }; + 7D0DC7C42FFD990E00BEE8B2 /* ClosedRange+Iterable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ClosedRange+Iterable.swift"; sourceTree = ""; }; 7D12E33C2FF5CC2A003050AB /* OutputSpan+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OutputSpan+Helpers.swift"; sourceTree = ""; }; 7D12E33E2FF5DADE003050AB /* _HTable+Deprecated.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "_HTable+Deprecated.swift"; sourceTree = ""; }; 7D12E3402FF5DD07003050AB /* RigidSet+Deprecated.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RigidSet+Deprecated.swift"; sourceTree = ""; }; @@ -783,6 +793,10 @@ 7D77E6242FD0F87B003FA63B /* UnsafePointer+Extras.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UnsafePointer+Extras.swift"; sourceTree = ""; }; 7D77E6262FD0F940003FA63B /* UnsafeMutablePointer+Extras.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UnsafeMutablePointer+Extras.swift"; sourceTree = ""; }; 7D945E6A2FF5E0CB001041A6 /* UniqueSet+Deprecations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UniqueSet+Deprecations.swift"; sourceTree = ""; }; + 7D945E6C2FF71D76001041A6 /* Span+Iterable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Span+Iterable.swift"; sourceTree = ""; }; + 7D945E6E2FF71DF8001041A6 /* MutableSpan+Iterable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MutableSpan+Iterable.swift"; sourceTree = ""; }; + 7D945E702FF71E53001041A6 /* OutputSpan+Iterable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OutputSpan+Iterable.swift"; sourceTree = ""; }; + 7D945E722FF71E86001041A6 /* InputSpan+Iterable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "InputSpan+Iterable.swift"; sourceTree = ""; }; 7D9748CF2E9748930098631A /* BigString+Chunk+Character.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BigString+Chunk+Character.swift"; sourceTree = ""; }; 7D9748D02E9748930098631A /* BigString+Chunk+Index.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BigString+Chunk+Index.swift"; sourceTree = ""; }; 7D9748D12E9748930098631A /* BigString+Chunk+UnicodeScalar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BigString+Chunk+UnicodeScalar.swift"; sourceTree = ""; }; @@ -816,7 +830,6 @@ 7DA23F592F32C67D00E4C03A /* RigidArray+Hashable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RigidArray+Hashable.swift"; sourceTree = ""; }; 7DA23F5B2F32C68B00E4C03A /* RigidArray+Descriptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RigidArray+Descriptions.swift"; sourceTree = ""; }; 7DA295FF2FB79DC5005042B0 /* CollectionsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionsTests.swift; sourceTree = ""; }; - 7DACFA112F75FBF100291F2E /* SpanIterator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpanIterator.swift; sourceTree = ""; }; 7DAD899A2E8B09C300DD5786 /* FixedWidthInteger+roundUpToPowerOfTwo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FixedWidthInteger+roundUpToPowerOfTwo.swift"; sourceTree = ""; }; 7DAD899B2E8B09C300DD5786 /* Integer rank.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Integer rank.swift"; sourceTree = ""; }; 7DAD899C2E8B09C300DD5786 /* UInt+first and last set bit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UInt+first and last set bit.swift"; sourceTree = ""; }; @@ -836,7 +849,6 @@ 7DB257A22F58B1CC007B539F /* UniqueDictionary+Debugging.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UniqueDictionary+Debugging.swift"; sourceTree = ""; }; 7DC037AC2FE3492D00CF0CB8 /* Iterable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Iterable.swift; sourceTree = ""; }; 7DC037AD2FE3492D00CF0CB8 /* Iterable+Algorithms.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Iterable+Algorithms.swift"; sourceTree = ""; }; - 7DC037AE2FE3492D00CF0CB8 /* Iterable+Standard Conformances.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Iterable+Standard Conformances.swift"; sourceTree = ""; }; 7DC037AF2FE3492D00CF0CB8 /* Iterable+Utilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Iterable+Utilities.swift"; sourceTree = ""; }; 7DC037B02FE3492D00CF0CB8 /* BorrowingIteratorProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BorrowingIteratorProtocol.swift; sourceTree = ""; }; 7DC037B12FE3492D00CF0CB8 /* BorrowingIteratorProtocol+Copy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BorrowingIteratorProtocol+Copy.swift"; sourceTree = ""; }; @@ -1331,7 +1343,6 @@ children = ( 7DC037AC2FE3492D00CF0CB8 /* Iterable.swift */, 7DC037AD2FE3492D00CF0CB8 /* Iterable+Algorithms.swift */, - 7DC037AE2FE3492D00CF0CB8 /* Iterable+Standard Conformances.swift */, 7DC037AF2FE3492D00CF0CB8 /* Iterable+Utilities.swift */, 7DC037B02FE3492D00CF0CB8 /* BorrowingIteratorProtocol.swift */, 7DC037B12FE3492D00CF0CB8 /* BorrowingIteratorProtocol+Copy.swift */, @@ -1363,7 +1374,6 @@ 7D12E33C2FF5CC2A003050AB /* OutputSpan+Helpers.swift */, 7D2A77352F27F1E4005780C7 /* InputSpan.swift */, 7D2A77362F27F1E4005780C7 /* Shared.swift */, - 7DACFA112F75FBF100291F2E /* SpanIterator.swift */, ); path = Types; sourceTree = ""; @@ -1516,9 +1526,17 @@ 7D59D0652FE49C87005B5097 /* Conformances */ = { isa = PBXGroup; children = ( + 7D0DC7BE2FFD929500BEE8B2 /* Array+Iterable.swift */, + 7D0DC7C42FFD990E00BEE8B2 /* ClosedRange+Iterable.swift */, + 7D0DC7C02FFD92B500BEE8B2 /* InlineArray+Iterable.swift */, + 7D945E722FF71E86001041A6 /* InputSpan+Iterable.swift */, 7D59D0612FE49C87005B5097 /* InputSpan+Container.swift */, + 7D945E6E2FF71DF8001041A6 /* MutableSpan+Iterable.swift */, 7D59D0622FE49C87005B5097 /* MutableSpan+Container.swift */, + 7D945E702FF71E53001041A6 /* OutputSpan+Iterable.swift */, 7D59D0632FE49C87005B5097 /* OutputSpan+Container.swift */, + 7D0DC7C22FFD987400BEE8B2 /* Range+Iterable.swift */, + 7D945E6C2FF71D76001041A6 /* Span+Iterable.swift */, 7D59D0642FE49C87005B5097 /* Span+Container.swift */, ); path = Conformances; @@ -2677,7 +2695,6 @@ 7DE9203C29CA70F3004483EB /* OrderedSet+Partial SetAlgebra formSymmetricDifference.swift in Sources */, 7DC037B72FE3492D00CF0CB8 /* BorrowingIteratorProtocol+Copy.swift in Sources */, 7DC037B82FE3492D00CF0CB8 /* Iterable+Utilities.swift in Sources */, - 7DC037B92FE3492D00CF0CB8 /* Iterable+Standard Conformances.swift in Sources */, 7DC037BA2FE3492D00CF0CB8 /* BorrowingIteratorProtocol.swift in Sources */, 7DC037BB2FE3492D00CF0CB8 /* Iterable+Algorithms.swift in Sources */, 7DC037BC2FE3492D00CF0CB8 /* BorrowingIteratorProtocol+Filter.swift in Sources */, @@ -2697,6 +2714,7 @@ 7D2A777F2F27F2BF005780C7 /* RigidDeque+Container.swift in Sources */, 7D2A77802F27F2BF005780C7 /* Deque.swift in Sources */, 7D2A77812F27F2BF005780C7 /* UniqueDeque+Append.swift in Sources */, + 7D945E712FF71E58001041A6 /* OutputSpan+Iterable.swift in Sources */, 7D2A77822F27F2BF005780C7 /* UniqueDeque+Initializers.swift in Sources */, 7D2A77832F27F2BF005780C7 /* Deque+Equatable.swift in Sources */, 7D2A77842F27F2BF005780C7 /* UniqueDeque+Container.swift in Sources */, @@ -2814,7 +2832,6 @@ 7DE9209A29CA70F4004483EB /* Rope+Append.swift in Sources */, 7DE9203F29CA70F3004483EB /* OrderedSet+Partial SetAlgebra isDisjoint.swift in Sources */, 7DC85F8D2F3FDC91004A4E3D /* String+Padding.swift in Sources */, - 7DACFA122F75FBF100291F2E /* SpanIterator.swift in Sources */, 7DE9208629CA70F4004483EB /* BigString+LosslessStringConvertible.swift in Sources */, 7DE9204329CA70F3004483EB /* _HashTable+Bucket.swift in Sources */, 7DE9216A29CA70F4004483EB /* TreeDictionary.swift in Sources */, @@ -2837,6 +2854,7 @@ 7D479CE72F47D88600A8CB59 /* _HTable+Consumption.swift in Sources */, 7DE9202B29CA70F3004483EB /* OrderedSet+Equatable.swift in Sources */, 7D479CC52F46D20B00A8CB59 /* UniqueSet+Consumption.swift in Sources */, + 7D0DC7BF2FFD929900BEE8B2 /* Array+Iterable.swift in Sources */, 7DE920EA29CA70F4004483EB /* BitArray.swift in Sources */, 7DE920CB29CA70F4004483EB /* BitSet+Random.swift in Sources */, 7DE9201629CA70F3004483EB /* OrderedDictionary+Elements.swift in Sources */, @@ -2965,6 +2983,7 @@ 7DE920A329CA70F4004483EB /* Rope+Index.swift in Sources */, 7DA23F462F329A2300E4C03A /* RigidArray+Experimental.swift in Sources */, 7DA23F472F329A2300E4C03A /* UniqueArray.swift in Sources */, + 7D945E732FF71E8C001041A6 /* InputSpan+Iterable.swift in Sources */, 7DFA40842FD3A98D00CD20C1 /* OrderedSet+Move.swift in Sources */, 7DA23F482F329A2300E4C03A /* RigidArray+Replacements.swift in Sources */, 7DA23F492F329A2300E4C03A /* RigidArray+Container.swift in Sources */, @@ -3048,6 +3067,7 @@ 7DE9202729CA70F3004483EB /* OrderedSet+Insertions.swift in Sources */, 7D479CD42F46DD9600A8CB59 /* UniqueSet+Initializers.swift in Sources */, 7DE9208729CA70F4004483EB /* BigString+Sequence.swift in Sources */, + 7D0DC7C32FFD987800BEE8B2 /* Range+Iterable.swift in Sources */, 7DE9202229CA70F3004483EB /* OrderedSet+Diffing.swift in Sources */, 7DE920CA29CA70F4004483EB /* BitSet+CustomStringConvertible.swift in Sources */, 7DEB31622F4F98D700F9AF28 /* RigidDictionary+Indices.swift in Sources */, @@ -3078,6 +3098,7 @@ 7DE9201829CA70F3004483EB /* OrderedDictionary+Invariants.swift in Sources */, 7DE920CD29CA70F4004483EB /* BitSet+CustomDebugStringConvertible.swift in Sources */, 7DE9212529CA70F4004483EB /* TreeSet+SetAlgebra isStrictSubset.swift in Sources */, + 7D945E6F2FF71DFF001041A6 /* MutableSpan+Iterable.swift in Sources */, 7DE9209229CA70F4004483EB /* Rope+_Storage.swift in Sources */, 7DE9203929CA70F3004483EB /* OrderedSet+Partial RangeReplaceableCollection.swift in Sources */, 7DE9206329CA70F4004483EB /* BigString+Contents.swift in Sources */, @@ -3135,6 +3156,7 @@ 7DE920E029CA70F4004483EB /* Range+Utilities.swift in Sources */, 7DE920D929CA70F4004483EB /* BitSet+SetAlgebra intersection.swift in Sources */, 7DE920DD29CA70F4004483EB /* BitSet+SetAlgebra isStrictSubset.swift in Sources */, + 7D0DC7C52FFD990E00BEE8B2 /* ClosedRange+Iterable.swift in Sources */, 7DE920F229CA70F4004483EB /* BitArray._UnsafeHandle.swift in Sources */, 7D479CEB2F47F3C100A8CB59 /* UniqueDictionary+Resizing.swift in Sources */, 7DE9204229CA70F3004483EB /* _HashTable+UnsafeHandle.swift in Sources */, @@ -3144,11 +3166,13 @@ 7D77E6122FCF810E003FA63B /* CountedProducer.swift in Sources */, 7DE920E829CA70F4004483EB /* BitArray+BitwiseOperations.swift in Sources */, 7DE9207829CA70F4004483EB /* BigString+Append.swift in Sources */, + 7D0DC7C12FFD92BB00BEE8B2 /* InlineArray+Iterable.swift in Sources */, 7DE9217F29CA70F4004483EB /* _HeapNode.swift in Sources */, 7D479CB92F46A6DB00A8CB59 /* RigidSet+Debugging.swift in Sources */, 7DE9202929CA70F3004483EB /* OrderedSet+Codable.swift in Sources */, 7DE9204829CA70F3004483EB /* _HashTable+CustomStringConvertible.swift in Sources */, 7D479CE52F47D74500A8CB59 /* RigidDictionary+Resizing.swift in Sources */, + 7D945E6D2FF71D76001041A6 /* Span+Iterable.swift in Sources */, 7DE9213029CA70F4004483EB /* TreeSet+SetAlgebra isSuperset.swift in Sources */, 7DE9217529CA70F4004483EB /* TreeDictionary+MapValues.swift in Sources */, 7DE9206C29CA70F4004483EB /* BigString+Chunk.swift in Sources */,