From 85cdb77d25c306d82118800de157c69f36f5a113 Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Wed, 17 Jun 2026 16:17:36 -0700 Subject: [PATCH] Fix build issues --- .../RigidArray/RigidArray+Insertions.swift | 6 +- .../RigidArray/RigidArray+Replacements.swift | 6 +- .../RigidDictionary+Indices.swift | 8 +- .../RigidDictionary+Insertions.swift | 5 +- .../RigidDictionary+Lookup.swift | 9 +- .../RigidSet/RigidSet+Initializers.swift | 7 +- .../RigidSet/RigidSet+Insertions.swift | 14 +-- .../RigidSet/RigidSet+Lookup.swift | 1 + .../UniqueArray/UniqueArray+Insertions.swift | 4 +- .../UniqueArray+Replacements.swift | 4 +- .../UniqueDictionary+Indices.swift | 2 +- .../UniqueDictionary+Insertions.swift | 5 +- .../UniqueDictionary+Lookup.swift | 3 +- .../UniqueSet/UniqueSet+Initializers.swift | 7 +- .../UniqueSet/UniqueSet+Insertions.swift | 13 +-- .../Protocols/Container/Container.swift | 2 +- .../Container/RangeReplaceableContainer.swift | 1 + .../Protocols/Iterable+Algorithms.swift | 26 +++--- .../Protocols/Iterable+Utilities.swift | 2 +- .../Protocols/Iterable.swift | 16 ++-- ...erableIteratorProtocol+ElementsEqual.swift | 26 +++--- .../IterableIteratorProtocol+Filter.swift | 6 +- .../IterableIteratorProtocol+Reduce.swift | 8 +- ...IterableIteratorProtocol+SpanwiseZip.swift | 6 +- .../Protocols/IterableIteratorProtocol.swift | 18 ++-- .../RigidDeque/RigidDeque+Insertions.swift | 6 +- .../RigidDeque/RigidDeque+Prepend.swift | 6 +- .../RigidDeque/RigidDeque+Replacements.swift | 6 +- .../UniqueDeque/UniqueDeque+Insertions.swift | 6 +- .../UniqueDeque/UniqueDeque+Prepend.swift | 6 +- .../UniqueDeque+Replacements.swift | 6 +- .../RigidDictionaryTests.swift | 89 +++++++++---------- .../UniqueDictionaryTests.swift | 2 +- .../BorrowingSequenceTests.swift | 4 +- .../Assertions+Containers.swift | 6 +- .../ConformanceCheckers/CheckContainer.swift | 6 +- 36 files changed, 175 insertions(+), 173 deletions(-) diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Insertions.swift b/Sources/BasicContainers/RigidArray/RigidArray+Insertions.swift index d81d8c4d..82b7da61 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Insertions.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Insertions.swift @@ -414,7 +414,7 @@ extension RigidArray { at index: Int, copying items: borrowing C, newCount: Int - ) where C.Failure == Never { + ) { var it = items.makeIterableIterator_() insert(addingCount: newCount, at: index) { target in while !target.isFull { @@ -479,7 +479,7 @@ extension RigidArray { C: Container & ~Copyable & ~Escapable >( copying newElements: borrowing C, at index: Int - ) where C.Failure == Never { + ) { _insertContainer( at: index, copying: newElements, newCount: newElements.count) } @@ -539,7 +539,7 @@ extension RigidArray { C: Container & Collection >( copying newElements: borrowing C, at index: Int - ) where C.Failure == Never { + ) { _insertContainer( at: index, copying: newElements, newCount: newElements.count) } diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Replacements.swift b/Sources/BasicContainers/RigidArray/RigidArray+Replacements.swift index c3bfd183..0d332c7a 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Replacements.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Replacements.swift @@ -590,7 +590,7 @@ extension RigidArray { removing subrange: Range, copyingContainer items: borrowing C, newCount: Int - ) where C.Failure == Never { + ) { var it = items.makeIterableIterator_() self.replace(removing: subrange, addingCount: newCount) { target in while !target.isFull { @@ -668,7 +668,7 @@ extension RigidArray { >( removing subrange: Range, copying newElements: borrowing C - ) where C.Failure == Never { + ) { _replace( removing: subrange, copyingContainer: newElements, @@ -749,7 +749,7 @@ extension RigidArray { >( removing subrange: Range, copying newElements: C - ) where C.Failure == Never { + ) { _replace( removing: subrange, copyingContainer: newElements, diff --git a/Sources/BasicContainers/RigidDictionary/RigidDictionary+Indices.swift b/Sources/BasicContainers/RigidDictionary/RigidDictionary+Indices.swift index afdcceef..198e3606 100644 --- a/Sources/BasicContainers/RigidDictionary/RigidDictionary+Indices.swift +++ b/Sources/BasicContainers/RigidDictionary/RigidDictionary+Indices.swift @@ -15,10 +15,11 @@ import ContainersPreview #endif -#if compiler(>=6.4) && UnstableHashedContainers && UnstableContainersPreview +#if compiler(>=6.4) && UnstableHashedContainers @available(SwiftStdlib 6.2, *) extension RigidDictionary where Key: ~Copyable, Value: ~Copyable { + @available(SwiftStdlib 6.4, *) @frozen public struct Indices: ~Escapable { @_alwaysEmitIntoClient @@ -31,6 +32,7 @@ extension RigidDictionary where Key: ~Copyable, Value: ~Copyable { } } + @available(SwiftStdlib 6.4, *) @inlinable public var indices: Indices { @_lifetime(borrow self) @@ -40,7 +42,7 @@ extension RigidDictionary where Key: ~Copyable, Value: ~Copyable { } } -@available(SwiftStdlib 6.2, *) +@available(SwiftStdlib 6.4, *) extension RigidDictionary.Indices: Iterable_ where Key: ~Copyable, Value: ~Copyable { @@ -79,7 +81,7 @@ where Key: ~Copyable, Value: ~Copyable } } -@available(SwiftStdlib 6.2, *) +@available(SwiftStdlib 6.4, *) extension RigidDictionary.Indices.IterableIterator_: IterableIteratorProtocol_ where Key: ~Copyable, Value: ~Copyable { public typealias Element_ = Element diff --git a/Sources/BasicContainers/RigidDictionary/RigidDictionary+Insertions.swift b/Sources/BasicContainers/RigidDictionary/RigidDictionary+Insertions.swift index d61f51e2..d02c0dc9 100644 --- a/Sources/BasicContainers/RigidDictionary/RigidDictionary+Insertions.swift +++ b/Sources/BasicContainers/RigidDictionary/RigidDictionary+Insertions.swift @@ -96,7 +96,7 @@ extension RigidDictionary where Key: ~Copyable, Value: ~Copyable { return nil } -#if UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @inlinable @discardableResult @_lifetime(&self) @@ -114,8 +114,7 @@ extension RigidDictionary where Key: ~Copyable, Value: ~Copyable { } return _borrowValue(at: bucket) } -#endif - + @inlinable @discardableResult public mutating func updateValue( diff --git a/Sources/BasicContainers/RigidDictionary/RigidDictionary+Lookup.swift b/Sources/BasicContainers/RigidDictionary/RigidDictionary+Lookup.swift index de352579..78a3cc73 100644 --- a/Sources/BasicContainers/RigidDictionary/RigidDictionary+Lookup.swift +++ b/Sources/BasicContainers/RigidDictionary/RigidDictionary+Lookup.swift @@ -31,8 +31,8 @@ extension RigidDictionary where Key: ~Copyable, Value: ~Copyable { public func containsKey(_ key: borrowing Key) -> Bool { _find(key).bucket != nil } - -#if UnstableContainersPreview + + @available(SwiftStdlib 6.4, *) @inlinable @_lifetime(borrow self) public func value( @@ -41,7 +41,6 @@ extension RigidDictionary where Key: ~Copyable, Value: ~Copyable { guard let bucket = self._find(key).bucket else { return nil } return Ref(unsafeAddress: _valuePtr(at: bucket), borrowing: self) } -#endif /// A stand-in for a `struct Ref`-returning lookup operation. /// This is quite clumsy to use, but this is the best we can do without a way @@ -56,7 +55,7 @@ extension RigidDictionary where Key: ~Copyable, Value: ~Copyable { return try body(_valueBuf[bucket]) } -#if UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @_lifetime(borrow self) package func _borrowKey(at bucket: _Bucket) -> Ref { @@ -64,13 +63,13 @@ extension RigidDictionary where Key: ~Copyable, Value: ~Copyable { return Ref(unsafeAddress: _keyPtr(at: bucket), borrowing: self) } + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @_lifetime(borrow self) package func _borrowValue(at bucket: _Bucket) -> Ref { assert(_keys._table.isOccupied(bucket)) return Ref(unsafeAddress: _valuePtr(at: bucket), borrowing: self) } -#endif } #endif diff --git a/Sources/BasicContainers/RigidSet/RigidSet+Initializers.swift b/Sources/BasicContainers/RigidSet/RigidSet+Initializers.swift index b594b01e..44b79943 100644 --- a/Sources/BasicContainers/RigidSet/RigidSet+Initializers.swift +++ b/Sources/BasicContainers/RigidSet/RigidSet+Initializers.swift @@ -85,13 +85,14 @@ extension RigidSet /* where Element: Copyable */ { @_alwaysEmitIntoClient @inline(__always) public init< - S: Iterable_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >( capacity: Int, copying contents: borrowing S - ) { + ) throws(S.Failure_) + where S.Element_ == Element { self.init(capacity: capacity) - self._insert(copying: contents) + try self._insert(copying: contents) } #endif diff --git a/Sources/BasicContainers/RigidSet/RigidSet+Insertions.swift b/Sources/BasicContainers/RigidSet/RigidSet+Insertions.swift index b77317f8..19e74909 100644 --- a/Sources/BasicContainers/RigidSet/RigidSet+Insertions.swift +++ b/Sources/BasicContainers/RigidSet/RigidSet+Insertions.swift @@ -223,13 +223,14 @@ extension RigidSet /* where Element: Copyable */ { #if UnstableContainersPreview @_alwaysEmitIntoClient package mutating func _insert< - S: Iterable_ & ~Copyable & ~Escapable + Failure: Error, + S: Iterable_ & ~Copyable & ~Escapable >( copying items: borrowing S - ) { + ) throws(S.Failure_) { var it = items.makeIterableIterator_() while true { - let span = it.nextSpan_() + let span = try it.nextSpan_() guard !span.isEmpty else { break } self.insert(copying: span) } @@ -240,11 +241,12 @@ extension RigidSet /* where Element: Copyable */ { @_alwaysEmitIntoClient @inline(__always) public mutating func insert< - S: Iterable_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >( copying items: borrowing S - ) { - _insert(copying: items) + ) throws(S.Failure_) + where S.Element_ == Element { + try _insert(copying: items) } #endif diff --git a/Sources/BasicContainers/RigidSet/RigidSet+Lookup.swift b/Sources/BasicContainers/RigidSet/RigidSet+Lookup.swift index 8ca866fa..3aac63d8 100644 --- a/Sources/BasicContainers/RigidSet/RigidSet+Lookup.swift +++ b/Sources/BasicContainers/RigidSet/RigidSet+Lookup.swift @@ -41,6 +41,7 @@ extension RigidSet where Element: ~Copyable { } #if UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @_lifetime(borrow self) package func _borrowValue(at bucket: _Bucket) -> Ref { diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Insertions.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Insertions.swift index 55c28179..83d19688 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Insertions.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Insertions.swift @@ -396,7 +396,7 @@ extension UniqueArray { C: Container & ~Copyable & ~Escapable >( copying newElements: borrowing C, at index: Int - ) where C.Failure == Never { + ) { // FIXME: Avoid moving the subsequent elements twice. let c = newElements.count _ensureFreeCapacity(c) @@ -463,7 +463,7 @@ extension UniqueArray { C: Container & Collection >( copying newElements: borrowing C, at index: Int - ) where C.Failure == Never { + ) { // FIXME: Avoid moving the subsequent elements twice. let c = newElements.count _ensureFreeCapacity(c) diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Replacements.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Replacements.swift index c12e5306..2b6c91b5 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Replacements.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Replacements.swift @@ -558,7 +558,7 @@ extension UniqueArray { >( removing subrange: Range, copying newElements: borrowing C - ) where C.Failure == Never { + ) { // FIXME: Avoid moving the subsequent elements twice. let c = newElements.count _ensureFreeCapacity(c - subrange.count) @@ -648,7 +648,7 @@ extension UniqueArray { >( removing subrange: Range, copying newElements: borrowing C - ) where C.Failure == Never { + ) { // FIXME: Avoid moving the subsequent elements twice. let c = newElements.count _ensureFreeCapacity(c - subrange.count) diff --git a/Sources/BasicContainers/UniqueDictionary/UniqueDictionary+Indices.swift b/Sources/BasicContainers/UniqueDictionary/UniqueDictionary+Indices.swift index 05af329e..075858b2 100644 --- a/Sources/BasicContainers/UniqueDictionary/UniqueDictionary+Indices.swift +++ b/Sources/BasicContainers/UniqueDictionary/UniqueDictionary+Indices.swift @@ -13,7 +13,7 @@ #if compiler(>=6.4) && UnstableHashedContainers && UnstableContainersPreview -@available(SwiftStdlib 6.2, *) +@available(SwiftStdlib 6.4, *) extension UniqueDictionary where Key: ~Copyable, Value: ~Copyable { public typealias Indices = RigidDictionary.Indices diff --git a/Sources/BasicContainers/UniqueDictionary/UniqueDictionary+Insertions.swift b/Sources/BasicContainers/UniqueDictionary/UniqueDictionary+Insertions.swift index c0e1c7fa..35d1433f 100644 --- a/Sources/BasicContainers/UniqueDictionary/UniqueDictionary+Insertions.swift +++ b/Sources/BasicContainers/UniqueDictionary/UniqueDictionary+Insertions.swift @@ -52,8 +52,8 @@ extension UniqueDictionary where Key: ~Copyable, Value: ~Copyable { _storage._insertNew(key, hashValue: hashValue, value) return nil } - -#if UnstableContainersPreview + + @available(SwiftStdlib 6.4, *) @inlinable @discardableResult @_lifetime(&self) @@ -75,7 +75,6 @@ extension UniqueDictionary where Key: ~Copyable, Value: ~Copyable { } return _storage._borrowValue(at: bucket) } -#endif @inlinable @discardableResult diff --git a/Sources/BasicContainers/UniqueDictionary/UniqueDictionary+Lookup.swift b/Sources/BasicContainers/UniqueDictionary/UniqueDictionary+Lookup.swift index 044b65d0..fbdecf4b 100644 --- a/Sources/BasicContainers/UniqueDictionary/UniqueDictionary+Lookup.swift +++ b/Sources/BasicContainers/UniqueDictionary/UniqueDictionary+Lookup.swift @@ -24,7 +24,7 @@ extension UniqueDictionary where Key: ~Copyable, Value: ~Copyable { _storage.containsKey(key) } -#if UnstableContainersPreview + @available(SwiftStdlib 6.4, *) @inlinable @_lifetime(borrow self) public func value( @@ -33,7 +33,6 @@ extension UniqueDictionary where Key: ~Copyable, Value: ~Copyable { // FIXME: Why is this override necessary? Is it sound? It was triggered by RigidDictionary becoming `@_addressableForDependencies`. _overrideLifetime(_storage.value(forKey: key), borrowing: self) } -#endif /// A stand-in for a `struct Ref`-returning lookup operation. /// This is quite clumsy to use, but this is the best we can do without a way diff --git a/Sources/BasicContainers/UniqueSet/UniqueSet+Initializers.swift b/Sources/BasicContainers/UniqueSet/UniqueSet+Initializers.swift index 99122caa..98c9b46b 100644 --- a/Sources/BasicContainers/UniqueSet/UniqueSet+Initializers.swift +++ b/Sources/BasicContainers/UniqueSet/UniqueSet+Initializers.swift @@ -77,12 +77,13 @@ extension UniqueSet where Element: Copyable { #if UnstableContainersPreview @_alwaysEmitIntoClient public init< - S: Iterable_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >( copying items: borrowing S - ) { + ) throws(S.Failure_) + where S.Element_ == Element { self.init() - self.insert(copying: items) + try self.insert(copying: items) } #endif diff --git a/Sources/BasicContainers/UniqueSet/UniqueSet+Insertions.swift b/Sources/BasicContainers/UniqueSet/UniqueSet+Insertions.swift index 64a4e2d9..ad7857f7 100644 --- a/Sources/BasicContainers/UniqueSet/UniqueSet+Insertions.swift +++ b/Sources/BasicContainers/UniqueSet/UniqueSet+Insertions.swift @@ -132,14 +132,15 @@ extension UniqueSet /* where Element: Copyable */ { #if UnstableContainersPreview @_alwaysEmitIntoClient package mutating func _insert< - S: Iterable_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >( copying items: borrowing S - ) { + ) throws(S.Failure_) + where S.Element_ == Element { _ensureFreeCapacity(items.underestimatedCount_) var it = items.makeIterableIterator_() while true { - let span = it.nextSpan_() + let span = try it.nextSpan_() guard !span.isEmpty else { break } self.insert(copying: span) } @@ -150,11 +151,11 @@ extension UniqueSet /* where Element: Copyable */ { @_alwaysEmitIntoClient @inline(__always) public mutating func insert< - S: Iterable_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >( copying items: borrowing S - ) { - _insert(copying: items) + ) throws(S.Failure_) where S.Element_ == Element { + try _insert(copying: items) } #endif diff --git a/Sources/ContainersPreview/Protocols/Container/Container.swift b/Sources/ContainersPreview/Protocols/Container/Container.swift index 59ad3e2c..199aa591 100644 --- a/Sources/ContainersPreview/Protocols/Container/Container.swift +++ b/Sources/ContainersPreview/Protocols/Container/Container.swift @@ -16,7 +16,7 @@ @available(SwiftStdlib 5.0, *) public protocol Container: Iterable_, ~Copyable, ~Escapable - where Element: ~Copyable, Element == Element_ //, Failure == Never + where Element: ~Copyable, Element == Element_, Failure_ == Never { associatedtype Element: ~Copyable associatedtype Index: Equatable diff --git a/Sources/ContainersPreview/Protocols/Container/RangeReplaceableContainer.swift b/Sources/ContainersPreview/Protocols/Container/RangeReplaceableContainer.swift index 53a3792d..b6908449 100644 --- a/Sources/ContainersPreview/Protocols/Container/RangeReplaceableContainer.swift +++ b/Sources/ContainersPreview/Protocols/Container/RangeReplaceableContainer.swift @@ -427,6 +427,7 @@ where @inlinable public mutating func append< + Failure: Error, S: Iterable_ & ~Copyable & ~Escapable >( copying items: borrowing S diff --git a/Sources/ContainersPreview/Protocols/Iterable+Algorithms.swift b/Sources/ContainersPreview/Protocols/Iterable+Algorithms.swift index 51c47b74..96b7f807 100644 --- a/Sources/ContainersPreview/Protocols/Iterable+Algorithms.swift +++ b/Sources/ContainersPreview/Protocols/Iterable+Algorithms.swift @@ -21,8 +21,8 @@ extension Iterable_ public func reduce( _ initialResult: consuming Result, _ nextPartialResult: - (_ partialResult: consuming Result, borrowing Element_) throws(Failure) -> Result - ) throws(Failure) -> Result { + (_ partialResult: consuming Result, borrowing Element_) throws(Failure_) -> Result + ) throws(Failure_) -> Result { try makeIterableIterator_().reduce(initialResult, nextPartialResult) } @@ -30,8 +30,8 @@ extension Iterable_ public func reduce( into initialResult: consuming Result, _ updateAccumulatingResult: - (_ partialResult: inout Result, borrowing Element_) throws(Failure) -> () - ) throws(Failure) -> Result { + (_ partialResult: inout Result, borrowing Element_) throws(Failure_) -> () + ) throws(Failure_) -> Result { try makeIterableIterator_().reduce(into: initialResult, updateAccumulatingResult) } } @@ -42,8 +42,8 @@ extension Sequence where Self: Iterable_ { public func reduce( _ initialResult: consuming Result, _ nextPartialResult: - (_ partialResult: consuming Result, borrowing Element_) throws(Failure) -> Result - ) throws(Failure) -> Result { + (_ partialResult: consuming Result, borrowing Element_) throws(Failure_) -> Result + ) throws(Failure_) -> Result { try makeIterableIterator_().reduce(initialResult, nextPartialResult) } @@ -51,8 +51,8 @@ extension Sequence where Self: Iterable_ { public func reduce( into initialResult: consuming Result, _ updateAccumulatingResult: - (_ partialResult: inout Result, borrowing Element_) throws(Failure) -> () - ) throws(Failure) -> Result { + (_ partialResult: inout Result, borrowing Element_) throws(Failure_) -> () + ) throws(Failure_) -> Result { try makeIterableIterator_().reduce(into: initialResult, updateAccumulatingResult) } } @@ -64,9 +64,9 @@ extension Iterable_ @inlinable public func elementsEqual( _ other: borrowing OtherSequence, - by areEquivalent: (borrowing Element_, borrowing OtherSequence.Element_) throws(Failure) -> Bool - ) throws(Failure) -> Bool - where OtherSequence: ~Copyable & ~Escapable, OtherSequence.Element_: ~Copyable, OtherSequence.Failure == Failure + by areEquivalent: (borrowing Element_, borrowing OtherSequence.Element_) throws(Failure_) -> Bool + ) throws(Failure_) -> Bool + where OtherSequence: ~Copyable & ~Escapable, OtherSequence.Element_: ~Copyable, OtherSequence.Failure_ == Failure_ { // FIXME: Forward to the iterator's implementation of same var iter1 = makeIterableIterator_() @@ -96,9 +96,9 @@ extension Iterable_ extension Iterable_ where Self: ~Copyable & ~Escapable, Element_: ~Copyable & Equatable { @inlinable - public func elementsEqual>( + public func elementsEqual>( _ other: borrowing OtherSequence - ) throws(Failure) -> Bool + ) throws(Failure_) -> Bool where OtherSequence: ~Copyable & ~Escapable, OtherSequence.Element_: ~Copyable diff --git a/Sources/ContainersPreview/Protocols/Iterable+Utilities.swift b/Sources/ContainersPreview/Protocols/Iterable+Utilities.swift index 0e573b7c..c6734a32 100644 --- a/Sources/ContainersPreview/Protocols/Iterable+Utilities.swift +++ b/Sources/ContainersPreview/Protocols/Iterable+Utilities.swift @@ -22,7 +22,7 @@ extension Iterable_ where Self: ~Copyable & ~Escapable, Element_: Copyable { @inlinable package func _copyContents( intoPrefixOf buffer: UnsafeMutableBufferPointer - ) throws(Failure) -> Int { + ) throws(Failure_) -> Int { var target = buffer var it = self.makeIterableIterator_() while target.count != 0 { diff --git a/Sources/ContainersPreview/Protocols/Iterable.swift b/Sources/ContainersPreview/Protocols/Iterable.swift index 8af99599..359239fd 100644 --- a/Sources/ContainersPreview/Protocols/Iterable.swift +++ b/Sources/ContainersPreview/Protocols/Iterable.swift @@ -14,12 +14,12 @@ #if compiler(>=6.4) && UnstableContainersPreview @available(SwiftStdlib 5.0, *) -public protocol Iterable_: ~Copyable, ~Escapable { - associatedtype Element_: ~Copyable & ~Escapable - associatedtype Failure: Error = Never - - associatedtype IterableIterator_: IterableIteratorProtocol_ & ~Copyable & ~Escapable - +public protocol Iterable_: ~Copyable, ~Escapable { + associatedtype Element_: ~Copyable + associatedtype Failure_: Error = Never + + associatedtype IterableIterator_: IterableIteratorProtocol_ & ~Copyable & ~Escapable + var underestimatedCount_: Int { get } @_lifetime(borrow self) @@ -61,8 +61,8 @@ where /// Implementation demo of what borrowing for-in loops would need to expand into. @inlinable public func _borrowingForEach( - _ body: (borrowing Element_) throws(Failure) -> Void - ) throws(Failure) -> Void { + _ body: (borrowing Element_) throws(Failure_) -> Void + ) throws(Failure_) -> Void { var it = makeIterableIterator_() while true { let span = try it.nextSpan_() diff --git a/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+ElementsEqual.swift b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+ElementsEqual.swift index 0438cd81..32d14064 100644 --- a/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+ElementsEqual.swift +++ b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+ElementsEqual.swift @@ -25,10 +25,10 @@ where { @inlinable package func _elementsEqual< - Other: Iterable_ & ~Copyable & ~Escapable + Other: Iterable_ & ~Copyable & ~Escapable >( _ other: borrowing Other, - ) throws(Failure) -> Bool + ) throws(Failure_) -> Bool where Other.Element_: ~Copyable { let it1 = self.makeIterableIterator_() @@ -69,9 +69,9 @@ where Other: Iterable_ & ~Copyable & ~Escapable >( _ other: borrowing Other, - by areEquivalent: (borrowing Element_, borrowing Other.Element_) throws(Failure) -> Bool - ) throws(Failure) -> Bool - where Other.Element_: ~Copyable, Other.Failure == Failure + by areEquivalent: (borrowing Element_, borrowing Other.Element_) throws(Failure_) -> Bool + ) throws(Failure_) -> Bool + where Other.Element_: ~Copyable, Other.Failure_ == Failure_ { let it1 = self.makeIterableIterator_() let it2 = other.makeIterableIterator_() @@ -87,10 +87,10 @@ where { @inlinable package consuming func elementsEqual< - Other: IterableIteratorProtocol_ & ~Copyable & ~Escapable + Other: IterableIteratorProtocol_ & ~Copyable & ~Escapable >( _ other: consuming Other, - ) throws(Failure) -> Bool + ) throws(Failure_) -> Bool where Other.Element_: ~Copyable { var result = true @@ -113,10 +113,10 @@ where @inlinable package consuming func _directElementsEqual< - Other: IterableIteratorProtocol_ & ~Copyable & ~Escapable + Other: IterableIteratorProtocol_ & ~Copyable & ~Escapable >( _ other: consuming Other, - ) throws(Failure) -> Bool + ) throws(Failure_) -> Bool where Other.Element_: ~Copyable { #if true // FIXME: rdar://150228920 Exclusive access scopes aren't expanded enough @@ -184,12 +184,12 @@ where Other: IterableIteratorProtocol_ & ~Copyable & ~Escapable >( _ other: consuming Other, - by areEquivalent: (borrowing Element_, borrowing Other.Element_) throws(Failure) -> Bool - ) throws(Failure) -> Bool - where Other.Element_: ~Copyable, Other.Failure == Failure + by areEquivalent: (borrowing Element_, borrowing Other.Element_) throws(Failure_) -> Bool + ) throws(Failure_) -> Bool + where Other.Element_: ~Copyable, Other.Failure_ == Failure_ { var result = true - try _spanwiseZip(state: &result, with: other) { state, a, b throws(Failure) in + try _spanwiseZip(state: &result, with: other) { state, a, b throws(Failure_) in assert(a.count == b.count || a.isEmpty || b.isEmpty) if a.isEmpty || b.isEmpty { state = false diff --git a/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+Filter.swift b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+Filter.swift index 16a22f53..f42c869d 100644 --- a/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+Filter.swift +++ b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+Filter.swift @@ -34,10 +34,10 @@ public struct BorrowingFilter< >: ~Copyable, ~Escapable where Base.Element_: ~Copyable { public typealias Element_ = Base.Element_ - public typealias Failure = Base.Failure - + public typealias Failure = Base.Failure_ + @_alwaysEmitIntoClient - public let _isIncluded: (borrowing Element_) throws(Base.Failure) -> Bool + public let _isIncluded: (borrowing Element_) throws(Failure) -> Bool @_alwaysEmitIntoClient public var _base: Base diff --git a/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+Reduce.swift b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+Reduce.swift index 9272d19c..c6526bb8 100644 --- a/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+Reduce.swift +++ b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+Reduce.swift @@ -22,8 +22,8 @@ where @inlinable public consuming func reduce( _ initialResult: consuming Result, - _ nextPartialResult: (consuming Result, borrowing Element_) throws(Failure) -> Result - ) throws(Failure) -> Result { + _ nextPartialResult: (consuming Result, borrowing Element_) throws(Failure_) -> Result + ) throws(Failure_) -> Result { var result = initialResult while true { let span = try self.nextSpan_() @@ -40,8 +40,8 @@ where @inlinable public consuming func reduce( into initialResult: consuming Result, - _ updateAccumulatingResult: (inout Result, borrowing Element_) throws(Failure) -> Void - ) throws(Failure) -> Result { + _ updateAccumulatingResult: (inout Result, borrowing Element_) throws(Failure_) -> Void + ) throws(Failure_) -> Result { var result = initialResult while true { let span = try self.nextSpan_() diff --git a/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+SpanwiseZip.swift b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+SpanwiseZip.swift index 1b578cae..f84d3ffd 100644 --- a/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+SpanwiseZip.swift +++ b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+SpanwiseZip.swift @@ -30,9 +30,9 @@ where >( state: inout State, with other: consuming Other, - by process: (inout State, Span, Span) throws(Failure) -> Bool - ) throws(Failure) - where Other.Element_: ~Copyable, Other.Failure == Failure + by process: (inout State, Span, Span) throws(Failure_) -> Bool + ) throws(Failure_) + where Other.Element_: ~Copyable, Other.Failure_ == Failure_ { #if true // FIXME: rdar://150228920 Exclusive access scopes aren't expanded enough // Note: This is the less efficient implementation of spanwiseZip. The diff --git a/Sources/ContainersPreview/Protocols/IterableIteratorProtocol.swift b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol.swift index f61d5c28..3cd13d16 100644 --- a/Sources/ContainersPreview/Protocols/IterableIteratorProtocol.swift +++ b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol.swift @@ -18,9 +18,9 @@ import InternalCollectionsUtilities #endif @available(SwiftStdlib 5.0, *) -public protocol IterableIteratorProtocol_: ~Copyable, ~Escapable { - associatedtype Element_: ~Copyable & ~Escapable - associatedtype Failure: Error = Never +public protocol IterableIteratorProtocol_: ~Copyable, ~Escapable { + associatedtype Element_: ~Copyable + associatedtype Failure_: Error = Never /// Advance the iterator, returning an ephemeral span over the elements /// that are ready to be visited. @@ -70,7 +70,7 @@ public protocol IterableIteratorProtocol_: ~Copyable, ~Escapa /// method may vary between different borrows of the same container.) @_lifetime(&self) @_lifetime(self: copy self) - mutating func nextSpan_(maximumCount: Int) throws(Failure) -> Span + mutating func nextSpan_(maximumCount: Int) throws(Failure_) -> Span /// Advance the position of this iterator by the specified offset, or until /// the end of the underlying sequence. @@ -82,7 +82,7 @@ public protocol IterableIteratorProtocol_: ~Copyable, ~Escapa /// /// `maximumOffset` must be nonnegative. @_lifetime(self: copy self) - mutating func skip_(by maximumOffset: Int) throws(Failure) -> Int + mutating func skip_(by maximumOffset: Int) throws(Failure_) -> Int } @available(SwiftStdlib 5.0, *) @@ -91,7 +91,7 @@ where Self: ~Copyable & ~Escapable, Element_: ~Copyable { @_lifetime(&self) @_lifetime(self: copy self) @_transparent - public mutating func nextSpan_() throws(Failure) -> Span { + public mutating func nextSpan_() throws(Failure_) -> Span { try nextSpan_(maximumCount: Int.max) } } @@ -101,7 +101,7 @@ extension IterableIteratorProtocol_ where Self: ~Copyable & ~Escapable, Element_: ~Copyable { @_lifetime(self: copy self) @inlinable - public mutating func skip_(by offset: Int) throws(Failure) -> Int { + public mutating func skip_(by offset: Int) throws(Failure_) -> Int { var remainder = offset while remainder > 0 { let span = try nextSpan_(maximumCount: remainder) @@ -132,8 +132,8 @@ extension IterableIteratorProtocol_ @_lifetime(self: copy self) @inlinable @_transparent - package mutating func _copyContents_(into target: inout OutputSpan) throws(Failure) { - try target.withUnsafeMutableBufferPointer { (dst, dstCount) throws(Failure) -> Void in + package mutating func _copyContents_(into target: inout OutputSpan) throws(Failure_) { + try target.withUnsafeMutableBufferPointer { (dst, dstCount) throws(Failure_) -> Void in var tail = dst._extracting(droppingFirst: dstCount) while !tail.isEmpty { let src = try nextSpan_(maximumCount: tail.count) diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Insertions.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Insertions.swift index 2d351cbe..046e1766 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Insertions.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Insertions.swift @@ -363,7 +363,7 @@ extension RigidDeque /* where Element: Copyable */ { at index: Int, copying items: borrowing C, newCount: Int - ) where C.Failure == Never { + ) { let expectedCount = self.count + newCount var it = items.makeIterableIterator_() insert(addingCount: newCount, at: index) { target in @@ -424,7 +424,7 @@ extension RigidDeque /* where Element: Copyable */ { C: Container & ~Copyable & ~Escapable >( copying items: borrowing C, at index: Int - ) where C.Failure == Never { + ) { _insertContainer( at: index, copying: items, newCount: items.count) } @@ -486,7 +486,7 @@ extension RigidDeque /* where Element: Copyable */ { C: Container & Collection >( copying items: borrowing C, at index: Int - ) where C.Failure == Never { + ) { _insertContainer( at: index, copying: items, newCount: items.count) } diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift index c1c2aa7d..85b53577 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift @@ -352,7 +352,7 @@ extension RigidDeque /*where Element: Copyable*/ { @_alwaysEmitIntoClient public mutating func prepend & ~Copyable & ~Escapable>( copying items: borrowing C - ) where C.Failure == Never { + ) { self._prepend(copying: items, exactCount: items.count) } #endif @@ -471,7 +471,7 @@ extension RigidDeque /*where Element: Copyable*/ { @_alwaysEmitIntoClient public mutating func prepend & Sequence>( copying items: borrowing C - ) where C.Failure == Never { + ) { self._prepend(copying: items, exactCount: items.count) } @@ -487,7 +487,7 @@ extension RigidDeque /*where Element: Copyable*/ { @_alwaysEmitIntoClient public mutating func prepend & Collection>( copying items: borrowing C - ) where C.Failure == Never { + ) { self._prepend(copying: items, exactCount: items.count) } #endif diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Replacements.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Replacements.swift index 1d7e61c4..e9d592a4 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Replacements.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Replacements.swift @@ -463,7 +463,7 @@ extension RigidDeque /* where Element: Copyable */ { removing subrange: Range, copyingContainer items: borrowing C, newCount: Int - ) where C.Failure == Never { + ) { let expectedCount = self.count - subrange.count + newCount var it = items.makeIterableIterator_() @@ -536,7 +536,7 @@ extension RigidDeque /* where Element: Copyable */ { >( removing subrange: Range, copying items: borrowing C - ) where C.Failure == Never { + ) { _replace( removing: subrange, copyingContainer: items, newCount: items.count) } @@ -613,7 +613,7 @@ extension RigidDeque /* where Element: Copyable */ { >( removing subrange: Range, copying items: C - ) where C.Failure == Never { + ) { _replace( removing: subrange, copyingContainer: items, newCount: items.count) } diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Insertions.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Insertions.swift index 2327735c..f7785077 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Insertions.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Insertions.swift @@ -381,7 +381,7 @@ extension UniqueDeque /* where Element: Copyable */ { at index: Int, copying items: borrowing C, newCount: Int - ) where C.Failure == Never { + ) { let expectedCount = self.count + newCount var it = items.makeIterableIterator_() insert(addingCount: newCount, at: index) { target in @@ -445,7 +445,7 @@ extension UniqueDeque /* where Element: Copyable */ { C: Container & ~Copyable & ~Escapable >( copying items: borrowing C, at index: Int - ) where C.Failure == Never { + ) { _insertContainer( at: index, copying: items, newCount: items.count) } @@ -511,7 +511,7 @@ extension UniqueDeque /* where Element: Copyable */ { C: Container & Collection >( copying items: borrowing C, at index: Int - ) where C.Failure == Never { + ) { _insertContainer( at: index, copying: items, newCount: items.count) } diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift index 1f8dd8d2..f4e2a3c6 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift @@ -388,7 +388,7 @@ extension UniqueDeque /*where Element: Copyable*/ { @_alwaysEmitIntoClient public mutating func prepend & ~Copyable & ~Escapable>( copying items: borrowing C - ) where C.Failure == Never { + ) { self._prepend(copying: items, exactCount: items.count) } #endif @@ -518,7 +518,7 @@ extension UniqueDeque /*where Element: Copyable*/ { @_alwaysEmitIntoClient public mutating func prepend & Sequence>( copying items: borrowing C - ) where C.Failure == Never { + ) { self._prepend(copying: items, exactCount: items.count) } @@ -535,7 +535,7 @@ extension UniqueDeque /*where Element: Copyable*/ { @_alwaysEmitIntoClient public mutating func prepend & Collection>( copying items: C - ) where C.Failure == Never { + ) { self._prepend(copying: items, exactCount: items.count) } #endif diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Replacements.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Replacements.swift index a6c5b169..3546a7df 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Replacements.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Replacements.swift @@ -472,7 +472,7 @@ extension UniqueDeque /* where Element: Copyable */ { removing subrange: Range, copyingContainer items: borrowing C, newCount: Int - ) where C.Failure == Never { + ) { let expectedCount = self.count - subrange.count + newCount var it = items.makeIterableIterator_() @@ -546,7 +546,7 @@ extension UniqueDeque /* where Element: Copyable */ { >( removing subrange: Range, copying items: borrowing C - ) where C.Failure == Never { + ) { _replace( removing: subrange, copyingContainer: items, newCount: items.count) } @@ -625,7 +625,7 @@ extension UniqueDeque /* where Element: Copyable */ { >( removing subrange: Range, copying items: C - ) where C.Failure == Never { + ) { _replace( removing: subrange, copyingContainer: items, newCount: items.count) } diff --git a/Tests/BasicContainersTests/RigidDictionaryTests.swift b/Tests/BasicContainersTests/RigidDictionaryTests.swift index 8fd56b54..eee55a12 100644 --- a/Tests/BasicContainersTests/RigidDictionaryTests.swift +++ b/Tests/BasicContainersTests/RigidDictionaryTests.swift @@ -58,17 +58,17 @@ class RigidDictionaryTests: CollectionTestCase { d.insertValue(secondValue, forKey: secondKey), secondValue) -#if UnstableContainersPreview - let thirdKey = tracker.instance(for: 42) - expectNotNil(d.value(forKey: thirdKey)) { valueRef in - expectIdentical(valueRef.value, firstValue) + if #available(SwiftStdlib 6.4, *) { + let thirdKey = tracker.instance(for: 42) + expectNotNil(d.value(forKey: thirdKey)) { valueRef in + expectIdentical(valueRef.value, firstValue) + } + _ = consume firstValue + expectNotNil(d.value(forKey: thirdKey)) { valueRef in + expectEqual(valueRef.value.payload, "forty-two") + } } - _ = consume firstValue - expectNotNil(d.value(forKey: thirdKey)) { valueRef in - expectEqual(valueRef.value.payload, "forty-two") - } -#endif - + expectEqual(d.count, 1) expectFalse(d.isEmpty) expectFalse(d.isFull) @@ -91,17 +91,17 @@ class RigidDictionaryTests: CollectionTestCase { let res = d.updateValue(secondValue, forKey: secondKey) expectIdentical(res, firstValue) -#if UnstableContainersPreview - let thirdKey = tracker.instance(for: 42) - expectNotNil(d.value(forKey: thirdKey)) { valueRef in - expectIdentical(valueRef.value, secondValue) + if #available(SwiftStdlib 6.4, *) { + let thirdKey = tracker.instance(for: 42) + expectNotNil(d.value(forKey: thirdKey)) { valueRef in + expectIdentical(valueRef.value, secondValue) + } + _ = consume secondValue + expectNotNil(d.value(forKey: thirdKey)) { valueRef in + expectEqual(valueRef.value.payload, "forty-two") + } } - _ = consume secondValue - expectNotNil(d.value(forKey: thirdKey)) { valueRef in - expectEqual(valueRef.value.payload, "forty-two") - } -#endif - + expectEqual(d.count, 1) expectFalse(d.isEmpty) expectFalse(d.isFull) @@ -139,18 +139,18 @@ class RigidDictionaryTests: CollectionTestCase { expectTrue(d.isFull) expectEqual(d.capacity, capacity) expectEqual(d.freeCapacity, 0) - -#if UnstableContainersPreview - for i in 0 ..< capacity { - let dupe = tracker.instance(for: i) - expectNotNil( - d.value(forKey: dupe), - "\(dupe.payload) not found" - ) { valueRef in - expectEqual(valueRef.value.payload, "\(i)") + + if #available(SwiftStdlib 6.4, *) { + for i in 0 ..< capacity { + let dupe = tracker.instance(for: i) + expectNotNil( + d.value(forKey: dupe), + "\(dupe.payload) not found" + ) { valueRef in + expectEqual(valueRef.value.payload, "\(i)") + } } } -#endif } } } @@ -188,22 +188,22 @@ class RigidDictionaryTests: CollectionTestCase { expectEqual(d.capacity, capacity) expectEqual(d.freeCapacity, 0) -#if UnstableContainersPreview - for i in 0 ..< capacity { - let dupe = tracker.instance(for: i) - expectNotNil( - d.value(forKey: dupe), - "\(dupe.payload) not found" - ) { valueRef in - expectEqual(valueRef.value.payload, "\(i)") + if #available(SwiftStdlib 6.4, *) { + for i in 0 ..< capacity { + let dupe = tracker.instance(for: i) + expectNotNil( + d.value(forKey: dupe), + "\(dupe.payload) not found" + ) { valueRef in + expectEqual(valueRef.value.payload, "\(i)") + } } } -#endif } } } - -#if UnstableContainersPreview + + @available(SwiftStdlib 6.4, *) func test_memoizedValue_one() { typealias Key = LifetimeTracked typealias Value = LifetimeTracked @@ -241,8 +241,7 @@ class RigidDictionaryTests: CollectionTestCase { expectEqual(d.freeCapacity, 19) } } -#endif - + func test_withKeys() { typealias Key = LifetimeTracked typealias Value = LifetimeTracked @@ -308,8 +307,7 @@ class RigidDictionaryTests: CollectionTestCase { } } -#if UnstableContainersPreview - @available(SwiftStdlib 6.2, *) + @available(SwiftStdlib 6.4, *) func test_iteration_indices() { typealias Key = LifetimeTracked typealias Value = LifetimeTracked @@ -344,7 +342,6 @@ class RigidDictionaryTests: CollectionTestCase { } } } -#endif func test_updateValue_with_remove() { typealias Key = LifetimeTracked diff --git a/Tests/BasicContainersTests/UniqueDictionaryTests.swift b/Tests/BasicContainersTests/UniqueDictionaryTests.swift index e8203c63..a8d686ca 100644 --- a/Tests/BasicContainersTests/UniqueDictionaryTests.swift +++ b/Tests/BasicContainersTests/UniqueDictionaryTests.swift @@ -196,7 +196,7 @@ class UniqueDictionaryTests: CollectionTestCase { } #if compiler(>=6.4) && UnstableContainersPreview - @available(SwiftStdlib 6.2, *) + @available(SwiftStdlib 6.4, *) func test_iteration_indices() { typealias Key = LifetimeTracked typealias Value = LifetimeTracked diff --git a/Tests/ContainersTests/BorrowingSequenceTests.swift b/Tests/ContainersTests/BorrowingSequenceTests.swift index 3d1fd812..220ed1cd 100644 --- a/Tests/ContainersTests/BorrowingSequenceTests.swift +++ b/Tests/ContainersTests/BorrowingSequenceTests.swift @@ -21,7 +21,7 @@ import ContainersPreview #endif #if compiler(>=6.4) && UnstableContainersPreview -final class BorrowingSequenceTests: XCTestCase { +final class IterableTests: XCTestCase { @available(SwiftStdlib 6.2, *) func testBasic() { let array = [1, 2, 3, 4, 5, 6, 7, 8] @@ -65,7 +65,7 @@ final class BorrowingSequenceTests: XCTestCase { @available(SwiftStdlib 5.0, *) extension Iterable_ where Self: ~Copyable & ~Escapable, Element_: Copyable { - func collectViaBorrowing() throws(Failure) -> [Element_] { + func collectViaBorrowing() throws(Failure_) -> [Element_] { var borrowIterator = makeIterableIterator_() var result: [Element_] = [] while true { diff --git a/Tests/_CollectionsTestSupport/AssertionContexts/Assertions+Containers.swift b/Tests/_CollectionsTestSupport/AssertionContexts/Assertions+Containers.swift index b5f9c530..e21df0db 100644 --- a/Tests/_CollectionsTestSupport/AssertionContexts/Assertions+Containers.swift +++ b/Tests/_CollectionsTestSupport/AssertionContexts/Assertions+Containers.swift @@ -232,11 +232,11 @@ public func expectIterablesWithEquivalentElements< trapping: Bool = false, file: StaticString = #filePath, line: UInt = #line -) throws(S1.Failure) +) throws(S1.Failure_) where S1.Element_: ~Copyable, S2.Element_: ~Copyable, - S1.Failure == S2.Failure + S1.Failure_ == S2.Failure_ { if try left._elementsEqual(right, by: areEquivalent) { return } _expectFailure( @@ -326,7 +326,7 @@ public func expectIterableContents< trapping: Bool = false, file: StaticString = #filePath, line: UInt = #line -) throws(S1.Failure) where S1.Element_: ~Copyable { +) throws(S1.Failure_) where S1.Element_: ~Copyable { var it1 = left.makeIterableIterator_() var it2 = right.makeIterator() var offset = 0 diff --git a/Tests/_CollectionsTestSupport/ConformanceCheckers/CheckContainer.swift b/Tests/_CollectionsTestSupport/ConformanceCheckers/CheckContainer.swift index 03d7aa5f..83b44c76 100644 --- a/Tests/_CollectionsTestSupport/ConformanceCheckers/CheckContainer.swift +++ b/Tests/_CollectionsTestSupport/ConformanceCheckers/CheckContainer.swift @@ -29,7 +29,7 @@ public func checkIterable< expectedContents: Expected, file: StaticString = #filePath, line: UInt = #line -) throws(S.Failure) where S.Element_: Equatable { +) throws(S.Failure_) where S.Element_: Equatable { try checkIterable( iterable, expectedContents: expectedContents, @@ -48,7 +48,7 @@ public func checkIterable< by areEquivalent: (S.Element_, S.Element_) -> Bool, file: StaticString = #filePath, line: UInt = #line -) throws(S.Failure) where S.Element_: Equatable { +) throws(S.Failure_) where S.Element_: Equatable { let entry = TestContext.current.push("checkIterable", file: file, line: line) defer { TestContext.current.pop(entry) } @@ -57,7 +57,7 @@ public func checkIterable< expectLessThanOrEqual(iterable.underestimatedCount_, expectedContents.count) // Check that the spans seem plausibly sized and that the indices are monotonic. - let spanShapes: [Range] = try { () throws(S.Failure) in + let spanShapes: [Range] = try { () throws(S.Failure_) in var r: [Range] = [] var pos = 0 var it = iterable.makeIterableIterator_()