From 80878519f2cb3b6dd09f5f2fca728712088cceab Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Mon, 9 Mar 2026 14:14:51 -0700 Subject: [PATCH] [doc] Fix most issues reported by docc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DocC keeps changing its link syntax. The latest iteration appears to have trouble dealing with `Self`-taking or `Self`-returning methods, so change our API to replace `Self` with a direct mention of the concrete type. ¯\\\_(ツ)\_/¯ That said, the new compiler also found a large number of mismatching parameter names, and that was really helpful. --- .../BitArray/BitArray+Equatable.swift | 4 +- .../Extensions/BitArray.md | 4 +- .../Extensions/BitSet.Counted.md | 30 +++--- .../BitCollections.docc/Extensions/BitSet.md | 21 ++-- .../BitSet+BidirectionalCollection.swift | 6 +- .../BitCollections/BitSet/BitSet+Extras.swift | 2 +- .../BitSet/BitSet+SetAlgebra basics.swift | 2 +- .../BitSet+SetAlgebra formIntersection.swift | 2 +- ...t+SetAlgebra formSymmetricDifference.swift | 2 +- .../BitSet/BitSet+SetAlgebra formUnion.swift | 2 +- .../BitSet+SetAlgebra intersection.swift | 8 +- .../BitSet/BitSet+SetAlgebra isDisjoint.swift | 2 +- .../BitSet/BitSet+SetAlgebra isEqualSet.swift | 2 +- .../BitSet+SetAlgebra isStrictSubset.swift | 2 +- .../BitSet+SetAlgebra isStrictSuperset.swift | 2 +- .../BitSet/BitSet+SetAlgebra isSubset.swift | 2 +- .../BitSet/BitSet+SetAlgebra isSuperset.swift | 2 +- .../BitSet/BitSet+SetAlgebra subtract.swift | 4 +- .../BitSet+SetAlgebra subtracting.swift | 8 +- ...itSet+SetAlgebra symmetricDifference.swift | 8 +- .../BitSet/BitSet+SetAlgebra union.swift | 8 +- .../BitSet/BitSet.Counted.swift | 14 ++- .../ContainersPreview.docc/Extensions/Box.md | 95 +------------------ .../DequeModule/Deque/Deque+Collection.swift | 4 +- Sources/DequeModule/Deque/Deque+Extras.swift | 4 +- .../RigidDeque/RigidDeque+Append.swift | 4 +- .../RigidDeque/RigidDeque+Initializers.swift | 4 +- .../RigidDeque/RigidDeque+Prepend.swift | 4 +- .../RigidDeque/RigidDeque+Removals.swift | 8 +- .../DequeModule/RigidDeque/RigidDeque.swift | 2 +- .../UniqueDeque/UniqueDeque+Append.swift | 4 +- .../UniqueDeque/UniqueDeque+Prepend.swift | 4 +- .../UniqueDeque/UniqueDeque+Removals.swift | 2 +- .../DequeModule/UniqueDeque/UniqueDeque.swift | 2 +- .../Extensions/TreeDictionary.md | 12 +-- .../Extensions/TreeSet.md | 32 +++---- .../TreeDictionary+Collection.swift | 10 +- .../TreeDictionary/TreeDictionary+Keys.swift | 10 +- .../TreeDictionary/TreeDictionary+Merge.swift | 4 +- .../TreeSet/TreeSet+Extras.swift | 6 +- .../TreeSet+SetAlgebra Initializers.swift | 6 +- .../TreeSet/TreeSet+SetAlgebra basics.swift | 4 +- .../TreeSet+SetAlgebra formIntersection.swift | 2 +- ...t+SetAlgebra formSymmetricDifference.swift | 2 +- .../TreeSet+SetAlgebra formUnion.swift | 2 +- .../TreeSet+SetAlgebra intersection.swift | 8 +- .../TreeSet+SetAlgebra isDisjoint.swift | 2 +- .../TreeSet+SetAlgebra isEqualSet.swift | 2 +- .../TreeSet+SetAlgebra isStrictSubset.swift | 2 +- .../TreeSet+SetAlgebra isStrictSuperset.swift | 2 +- .../TreeSet/TreeSet+SetAlgebra isSubset.swift | 2 +- .../TreeSet+SetAlgebra isSuperset.swift | 2 +- .../TreeSet/TreeSet+SetAlgebra subtract.swift | 2 +- .../TreeSet+SetAlgebra subtracting.swift | 10 +- ...eeSet+SetAlgebra symmetricDifference.swift | 6 +- .../TreeSet/TreeSet+SetAlgebra union.swift | 6 +- ...deredDictionary+Elements.SubSequence.swift | 5 +- .../OrderedDictionary+Elements.swift | 6 +- ...y+Partial RangeReplaceableCollection.swift | 2 +- .../OrderedDictionary+Values.swift | 5 +- .../OrderedDictionary/OrderedDictionary.swift | 4 +- .../OrderedSet/OrderedSet+Insertions.swift | 6 +- ...t+Partial RangeReplaceableCollection.swift | 2 +- .../OrderedSet+RandomAccessCollection.swift | 5 +- .../OrderedSet/OrderedSet+SubSequence.swift | 5 +- .../TrailingElementsModule.md | 2 +- Utils/generate-docs.sh | 14 +-- 67 files changed, 187 insertions(+), 277 deletions(-) diff --git a/Sources/BitCollections/BitArray/BitArray+Equatable.swift b/Sources/BitCollections/BitArray/BitArray+Equatable.swift index 31ec256f..3fa9518c 100644 --- a/Sources/BitCollections/BitArray/BitArray+Equatable.swift +++ b/Sources/BitCollections/BitArray/BitArray+Equatable.swift @@ -21,8 +21,8 @@ extension BitArray: Equatable { /// Equality is the inverse of inequality. For any values `a` and `b`, /// `a == b` implies that `a != b` is `false`. /// - /// - Parameter lhs: A value to compare. - /// - Parameter rhs: Another value to compare. + /// - Parameter left: A value to compare. + /// - Parameter right: Another value to compare. /// - Complexity: O(left.count) public static func ==(left: Self, right: Self) -> Bool { guard left._count == right._count else { return false } diff --git a/Sources/BitCollections/BitCollections.docc/Extensions/BitArray.md b/Sources/BitCollections/BitCollections.docc/Extensions/BitArray.md index 8e62be5a..493f6085 100644 --- a/Sources/BitCollections/BitCollections.docc/Extensions/BitArray.md +++ b/Sources/BitCollections/BitCollections.docc/Extensions/BitArray.md @@ -21,7 +21,7 @@ ### Accessing Elements -- ``subscript(position:)` +- ``subscript(_:)`` - ``first`` - ``last`` @@ -43,7 +43,7 @@ - ``remove(at:)`` - ``removeAll(keepingCapacity:)`` -- ``removeAll(where:)`` +- ``removeAll(where:)-4izxo`` - ``removeSubrange(_:)`` - ``removeLast()`` - ``removeLast(_:)`` diff --git a/Sources/BitCollections/BitCollections.docc/Extensions/BitSet.Counted.md b/Sources/BitCollections/BitCollections.docc/Extensions/BitSet.Counted.md index 60b819d9..9dc78437 100644 --- a/Sources/BitCollections/BitCollections.docc/Extensions/BitSet.Counted.md +++ b/Sources/BitCollections/BitCollections.docc/Extensions/BitSet.Counted.md @@ -51,42 +51,42 @@ ### Binary Set Operations -- ``intersection(_:)-(Self)`` +- ``intersection(_:)-(BitSet.Counted)`` - ``intersection(_:)-(BitSet)`` - ``intersection(_:)-(Range)`` -- ``intersection(_:)-(Sequence) +- ``intersection(_:)-(Sequence)`` -- ``union(_:)-(Self)`` +- ``union(_:)-(BitSet.Counted)`` - ``union(_:)-(BitSet)`` - ``union(_:)-(Range)`` - ``union(_:)-(Sequence)`` -- ``subtracting(_:)-(Self)`` +- ``subtracting(_:)-(BitSet.Counted)`` - ``subtracting(_:)-(BitSet)`` - ``subtracting(_:)-(Range)`` - ``subtracting(_:)-(Sequence)`` -- ``symmetricDifference(_:)-(Self)`` +- ``symmetricDifference(_:)-(BitSet.Counted)`` - ``symmetricDifference(_:)-(BitSet)`` - ``symmetricDifference(_:)-(Range)`` - ``symmetricDifference(_:)-(Sequence)`` -- ``formIntersection(_:)-(Self)`` +- ``formIntersection(_:)-(BitSet.Counted)`` - ``formIntersection(_:)-(BitSet)`` - ``formIntersection(_:)-(Range)`` - ``formIntersection(_:)-(Sequence)`` -- ``formUnion(_:)-(Self)`` +- ``formUnion(_:)-(BitSet.Counted)`` - ``formUnion(_:)-(BitSet)`` - ``formUnion(_:)-(Range)`` - ``formUnion(_:)-(Sequence)`` -- ``subtract(_:)-(Self)`` +- ``subtract(_:)-(BitSet.Counted)`` - ``subtract(_:)-(BitSet)`` - ``subtract(_:)-(Range)`` - ``subtract(_:)-(Sequence)`` -- ``formSymmetricDifference(_:)-(Self)`` +- ``formSymmetricDifference(_:)-(BitSet.Counted)`` - ``formSymmetricDifference(_:)-(BitSet)`` - ``formSymmetricDifference(_:)-(Range)`` - ``formSymmetricDifference(_:)-(Sequence)`` @@ -94,32 +94,32 @@ ### Binary Set Predicates - ``==(_:_:)`` -- ``isEqualSet(to:)-(Self)`` +- ``isEqualSet(to:)-(BitSet.Counted)`` - ``isEqualSet(to:)-(BitSet)`` - ``isEqualSet(to:)-(Range)`` - ``isEqualSet(to:)-(Sequence)`` -- ``isSubset(of:)-(Self)`` +- ``isSubset(of:)-(BitSet.Counted)`` - ``isSubset(of:)-(BitSet)`` - ``isSubset(of:)-(Range)`` - ``isSubset(of:)-(Sequence)`` -- ``isSuperset(of:)-(Self)`` +- ``isSuperset(of:)-(BitSet.Counted)`` - ``isSuperset(of:)-(BitSet)`` - ``isSuperset(of:)-(Range)`` - ``isSuperset(of:)-(Sequence)`` -- ``isStrictSubset(of:)-(Self)`` +- ``isStrictSubset(of:)-(BitSet.Counted)`` - ``isStrictSubset(of:)-(BitSet)`` - ``isStrictSubset(of:)-(Range)`` - ``isStrictSubset(of:)-(Sequence)`` -- ``isStrictSuperset(of:)-(Self)`` +- ``isStrictSuperset(of:)-(BitSet.Counted)`` - ``isStrictSuperset(of:)-(BitSet)`` - ``isStrictSuperset(of:)-(Range)`` - ``isStrictSuperset(of:)-(Sequence)`` -- ``isDisjoint(with:)-(Self)`` +- ``isDisjoint(with:)-(BitSet.Counted)`` - ``isDisjoint(with:)-(BitSet)`` - ``isDisjoint(with:)-(Range)`` - ``isDisjoint(with:)-(Sequence)`` diff --git a/Sources/BitCollections/BitCollections.docc/Extensions/BitSet.md b/Sources/BitCollections/BitCollections.docc/Extensions/BitSet.md index c645a821..da689dab 100644 --- a/Sources/BitCollections/BitCollections.docc/Extensions/BitSet.md +++ b/Sources/BitCollections/BitCollections.docc/Extensions/BitSet.md @@ -38,7 +38,6 @@ ### Sorted Set Operations -- ``subscript(position:)`` - ``subscript(member:)`` - ``subscript(members:)-(RangeExpression)`` - ``subscript(members:)-(Range)`` @@ -48,27 +47,27 @@ ### Combining Sets -- ``intersection(_:)-(Self)`` +- ``intersection(_:)-(BitSet)`` - ``intersection(_:)-(Range)`` - ``intersection(_:)-(BitSet.Counted)`` - ``intersection(_:)-(Sequence)`` -- ``union(_:)-(Self)`` +- ``union(_:)-(BitSet)`` - ``union(_:)-(Range)`` - ``union(_:)-(BitSet.Counted)`` - ``union(_:)-(Sequence)`` -- ``subtracting(_:)-(Self)`` +- ``subtracting(_:)-(BitSet)`` - ``subtracting(_:)-(Range)`` - ``subtracting(_:)-(BitSet.Counted)`` - ``subtracting(_:)-(Sequence)`` -- ``symmetricDifference(_:)-(Self)`` +- ``symmetricDifference(_:)-(BitSet)`` - ``symmetricDifference(_:)-(Range)`` - ``symmetricDifference(_:)-(Counted)`` - ``symmetricDifference(_:)-(Sequence)`` -- ``formIntersection(_:)-(Self)`` +- ``formIntersection(_:)-(BitSet)`` - ``formIntersection(_:)-(Range)`` - ``formIntersection(_:)-(BitSet.Counted)`` - ``formIntersection(_:)-(Sequence)`` @@ -83,7 +82,7 @@ - ``subtract(_:)-(BitSet.Counted)`` - ``subtract(_:)-(Sequence)`` -- ``formSymmetricDifference(_:)-(Self)`` +- ``formSymmetricDifference(_:)-(BitSet)`` - ``formSymmetricDifference(_:)-(Range)`` - ``formSymmetricDifference(_:)-(BitSet.Counted)`` - ``formSymmetricDifference(_:)-(Sequence)`` @@ -91,17 +90,17 @@ ### Comparing Sets - ``==(_:_:)`` -- ``isEqualSet(to:)-(Self)`` +- ``isEqualSet(to:)-(BitSet)`` - ``isEqualSet(to:)-(Range)`` - ``isEqualSet(to:)-(BitSet.Counted)`` - ``isEqualSet(to:)-(Sequence)`` -- ``isSubset(of:)-(Self)`` +- ``isSubset(of:)-(BitSet)`` - ``isSubset(of:)-(Range)`` - ``isSubset(of:)-(BitSet.Counted)`` - ``isSubset(of:)-(Sequence)`` -- ``isSuperset(of:)-(Self) +- ``isSuperset(of:)-(Self)`` - ``isSuperset(of:)-(Range)`` - ``isSuperset(of:)-(BitSet.Counted)`` - ``isSuperset(of:)-(Sequence)`` @@ -116,7 +115,7 @@ - ``isStrictSuperset(of:)-(BitSet.Counted)`` - ``isStrictSuperset(of:)-(Sequence)`` -- ``isDisjoint(with:)-(Self) +- ``isDisjoint(with:)-(Self)`` - ``isDisjoint(with:)-(Range)`` - ``isDisjoint(with:)-(BitSet.Counted)`` - ``isDisjoint(with:)-(Sequence)`` diff --git a/Sources/BitCollections/BitSet/BitSet+BidirectionalCollection.swift b/Sources/BitCollections/BitSet/BitSet+BidirectionalCollection.swift index 4f222975..1acce39a 100644 --- a/Sources/BitCollections/BitSet/BitSet+BidirectionalCollection.swift +++ b/Sources/BitCollections/BitSet/BitSet+BidirectionalCollection.swift @@ -212,9 +212,9 @@ extension BitSet: Collection, BidirectionalCollection { /// the collection. /// /// - Parameters: - /// - i: A valid index of the collection. - /// - distance: The distance to offset `i`. - /// - Returns: An index offset by `distance` from the index `i`. If + /// - index: A valid index of the collection. + /// - distance: The distance to offset `index`. + /// - Returns: An index offset by `distance` from `index`. If /// `distance` is positive, this is the same value as the result of /// `distance` calls to `index(after:)`. If `distance` is negative, this /// is the same value as the result of `abs(distance)` calls to diff --git a/Sources/BitCollections/BitSet/BitSet+Extras.swift b/Sources/BitCollections/BitSet/BitSet+Extras.swift index 1bd68f09..28d2b777 100644 --- a/Sources/BitCollections/BitSet/BitSet+Extras.swift +++ b/Sources/BitCollections/BitSet/BitSet+Extras.swift @@ -151,7 +151,7 @@ extension BitSet { extension BitSet { /// Removes and returns the element at the specified position. /// - /// - Parameter i: The position of the element to remove. `index` must be + /// - Parameter index: The position of the element to remove. `index` must be /// a valid index of the collection that is not equal to the collection's /// end index. /// diff --git a/Sources/BitCollections/BitSet/BitSet+SetAlgebra basics.swift b/Sources/BitCollections/BitSet/BitSet+SetAlgebra basics.swift index e80c7fe9..8e603980 100644 --- a/Sources/BitCollections/BitSet/BitSet+SetAlgebra basics.swift +++ b/Sources/BitCollections/BitSet/BitSet+SetAlgebra basics.swift @@ -32,7 +32,7 @@ extension BitSet { /// Returns a Boolean value that indicates whether the given element exists /// in the set. /// - /// - Parameter element: An element to look for in the set. + /// - Parameter member: An element to look for in the set. /// /// - Returns: `true` if `member` exists in the set; otherwise, `false`. /// diff --git a/Sources/BitCollections/BitSet/BitSet+SetAlgebra formIntersection.swift b/Sources/BitCollections/BitSet/BitSet+SetAlgebra formIntersection.swift index 1e82ba5f..4598cf17 100644 --- a/Sources/BitCollections/BitSet/BitSet+SetAlgebra formIntersection.swift +++ b/Sources/BitCollections/BitSet/BitSet+SetAlgebra formIntersection.swift @@ -26,7 +26,7 @@ extension BitSet { /// - Parameter other: A bit set. /// /// - Complexity: O(*max*), where *max* is the largest item in either set. - public mutating func formIntersection(_ other: Self) { + public mutating func formIntersection(_ other: BitSet) { other._read { source in if source.wordCount < _storage.count { self._storage.removeLast(_storage.count - source.wordCount) diff --git a/Sources/BitCollections/BitSet/BitSet+SetAlgebra formSymmetricDifference.swift b/Sources/BitCollections/BitSet/BitSet+SetAlgebra formSymmetricDifference.swift index bd9dfa37..ee0aad9a 100644 --- a/Sources/BitCollections/BitSet/BitSet+SetAlgebra formSymmetricDifference.swift +++ b/Sources/BitCollections/BitSet/BitSet+SetAlgebra formSymmetricDifference.swift @@ -27,7 +27,7 @@ extension BitSet { /// - Parameter other: Another set. /// /// - Complexity: O(*max*), where *max* is the largest item in either set. - public mutating func formSymmetricDifference(_ other: Self) { + public mutating func formSymmetricDifference(_ other: BitSet) { _ensureCapacity(limit: other._capacity) _updateThenShrink { target, shrink in other._read { source in diff --git a/Sources/BitCollections/BitSet/BitSet+SetAlgebra formUnion.swift b/Sources/BitCollections/BitSet/BitSet+SetAlgebra formUnion.swift index 77e66f04..0d7c6d2c 100644 --- a/Sources/BitCollections/BitSet/BitSet+SetAlgebra formUnion.swift +++ b/Sources/BitCollections/BitSet/BitSet+SetAlgebra formUnion.swift @@ -26,7 +26,7 @@ extension BitSet { /// - Parameter other: The set of elements to insert. /// /// - Complexity: O(*max*), where *max* is the largest item in either input. - public mutating func formUnion(_ other: Self) { + public mutating func formUnion(_ other: BitSet) { _ensureCapacity(limit: other._capacity) _update { target in other._read { source in diff --git a/Sources/BitCollections/BitSet/BitSet+SetAlgebra intersection.swift b/Sources/BitCollections/BitSet/BitSet+SetAlgebra intersection.swift index 09f6fcb1..49c1f46e 100644 --- a/Sources/BitCollections/BitSet/BitSet+SetAlgebra intersection.swift +++ b/Sources/BitCollections/BitSet/BitSet+SetAlgebra intersection.swift @@ -27,7 +27,7 @@ extension BitSet { /// - Parameter other: A bit set. /// /// - Complexity: O(*max*), where *max* is the largest item in either set. - public func intersection(_ other: Self) -> Self { + public func intersection(_ other: BitSet) -> BitSet { self._read { first in other._read { second in Self( @@ -49,7 +49,7 @@ extension BitSet { /// - Parameter other: A bit set. /// /// - Complexity: O(*max*), where *max* is the largest item in either set. - public func intersection(_ other: BitSet.Counted) -> Self { + public func intersection(_ other: BitSet.Counted) -> BitSet { self.intersection(other._bits) } @@ -64,7 +64,7 @@ extension BitSet { /// /// - Complexity: O(*max*) + *k*, where *max* is the largest item in `self`, /// and *k* is the complexity of iterating over all elements in `other`. - public func intersection(_ other: Range) -> Self { + public func intersection(_ other: Range) -> BitSet { var result = self result.formIntersection(other) return result @@ -83,7 +83,7 @@ extension BitSet { /// - Complexity: O(*max*) + *k*, where *max* is the largest item in `self`, /// and *k* is the complexity of iterating over all elements in `other`. @inlinable - public func intersection(_ other: __owned some Sequence) -> Self { + public func intersection(_ other: __owned some Sequence) -> BitSet { if let other = _specialize(other, for: Range.self) { return intersection(other) } diff --git a/Sources/BitCollections/BitSet/BitSet+SetAlgebra isDisjoint.swift b/Sources/BitCollections/BitSet/BitSet+SetAlgebra isDisjoint.swift index 6b68ef8e..a980ad2b 100644 --- a/Sources/BitCollections/BitSet/BitSet+SetAlgebra isDisjoint.swift +++ b/Sources/BitCollections/BitSet/BitSet+SetAlgebra isDisjoint.swift @@ -29,7 +29,7 @@ extension BitSet { /// otherwise, `false`. /// /// - Complexity: O(*max*), where *max* is the largest item in either input. - public func isDisjoint(with other: Self) -> Bool { + public func isDisjoint(with other: BitSet) -> Bool { self._read { first in other._read { second in let w1 = first._words diff --git a/Sources/BitCollections/BitSet/BitSet+SetAlgebra isEqualSet.swift b/Sources/BitCollections/BitSet/BitSet+SetAlgebra isEqualSet.swift index 93e0298d..6f995d39 100644 --- a/Sources/BitCollections/BitSet/BitSet+SetAlgebra isEqualSet.swift +++ b/Sources/BitCollections/BitSet/BitSet+SetAlgebra isEqualSet.swift @@ -22,7 +22,7 @@ extension BitSet { /// /// - Complexity: O(*max*), where *max* is value of the largest member of /// either set. - public func isEqualSet(to other: Self) -> Bool { + public func isEqualSet(to other: BitSet) -> Bool { self._storage == other._storage } diff --git a/Sources/BitCollections/BitSet/BitSet+SetAlgebra isStrictSubset.swift b/Sources/BitCollections/BitSet/BitSet+SetAlgebra isStrictSubset.swift index 83c125c5..6af9fa56 100644 --- a/Sources/BitCollections/BitSet/BitSet+SetAlgebra isStrictSubset.swift +++ b/Sources/BitCollections/BitSet/BitSet+SetAlgebra isStrictSubset.swift @@ -36,7 +36,7 @@ extension BitSet { /// otherwise, `false`. /// /// - Complexity: O(*max*), where *max* is the largest item in `self`. - public func isStrictSubset(of other: Self) -> Bool { + public func isStrictSubset(of other: BitSet) -> Bool { self._read { first in other._read { second in let w1 = first._words diff --git a/Sources/BitCollections/BitSet/BitSet+SetAlgebra isStrictSuperset.swift b/Sources/BitCollections/BitSet/BitSet+SetAlgebra isStrictSuperset.swift index be20a879..b7f6d715 100644 --- a/Sources/BitCollections/BitSet/BitSet+SetAlgebra isStrictSuperset.swift +++ b/Sources/BitCollections/BitSet/BitSet+SetAlgebra isStrictSuperset.swift @@ -35,7 +35,7 @@ extension BitSet { /// - Returns: `true` if the set is a superset of `other`; otherwise, `false`. /// /// - Complexity: O(*max*), where *max* is the largest item in `other`. - public func isStrictSuperset(of other: Self) -> Bool { + public func isStrictSuperset(of other: BitSet) -> Bool { other.isStrictSubset(of: self) } diff --git a/Sources/BitCollections/BitSet/BitSet+SetAlgebra isSubset.swift b/Sources/BitCollections/BitSet/BitSet+SetAlgebra isSubset.swift index ff42bafb..98dd619d 100644 --- a/Sources/BitCollections/BitSet/BitSet+SetAlgebra isSubset.swift +++ b/Sources/BitCollections/BitSet/BitSet+SetAlgebra isSubset.swift @@ -34,7 +34,7 @@ extension BitSet { /// - Returns: `true` if the set is a subset of `other`; otherwise, `false`. /// /// - Complexity: O(*max*), where *max* is the largest item in `self`. - public func isSubset(of other: Self) -> Bool { + public func isSubset(of other: BitSet) -> Bool { self._read { first in other._read { second in let w1 = first._words diff --git a/Sources/BitCollections/BitSet/BitSet+SetAlgebra isSuperset.swift b/Sources/BitCollections/BitSet/BitSet+SetAlgebra isSuperset.swift index cceca0eb..05fe348c 100644 --- a/Sources/BitCollections/BitSet/BitSet+SetAlgebra isSuperset.swift +++ b/Sources/BitCollections/BitSet/BitSet+SetAlgebra isSuperset.swift @@ -34,7 +34,7 @@ extension BitSet { /// - Returns: `true` if the set is a superset of `other`; otherwise, `false`. /// /// - Complexity: O(*max*), where *max* is the largest item in `other`. - public func isSuperset(of other: Self) -> Bool { + public func isSuperset(of other: BitSet) -> Bool { other.isSubset(of: self) } diff --git a/Sources/BitCollections/BitSet/BitSet+SetAlgebra subtract.swift b/Sources/BitCollections/BitSet/BitSet+SetAlgebra subtract.swift index 88d56fa3..fc8d0e49 100644 --- a/Sources/BitCollections/BitSet/BitSet+SetAlgebra subtract.swift +++ b/Sources/BitCollections/BitSet/BitSet+SetAlgebra subtract.swift @@ -26,7 +26,7 @@ extension BitSet { /// - Parameter other: Another bit set. /// /// - Complexity: O(*max*), where *max* is the largest item in either input. - public mutating func subtract(_ other: Self) { + public mutating func subtract(_ other: BitSet) { _updateThenShrink { target, shrink in other._read { source in target.combineSharedPrefix( @@ -59,8 +59,6 @@ extension BitSet { /// /// - Parameter other: A range of arbitrary integers. /// - /// - Returns: A new set. - /// /// - Complexity: O(*max*), where *max* is the largest item in self. public mutating func subtract(_ other: Range) { _subtract(other._clampedToUInt()) diff --git a/Sources/BitCollections/BitSet/BitSet+SetAlgebra subtracting.swift b/Sources/BitCollections/BitSet/BitSet+SetAlgebra subtracting.swift index c225038f..ef1f81df 100644 --- a/Sources/BitCollections/BitSet/BitSet+SetAlgebra subtracting.swift +++ b/Sources/BitCollections/BitSet/BitSet+SetAlgebra subtracting.swift @@ -28,7 +28,7 @@ extension BitSet { /// - Returns: A new set. /// /// - Complexity: O(*max*), where *max* is the largest item in either input. - public func subtracting(_ other: Self) -> Self { + public func subtracting(_ other: BitSet) -> BitSet { self._read { first in other._read { second in Self( @@ -51,7 +51,7 @@ extension BitSet { /// - Returns: A new set. /// /// - Complexity: O(*max*), where *max* is the largest item in either input. - public func subtracting(_ other: BitSet.Counted) -> Self { + public func subtracting(_ other: BitSet.Counted) -> BitSet { subtracting(other._bits) } @@ -66,7 +66,7 @@ extension BitSet { /// - Returns: A new set. /// /// - Complexity: O(*max*), where *max* is the largest item in self. - public func subtracting(_ other: Range) -> Self { + public func subtracting(_ other: Range) -> BitSet { var result = self result.subtract(other) return result @@ -86,7 +86,7 @@ extension BitSet { /// - Complexity: O(*max*) + *k*, where *max* is the largest item in `self`, /// and *k* is the complexity of iterating over all elements in `other`. @inlinable - public func subtracting(_ other: __owned some Sequence) -> Self { + public func subtracting(_ other: __owned some Sequence) -> BitSet { var result = self result.subtract(other) return result diff --git a/Sources/BitCollections/BitSet/BitSet+SetAlgebra symmetricDifference.swift b/Sources/BitCollections/BitSet/BitSet+SetAlgebra symmetricDifference.swift index b6c32524..f47ca296 100644 --- a/Sources/BitCollections/BitSet/BitSet+SetAlgebra symmetricDifference.swift +++ b/Sources/BitCollections/BitSet/BitSet+SetAlgebra symmetricDifference.swift @@ -28,7 +28,7 @@ extension BitSet { /// - Returns: A new set. /// /// - Complexity: O(*max*), where *max* is the largest item in either set. - public func symmetricDifference(_ other: Self) -> Self { + public func symmetricDifference(_ other: BitSet) -> BitSet { self._read { first in other._read { second in Self( @@ -51,7 +51,7 @@ extension BitSet { /// - Returns: A new set. /// /// - Complexity: O(*max*), where *max* is the largest item in either set. - public func symmetricDifference(_ other: Counted) -> Self { + public func symmetricDifference(_ other: Counted) -> BitSet { symmetricDifference(other._bits) } @@ -66,7 +66,7 @@ extension BitSet { /// - Returns: A new set. /// /// - Complexity: O(*max*), where *max* is the largest item in either input. - public func symmetricDifference(_ other: Range) -> Self { + public func symmetricDifference(_ other: Range) -> BitSet { var result = self result.formSymmetricDifference(other) return result @@ -87,7 +87,7 @@ extension BitSet { @inlinable public func symmetricDifference( _ other: __owned some Sequence - ) -> Self { + ) -> BitSet { if let other = _specialize(other, for: Range.self) { return symmetricDifference(other) } diff --git a/Sources/BitCollections/BitSet/BitSet+SetAlgebra union.swift b/Sources/BitCollections/BitSet/BitSet+SetAlgebra union.swift index 5b72525c..affcccc0 100644 --- a/Sources/BitCollections/BitSet/BitSet+SetAlgebra union.swift +++ b/Sources/BitCollections/BitSet/BitSet+SetAlgebra union.swift @@ -25,7 +25,7 @@ extension BitSet { /// - Parameter other: The set of elements to insert. /// /// - Complexity: O(*max*), where *max* is the largest item in either input. - public func union(_ other: Self) -> Self { + public func union(_ other: BitSet) -> BitSet { self._read { first in other._read { second in Self( @@ -45,7 +45,7 @@ extension BitSet { /// - Parameter other: The set of elements to insert. /// /// - Complexity: O(*max*), where *max* is the largest item in either input. - public func union(_ other: BitSet.Counted) -> Self { + public func union(_ other: BitSet.Counted) -> BitSet { union(other._bits) } @@ -58,7 +58,7 @@ extension BitSet { /// - Parameter other: A range of nonnegative integers. /// /// - Complexity: O(*max*), where *max* is the largest item in either input. - public func union(_ other: Range) -> Self { + public func union(_ other: Range) -> BitSet { var result = self result.formUnion(other) return result @@ -77,7 +77,7 @@ extension BitSet { /// input, and *k* is the complexity of iterating over all elements in /// `other`. @inlinable - public func union(_ other: __owned some Sequence) -> Self { + public func union(_ other: __owned some Sequence) -> BitSet { if let other = _specialize(other, for: BitSet.self) { return union(other) } diff --git a/Sources/BitCollections/BitSet/BitSet.Counted.swift b/Sources/BitCollections/BitSet/BitSet.Counted.swift index 7fae3d25..301cfb7a 100644 --- a/Sources/BitCollections/BitSet/BitSet.Counted.swift +++ b/Sources/BitCollections/BitSet/BitSet.Counted.swift @@ -866,8 +866,6 @@ extension BitSet.Counted { /// /// - Parameter other: A range of arbitrary integers. /// - /// - Returns: A new set. - /// /// - Complexity: O(*max*), where *max* is the largest item in self. public mutating func subtract(_ other: Range) { _bits.subtract(other) @@ -902,7 +900,7 @@ extension BitSet.Counted { /// /// - Complexity: O(*max*), where *max* is value of the largest member of /// either set. - public func isEqualSet(to other: Self) -> Bool { + public func isEqualSet(to other: BitSet.Counted) -> Bool { guard self.count == other.count else { return false } return self._bits.isEqualSet(to: other._bits) } @@ -964,7 +962,7 @@ extension BitSet.Counted { /// - Returns: `true` if the set is a subset of `other`; otherwise, `false`. /// /// - Complexity: O(*max*), where *max* is the largest item in `self`. - public func isSubset(of other: Self) -> Bool { + public func isSubset(of other: BitSet.Counted) -> Bool { if self.count > other.count { return false } return self._bits.isSubset(of: other._bits) } @@ -1047,7 +1045,7 @@ extension BitSet.Counted { /// - Returns: `true` if the set is a superset of `other`; otherwise, `false`. /// /// - Complexity: O(*max*), where *max* is the largest item in `other`. - public func isSuperset(of other: Self) -> Bool { + public func isSuperset(of other: BitSet.Counted) -> Bool { other.isSubset(of: self) } @@ -1131,7 +1129,7 @@ extension BitSet.Counted { /// otherwise, `false`. /// /// - Complexity: O(*max*), where *max* is the largest item in `self`. - public func isStrictSubset(of other: Self) -> Bool { + public func isStrictSubset(of other: BitSet.Counted) -> Bool { guard self.count < other.count else { return false } return _bits.isStrictSubset(of: other._bits) } @@ -1222,7 +1220,7 @@ extension BitSet.Counted { /// - Returns: `true` if the set is a superset of `other`; otherwise, `false`. /// /// - Complexity: O(*max*), where *max* is the largest item in `other`. - public func isStrictSuperset(of other: Self) -> Bool { + public func isStrictSuperset(of other: BitSet.Counted) -> Bool { other.isStrictSubset(of: self) } @@ -1300,7 +1298,7 @@ extension BitSet.Counted { /// otherwise, `false`. /// /// - Complexity: O(*max*), where *max* is the largest item in either input. - public func isDisjoint(with other: Self) -> Bool { + public func isDisjoint(with other: BitSet.Counted) -> Bool { _bits.isDisjoint(with: other._bits) } diff --git a/Sources/ContainersPreview/ContainersPreview.docc/Extensions/Box.md b/Sources/ContainersPreview/ContainersPreview.docc/Extensions/Box.md index c88f17d1..1b6296dd 100644 --- a/Sources/ContainersPreview/ContainersPreview.docc/Extensions/Box.md +++ b/Sources/ContainersPreview/ContainersPreview.docc/Extensions/Box.md @@ -1,96 +1,9 @@ -# ``BasicContainers/RigidArray`` +# ``ContainersPreview/Box`` ## Topics -### Creating a rigid array - -- ``init()`` -- ``init(capacity:)`` -- ``init(capacity:initializingWith:)`` -- ``init(repeating:count:)`` -- ``init(capacity:copying:)-(_,Sequence)`` -- ``init(capacity:copying:)-(_,Collection)`` - -### Inspecting a rigid array - -- ``isEmpty`` -- ``isFull`` -- ``count`` -- ``capacity`` -- ``freeCapacity`` - -### Indices - -- ``startIndex`` -- ``endIndex`` -- ``indices`` - -### Accessing elements - -- ``subscript(position:)`` -- ``swapAt(_:_:)`` -- ``edit(_:)`` - -### Memory management - -- ``reallocate(capacity:)`` -- ``reserveCapacity(_:)`` -- ``copy()`` -- ``copy(capacity:)`` - -### Spans - +- ``init(_:)`` +- ``subscript()`` +- ``consume()`` - ``span`` -- ``span(after:)`` -- ``span(before:)`` - ``mutableSpan`` -- ``mutableSpan(after:)`` -- ``mutableSpan(before:)`` - -### Appending items - -- ``append(_:)`` -- ``pushLast(_:)`` -- ``append(count:initializingWith:)`` -- ``append(moving:)-(UnsafeMutableBufferPointer)`` -- ``append(moving:)-(OutputSpan)`` -- ``append(moving:)-(RigidArray)`` -- ``append(copying:)-(Sequence)`` -- ``append(copying:)-(Span)`` -- ``append(copying:)-(UnsafeBufferPointer)`` -- ``append(copying:)-(UnsafeMutableBufferPointer)`` - -### Inserting items - -- ``insert(_:at:)`` -- ``insert(count:at:initializingWith:)`` -- ``insert(moving:at:)-(OutputSpan,_)`` -- ``insert(moving:at:)-(RigidArray,_)`` -- ``insert(moving:at:)-(UnsafeMutableBufferPointer,_)`` -- ``insert(consuming:at:)`` -- ``insert(copying:at:)-(Collection,_)`` -- ``insert(copying:at:)-(Span,_)`` -- ``insert(copying:at:)-(UnsafeBufferPointer,_)`` -- ``insert(copying:at:)-(UnsafeMutableBufferPointer,_)`` - -### Replacing items - -- ``replaceSubrange(_:newCount:initializingWith:)`` -- ``replaceSubrange(_:moving:)-(_,OutputSpan)`` -- ``replaceSubrange(_:moving:)-(_,RigidArray))`` -- ``replaceSubrange(_:moving:)-(_,UnsafeMutableBufferPointer)`` -- ``replaceSubrange(_:consuming:)`` -- ``replaceSubrange(_:copying:)-(_,Collection)`` -- ``replaceSubrange(_:copying:)-(_,Span)`` -- ``replaceSubrange(_:copying:)-(_,UnsafeBufferPointer)`` -- ``replaceSubrange(_:copying:)-(_,UnsafeMutableBufferPointer)`` - -### Removing items - -- ``removeAll()`` -- ``removeLast()`` -- ``popLast()`` -- ``removeLast(_:)`` -- ``remove(at:)`` -- ``removeSubrange(_:)-(Range)`` -- ``removeSubrange(_:)-(RangeExpression)`` diff --git a/Sources/DequeModule/Deque/Deque+Collection.swift b/Sources/DequeModule/Deque/Deque+Collection.swift index 0053368e..2852c8ee 100644 --- a/Sources/DequeModule/Deque/Deque+Collection.swift +++ b/Sources/DequeModule/Deque/Deque+Collection.swift @@ -274,8 +274,8 @@ extension Deque: RandomAccessCollection { /// the collection. /// /// - Parameters: - /// - i: A valid index of the deque. - /// - `distance`: The distance by which to offset `i`. + /// - i: A valid index of the deque. + /// - distance: The distance by which to offset `i`. /// /// - Returns: An index offset by `distance` from the index `i`. If `distance` /// is positive, this is the same value as the result of `distance` calls diff --git a/Sources/DequeModule/Deque/Deque+Extras.swift b/Sources/DequeModule/Deque/Deque+Extras.swift index 515897f0..b33bef36 100644 --- a/Sources/DequeModule/Deque/Deque+Extras.swift +++ b/Sources/DequeModule/Deque/Deque+Extras.swift @@ -31,8 +31,8 @@ extension Deque { /// the requested number of elements. /// /// - Parameters: - /// - unsafeUninitializedCapacity: The number of elements to allocate - /// space for in the new deque. + /// - capacity: The number of elements to allocate space for in the new + /// deque. /// - initializer: A closure that initializes elements and sets the count /// of the new deque. /// - Parameters: diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Append.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Append.swift index 3a757fed..a0a9181e 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Append.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Append.swift @@ -30,9 +30,9 @@ extension RigidDeque where Element: ~Copyable { /// - Complexity: O(1) @_alwaysEmitIntoClient @inline(__always) - public mutating func append(_ newElement: consuming Element) { + public mutating func append(_ item: consuming Element) { precondition(!isFull, "RigidDeque capacity overflow") - _handle.uncheckedAppend(newElement) + _handle.uncheckedAppend(item) } /// Adds an element to the end of the deque, if possible. diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Initializers.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Initializers.swift index 4d103209..aaa63c1b 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Initializers.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Initializers.swift @@ -161,7 +161,9 @@ extension RigidDeque /*where Element: Copyable*/ { /// derived from the collection's count. /// /// - Parameters: - /// - contents: The contents whose contents to copy into the new deque. + /// - capacity: The desired capacity of the new deque, or nil to allocate + /// just enough storage to fit the contents. + /// - contents: The collection whose contents to copy into the new deque. @_alwaysEmitIntoClient @inline(__always) public init( diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift index 9d123956..292b4f20 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift @@ -30,9 +30,9 @@ extension RigidDeque where Element: ~Copyable { /// - Complexity: O(1) @_alwaysEmitIntoClient @_transparent - public mutating func prepend(_ newElement: consuming Element) { + public mutating func prepend(_ item: consuming Element) { precondition(!isFull, "RigidDeque capacity overflow") - _handle.uncheckedPrepend(newElement) + _handle.uncheckedPrepend(item) } /// Adds an element to the front of the deque, if possible. diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Removals.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Removals.swift index 6c80e801..1ce0d2cd 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Removals.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Removals.swift @@ -26,7 +26,7 @@ extension RigidDeque where Element: ~Copyable { /// gap left by the removed item. (The direction of the move depends on the /// location of the removal, minimizing the cost.) /// - /// - Parameter i: The position of the element to remove. `index` must be + /// - Parameter index: The position of the element to remove. `index` must be /// a valid index of the deque that is not equal to the end index. /// - Returns: The removed element. /// @@ -98,11 +98,11 @@ extension RigidDeque where Element: ~Copyable { /// Attempting to remove more elements than exist in the deque /// triggers a runtime error. /// - /// - Parameter k: The number of elements to remove from the deque. - /// `k` must be greater than or equal to zero and must not exceed + /// - Parameter n: The number of elements to remove from the deque. + /// `n` must be greater than or equal to zero and must not exceed /// the count of the deque. /// - /// - Complexity: O(`k`) + /// - Complexity: O(`n`) @_alwaysEmitIntoClient public mutating func removeLast(_ n: Int) { precondition(n >= 0, "Cannot remove a negative number of elements") diff --git a/Sources/DequeModule/RigidDeque/RigidDeque.swift b/Sources/DequeModule/RigidDeque/RigidDeque.swift index 9ea6e8a7..16c81eb3 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque.swift @@ -92,7 +92,7 @@ public struct RigidDeque: ~Copyable { /// /// It is possible to extend or shrink the capacity of a rigid deque instance, /// but this needs to be done explicitly, with operations dedicated to this -/// purpose (such as ``reserveCapacity`` and ``reallocate(capacity:)``). +/// purpose (such as ``reserveCapacity(_:)`` and ``reallocate(capacity:)``). /// The deque never resizes itself automatically. /// /// Therefore, it is necessary to perform careful manual analysis (or up front diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Append.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Append.swift index de4753da..3a7cdb3a 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Append.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Append.swift @@ -31,9 +31,9 @@ extension UniqueDeque where Element: ~Copyable { /// - Complexity: O(1) as amortized over many invocations on the same deque. @_alwaysEmitIntoClient @_transparent - public mutating func append(_ newElement: consuming Element) { + public mutating func append(_ item: consuming Element) { _ensureFreeCapacity(1) - _storage._handle.uncheckedAppend(newElement) + _storage._handle.uncheckedAppend(item) } } diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift index 0f1f6b9a..24f55875 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift @@ -31,9 +31,9 @@ extension UniqueDeque where Element: ~Copyable { /// - Complexity: O(1) when amortized over many invocations on the same deque. @_alwaysEmitIntoClient @_transparent - public mutating func prepend(_ newElement: consuming Element) { + public mutating func prepend(_ item: consuming Element) { _ensureFreeCapacity(1) - _storage._handle.uncheckedPrepend(newElement) + _storage._handle.uncheckedPrepend(item) } } diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Removals.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Removals.swift index 5e2fc9f9..a8b3d543 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Removals.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Removals.swift @@ -26,7 +26,7 @@ extension UniqueDeque where Element: ~Copyable { /// gap left by the removed item. (The direction of the move depends on the /// location of the removal, minimizing the cost.) /// - /// - Parameter i: The position of the element to remove. `index` must be + /// - Parameter index: The position of the element to remove. `index` must be /// a valid index of the deque that is not equal to the end index. /// - Returns: The removed element. /// diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque.swift index c82d299e..0d12410e 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque.swift @@ -250,7 +250,7 @@ extension UniqueDeque where Element: ~Copyable { /// buffer of the specified capacity, moving all existing elements /// to its new storage. The old storage is then deallocated. /// - /// - Parameter newCapacity: The desired new capacity. `newCapacity` must be + /// - Parameter capacity: The desired new capacity. `capacity` must be /// greater than or equal to the current count. /// /// - Complexity: O(`count`) diff --git a/Sources/HashTreeCollections/HashTreeCollections.docc/Extensions/TreeDictionary.md b/Sources/HashTreeCollections/HashTreeCollections.docc/Extensions/TreeDictionary.md index 3ae293ed..2b910556 100644 --- a/Sources/HashTreeCollections/HashTreeCollections.docc/Extensions/TreeDictionary.md +++ b/Sources/HashTreeCollections/HashTreeCollections.docc/Extensions/TreeDictionary.md @@ -26,7 +26,7 @@ mutation, its `Values` view is not a `MutableCollection`. - ``init()`` - ``init(_:)-(TreeDictionary)`` -- ``init(_:)-(Dictionary)`` +- ``init(_:)-([Key:Value])`` - ``init(uniqueKeysWithValues:)-(Sequence)`` - ``init(uniqueKeysWithValues:)-(Sequence<(Key,Value)>)`` - ``init(_:uniquingKeysWith:)-(Sequence,_)`` @@ -43,9 +43,9 @@ mutation, its `Values` view is not a `MutableCollection`. ### Accessing Keys and Values -- ``subscript(i:)`` -- ``subscript(key:default:)`` -- ``subscript(key:)`` +- ``subscript(_:)->TreeDictionary.Element`` +- ``subscript(_:default:)`` +- ``subscript(_:)->Value?`` - ``index(forKey:)`` ### Adding or Updating Keys and Values @@ -60,10 +60,10 @@ operation.) `TreeDictionary` also provides the standard `merge` and - ``updateValue(_:forKey:)`` - ``updateValue(forKey:with:)`` - ``updateValue(forKey:default:with:)`` -- ``merge(_:uniquingKeysWith:)-(Self,_)`` +- ``merge(_:uniquingKeysWith:)-(TreeDictionary,_)`` - ``merge(_:uniquingKeysWith:)-(Sequence,_)`` - ``merge(_:uniquingKeysWith:)-(Sequence<(Key,Value)>,_)`` -- ``merging(_:uniquingKeysWith:)-(Self,_)`` +- ``merging(_:uniquingKeysWith:)-(TreeDictionary,_)`` - ``merging(_:uniquingKeysWith:)-(Sequence,_)`` - ``merging(_:uniquingKeysWith:)-(Sequence<(Key,Value)>,_)`` diff --git a/Sources/HashTreeCollections/HashTreeCollections.docc/Extensions/TreeSet.md b/Sources/HashTreeCollections/HashTreeCollections.docc/Extensions/TreeSet.md index 8d3132c6..79733653 100644 --- a/Sources/HashTreeCollections/HashTreeCollections.docc/Extensions/TreeSet.md +++ b/Sources/HashTreeCollections/HashTreeCollections.docc/Extensions/TreeSet.md @@ -71,7 +71,7 @@ average -- typically they will need to compare against just one member. ### Creating a Set - ``init()`` -- ``init(_:)-(Self)`` +- ``init(_:)-(TreeSet)`` - ``init(_:)-(TreeDictionary.Keys)`` - ``init(_:)-(Sequence)`` @@ -103,35 +103,35 @@ but `TreeSet` follows the tradition established by `Set` in providing additional overloads to each operation that allow combining a set with additional types, including arbitrary sequences. -- ``intersection(_:)-(Self)` +- ``intersection(_:)-(TreeSet)`` - ``intersection(_:)-(TreeDictionary.Keys)`` - ``intersection(_:)-(Sequence)`` -- ``union(_:)-(Self)`` +- ``union(_:)-(TreeSet)`` - ``union(_:)-(TreeDictionary.Keys)`` - ``union(_:)-(Sequence)`` -- ``subtracting(_:)-(Self)`` -- ``subtracting(_:)-(TreeDictionary.Keys)`` +- ``subtracting(_:)-(TreeSet)`` +- ``subtracting(_:)-(TreeDictionary.Keys)`` - ``subtracting(_:)-(Sequence)`` -- ``symmetricDifference(_:)-(Self)`` +- ``symmetricDifference(_:)-(TreeSet)`` - ``symmetricDifference(_:)-(TreeDictionary.Keys)`` - ``symmetricDifference(_:)-(Sequence)`` -- ``formIntersection(_:)-(Self)`` +- ``formIntersection(_:)-(TreeSet)`` - ``formIntersection(_:)-(TreeDictionary.Keys)`` - ``formIntersection(_:)-(Sequence)`` -- ``formUnion(_:)-(Self)`` +- ``formUnion(_:)-(TreeSet)`` - ``formUnion(_:)-(TreeDictionary.Keys)`` - ``formUnion(_:)-(Sequence)`` -- ``subtract(_:)-(Self)`` +- ``subtract(_:)-(TreeSet)`` - ``subtract(_:)-(TreeDictionary.Keys)`` - ``subtract(_:)-(Sequence)`` -- ``formSymmetricDifference(_:)-(Self)`` +- ``formSymmetricDifference(_:)-(TreeSet)`` - ``formSymmetricDifference(_:)-(TreeDictionary.Keys)`` - ``formSymmetricDifference(_:)-(Sequence)`` @@ -146,26 +146,26 @@ Like `==`, the `isEqualSet` functions ignore element ordering and duplicates (if any). - ``==(_:_:)`` -- ``isEqualSet(to:)-(Self)`` +- ``isEqualSet(to:)-(TreeSet)`` - ``isEqualSet(to:)-(TreeDictionary.Keys)`` - ``isEqualSet(to:)-(Sequence)`` -- ``isSubset(of:)-(Self)`` +- ``isSubset(of:)-(TreeSet)`` - ``isSubset(of:)-(TreeDictionary.Keys)`` - ``isSubset(of:)-(Sequence)`` -- ``isSuperset(of:)-(Self)`` +- ``isSuperset(of:)-(TreeSet)`` - ``isSuperset(of:)-(TreeDictionary.Keys)`` - ``isSuperset(of:)-(Sequence)`` -- ``isStrictSubset(of:)-(Self)`` +- ``isStrictSubset(of:)-(TreeSet)`` - ``isStrictSubset(of:)-(TreeDictionary.Keys)`` - ``isStrictSubset(of:)-(Sequence)`` -- ``isStrictSuperset(of:)-(Self)`` +- ``isStrictSuperset(of:)-(TreeSet)`` - ``isStrictSuperset(of:)-(TreeDictionary.Keys)`` - ``isStrictSuperset(of:)-(Sequence)`` -- ``isDisjoint(with:)-(Self)`` +- ``isDisjoint(with:)-(TreeSet)`` - ``isDisjoint(with:)-(TreeDictionary.Keys)`` - ``isDisjoint(with:)-(Sequence)`` diff --git a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Collection.swift b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Collection.swift index 539e5d9d..836b9152 100644 --- a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Collection.swift +++ b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Collection.swift @@ -159,11 +159,11 @@ extension TreeDictionary: Collection { /// /// - Complexity: O(1) @inlinable - public subscript(i: Index) -> Element { - precondition(_isValid(i), "Invalid index") - precondition(i._path.isOnItem, "Cannot get element at endIndex") - return _UnsafeHandle.read(i._path.node) { - $0[item: i._path.currentItemSlot] + public subscript(position: Index) -> Element { + precondition(_isValid(position), "Invalid index") + precondition(position._path.isOnItem, "Cannot get element at endIndex") + return _UnsafeHandle.read(position._path.node) { + $0[item: position._path.currentItemSlot] } } diff --git a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Keys.swift b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Keys.swift index a5b32d06..3637423b 100644 --- a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Keys.swift +++ b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Keys.swift @@ -232,7 +232,7 @@ extension TreeDictionary.Keys { /// However, the implementation is careful to make the best use of /// hash tree structure to minimize work when possible, e.g. by linking /// parts of the input trees directly into the result. - public func intersection(_ other: TreeSet) -> Self { + public func intersection(_ other: TreeSet) -> TreeDictionary.Keys { guard let r = _base._root.intersection(.top, other._root) else { return self } @@ -259,7 +259,7 @@ extension TreeDictionary.Keys { /// parts of the input trees directly into the result. public func subtracting( _ other: TreeDictionary.Keys - ) -> Self { + ) -> TreeDictionary.Keys { guard let r = _base._root.subtracting(.top, other._base._root) else { return self } @@ -283,7 +283,7 @@ extension TreeDictionary.Keys { /// However, the implementation is careful to make the best use of /// hash tree structure to minimize work when possible, e.g. by linking /// parts of the input trees directly into the result. - public func subtracting(_ other: TreeSet) -> Self { + public func subtracting(_ other: TreeSet) -> TreeDictionary.Keys { guard let r = _base._root.subtracting(.top, other._root) else { return self } @@ -299,8 +299,8 @@ extension TreeDictionary.Keys: Equatable { /// Equality is the inverse of inequality. For any values `a` and `b`, /// `a == b` implies that `a != b` is `false`. /// - /// - Parameter lhs: A value to compare. - /// - Parameter rhs: Another value to compare. + /// - Parameter left: A value to compare. + /// - Parameter right: Another value to compare. /// /// - Complexity: Generally O(`count`), as long as`Element` properly /// implements hashing. That said, the implementation is careful to take diff --git a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Merge.swift b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Merge.swift index 752885ef..ce7568d0 100644 --- a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Merge.swift +++ b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Merge.swift @@ -41,7 +41,7 @@ extension TreeDictionary { /// dictionary. @inlinable public mutating func merge( - _ keysAndValues: Self, + _ keysAndValues: TreeDictionary, uniquingKeysWith combine: (Value, Value) throws -> Value ) rethrows { _invalidateIndices() @@ -168,7 +168,7 @@ extension TreeDictionary { /// hashing. @inlinable public func merging( - _ other: Self, + _ other: TreeDictionary, uniquingKeysWith combine: (Value, Value) throws -> Value ) rethrows -> Self { var copy = self diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+Extras.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+Extras.swift index 222978eb..448ae5dd 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+Extras.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+Extras.swift @@ -46,10 +46,10 @@ extension TreeSet { /// /// Calling this method invalidates all existing indices of the collection. /// - /// - Parameter item: The new value that should replace the original element. + /// - Parameters: + /// - member: The new value that should replace the original element. /// `item` must compare equal to the original value. - /// - /// - Parameter index: The index of the element to be replaced. + /// - index: The index of the element to be replaced. /// /// - Returns: The original element that was replaced. /// diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra Initializers.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra Initializers.swift index e1e5aa1d..a5101c81 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra Initializers.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra Initializers.swift @@ -56,7 +56,7 @@ extension TreeSet { /// /// - Complexity: O(1) @inlinable - public init(_ items: __owned Self) { + public init(_ items: __owned TreeSet) { self = items } @@ -68,8 +68,8 @@ extension TreeSet { /// - Complexity: O(*items.count*) @inlinable public init( - _ item: __owned TreeDictionary.Keys + _ items: __owned TreeDictionary.Keys ) { - self.init(_new: item._base._root.mapValues { _ in () }) + self.init(_new: items._base._root.mapValues { _ in () }) } } diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra basics.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra basics.swift index a903298d..12cd03d8 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra basics.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra basics.swift @@ -19,9 +19,9 @@ extension TreeSet: SetAlgebra { /// Returns a Boolean value that indicates whether the given element exists /// in the set. /// - /// - Parameter element: An element to look for in the set. + /// - Parameter item: An element to look for in the set. /// - /// - Returns: `true` if `element` exists in the set; otherwise, `false`. + /// - Returns: `true` if `item` exists in the set; otherwise, `false`. /// /// - Complexity: This operation is expected to perform O(1) hashing and /// comparison operations on average, provided that `Element` implements diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra formIntersection.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra formIntersection.swift index 298a9aad..3900026d 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra formIntersection.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra formIntersection.swift @@ -31,7 +31,7 @@ extension TreeSet { /// hash tree structure to minimize work when possible, e.g. by linking /// parts of the input trees directly into the result. @inlinable - public mutating func formIntersection(_ other: Self) { + public mutating func formIntersection(_ other: TreeSet) { // FIXME: Implement in-place reductions self = intersection(other) } diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra formSymmetricDifference.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra formSymmetricDifference.swift index d0c57fac..80244d84 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra formSymmetricDifference.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra formSymmetricDifference.swift @@ -28,7 +28,7 @@ extension TreeSet { /// hash tree structure to minimize work when possible, e.g. by linking /// parts of the input trees directly into the result. @inlinable - public mutating func formSymmetricDifference(_ other: __owned Self) { + public mutating func formSymmetricDifference(_ other: __owned TreeSet) { self = symmetricDifference(other) } diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra formUnion.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra formUnion.swift index 406aac7d..c3ae87a7 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra formUnion.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra formUnion.swift @@ -32,7 +32,7 @@ extension TreeSet { /// hash tree structure to minimize work when possible, e.g. by linking /// parts of the input trees directly into the result. @inlinable - public mutating func formUnion(_ other: __owned Self) { + public mutating func formUnion(_ other: __owned TreeSet) { self = union(other) } diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra intersection.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra intersection.swift index 61087f71..7d4e232d 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra intersection.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra intersection.swift @@ -36,7 +36,7 @@ extension TreeSet { /// hash tree structure to minimize work when possible, e.g. by linking /// parts of the input trees directly into the result. @inlinable @inline(__always) - public func intersection(_ other: Self) -> Self { + public func intersection(_ other: TreeSet) -> TreeSet { _intersection(other._root) } @@ -62,12 +62,12 @@ extension TreeSet { @inlinable @inline(__always) public func intersection( _ other: TreeDictionary.Keys - ) -> Self { + ) -> TreeSet { _intersection(other._base._root) } @inlinable - internal func _intersection(_ other: _HashNode) -> Self { + internal func _intersection(_ other: _HashNode) -> TreeSet { guard let r = _root.intersection(.top, other) else { return self } return Self(_new: r) } @@ -89,7 +89,7 @@ extension TreeSet { @inlinable public func intersection( _ other: some Sequence - ) -> Self { + ) -> TreeSet { if let other = _specialize(other, for: Self.self) { return intersection(other) } diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isDisjoint.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isDisjoint.swift index 74c4199c..df02beed 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isDisjoint.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isDisjoint.swift @@ -31,7 +31,7 @@ extension TreeSet { /// - Complexity: Expected to be O(min(`self.count`, `other.count`)) on /// average, if `Element` implements high-quality hashing. @inlinable - public func isDisjoint(with other: Self) -> Bool { + public func isDisjoint(with other: TreeSet) -> Bool { self._root.isDisjoint(.top, with: other._root) } diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isEqualSet.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isEqualSet.swift index 85957192..31642c37 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isEqualSet.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isEqualSet.swift @@ -30,7 +30,7 @@ extension TreeSet { /// every available shortcut to reduce complexity, e.g. by skipping /// comparing elements in shared subtrees. @inlinable - public func isEqualSet(to other: Self) -> Bool { + public func isEqualSet(to other: TreeSet) -> Bool { _root.isEqualSet(to: other._root, by: { _, _ in true }) } diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isStrictSubset.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isStrictSubset.swift index 8ee1e699..48be46a9 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isStrictSubset.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isStrictSubset.swift @@ -37,7 +37,7 @@ extension TreeSet { /// the best use of hash tree structure to minimize work when possible, /// e.g. by skipping over parts of the input trees. @inlinable - public func isStrictSubset(of other: Self) -> Bool { + public func isStrictSubset(of other: TreeSet) -> Bool { guard self.count < other.count else { return false } return isSubset(of: other) } diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isStrictSuperset.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isStrictSuperset.swift index 804d8340..81f1c397 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isStrictSuperset.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isStrictSuperset.swift @@ -37,7 +37,7 @@ extension TreeSet { /// the best use of hash tree structure to minimize work when possible, /// e.g. by skipping over parts of the input trees. @inlinable - public func isStrictSuperset(of other: Self) -> Bool { + public func isStrictSuperset(of other: TreeSet) -> Bool { guard self.count > other.count else { return false } return other._root.isSubset(.top, of: self._root) } diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isSubset.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isSubset.swift index 699fb23c..fbd53aa1 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isSubset.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isSubset.swift @@ -35,7 +35,7 @@ extension TreeSet { /// the best use of hash tree structure to minimize work when possible, /// e.g. by skipping over parts of the input trees. @inlinable - public func isSubset(of other: Self) -> Bool { + public func isSubset(of other: TreeSet) -> Bool { self._root.isSubset(.top, of: other._root) } diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isSuperset.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isSuperset.swift index 283a4a54..26e62920 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isSuperset.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra isSuperset.swift @@ -35,7 +35,7 @@ extension TreeSet { /// the best use of hash tree structure to minimize work when possible, /// e.g. by skipping over parts of the input trees. @inlinable - public func isSuperset(of other: Self) -> Bool { + public func isSuperset(of other: TreeSet) -> Bool { other._root.isSubset(.top, of: self._root) } diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra subtract.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra subtract.swift index 5c39fd44..45bf8304 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra subtract.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra subtract.swift @@ -27,7 +27,7 @@ extension TreeSet { /// hash tree structure to minimize work when possible, e.g. by linking /// parts of the input trees directly into the result. @inlinable - public mutating func subtract(_ other: Self) { + public mutating func subtract(_ other: TreeSet) { // FIXME: Implement in-place reductions self = subtracting(other) } diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra subtracting.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra subtracting.swift index 6ca99658..f9eecd52 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra subtracting.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra subtracting.swift @@ -32,7 +32,7 @@ extension TreeSet { /// hash tree structure to minimize work when possible, e.g. by linking /// parts of the input trees directly into the result. @inlinable - public __consuming func subtracting(_ other: Self) -> Self { + public __consuming func subtracting(_ other: TreeSet) -> TreeSet { _subtracting(other._root) } @@ -54,14 +54,14 @@ extension TreeSet { @inlinable public __consuming func subtracting( _ other: TreeDictionary.Keys - ) -> Self { + ) -> TreeSet { _subtracting(other._base._root) } @inlinable internal __consuming func _subtracting( _ other: _HashNode - ) -> Self { + ) -> TreeSet { guard let r = _root.subtracting(.top, other) else { return self } return Self(_new: r) } @@ -79,7 +79,9 @@ extension TreeSet { /// - Complexity: O(*n*) where *n* is the number of elements in `other`, /// as long as `Element` properly implements hashing. @inlinable - public __consuming func subtracting(_ other: some Sequence) -> Self { + public __consuming func subtracting( + _ other: some Sequence + ) -> TreeSet { if let other = _specialize(other, for: Self.self) { return subtracting(other) } diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra symmetricDifference.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra symmetricDifference.swift index 84f260ae..fd0aa89e 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra symmetricDifference.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra symmetricDifference.swift @@ -32,7 +32,7 @@ extension TreeSet { /// hash tree structure to minimize work when possible, e.g. by linking /// parts of the input trees directly into the result. @inlinable - public func symmetricDifference(_ other: __owned Self) -> Self { + public func symmetricDifference(_ other: __owned TreeSet) -> TreeSet { let branch = _root.symmetricDifference(.top, other._root) guard let branch = branch else { return self } let root = branch.finalize(.top) @@ -58,7 +58,7 @@ extension TreeSet { @inlinable public func symmetricDifference( _ other: __owned TreeDictionary.Keys - ) -> Self { + ) -> TreeSet { let branch = _root.symmetricDifference(.top, other._base._root) guard let branch = branch else { return self } let root = branch.finalize(.top) @@ -88,7 +88,7 @@ extension TreeSet { @inlinable public func symmetricDifference( _ other: __owned some Sequence - ) -> Self { + ) -> TreeSet { if let other = _specialize(other, for: Self.self) { return symmetricDifference(other) } diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra union.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra union.swift index a8904513..22a6cf32 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra union.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+SetAlgebra union.swift @@ -36,7 +36,7 @@ extension TreeSet { /// hash tree structure to minimize work when possible, e.g. by linking /// parts of the input trees directly into the result. @inlinable - public func union(_ other: __owned Self) -> Self { + public func union(_ other: __owned TreeSet) -> TreeSet { let r = _root.union(.top, other._root) guard r.copied else { return self } r.node._fullInvariantCheck() @@ -66,7 +66,7 @@ extension TreeSet { @inlinable public func union( _ other: __owned TreeDictionary.Keys - ) -> Self { + ) -> TreeSet { let r = _root.union(.top, other._base._root) guard r.copied else { return self } r.node._fullInvariantCheck() @@ -97,7 +97,7 @@ extension TreeSet { /// the worst case, where *n* is the number of items in `other`, /// as long as `Element` properly implements hashing. @inlinable - public func union(_ other: __owned some Sequence) -> Self { + public func union(_ other: __owned some Sequence) -> TreeSet { if let other = _specialize(other, for: Self.self) { return union(other) } diff --git a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.SubSequence.swift b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.SubSequence.swift index c65f7748..8144005f 100644 --- a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.SubSequence.swift +++ b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.SubSequence.swift @@ -312,8 +312,9 @@ extension OrderedDictionary.Elements.SubSequence: RandomAccessCollection { /// Accesses the element at the specified position. /// - /// - Parameter index: The position of the element to access. `index` must be - /// greater than or equal to `startIndex` and less than `endIndex`. + /// - Parameter position: The position of the element to access. + /// `position` must be greater than or equal to `startIndex` and less than + /// `endIndex`. /// /// - Complexity: O(1) @inlinable diff --git a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.swift b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.swift index 4649462c..efedd274 100644 --- a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.swift +++ b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.swift @@ -275,8 +275,8 @@ extension OrderedDictionary.Elements: RandomAccessCollection { /// Accesses the element at the specified position. /// - /// - Parameter index: The position of the element to access. `index` must be - /// greater than or equal to `startIndex` and less than `endIndex`. + /// - Parameter position: The position of the element to access. `position` + /// must be greater than or equal to `startIndex` and less than `endIndex`. /// /// - Complexity: O(1) @inlinable @@ -539,7 +539,7 @@ extension OrderedDictionary.Elements { extension OrderedDictionary.Elements { /// Removes all members from the dictionary. /// - /// - Parameter keepingCapacity: If `true`, the dictionary's storage capacity + /// - Parameter keepCapacity: If `true`, the dictionary's storage capacity /// is preserved; if `false`, the underlying storage is released. The /// default is `false`. /// diff --git a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Partial RangeReplaceableCollection.swift b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Partial RangeReplaceableCollection.swift index 22cddc24..46e4b1fb 100644 --- a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Partial RangeReplaceableCollection.swift +++ b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Partial RangeReplaceableCollection.swift @@ -39,7 +39,7 @@ extension OrderedDictionary { /// Removes all members from the dictionary. /// - /// - Parameter keepingCapacity: If `true`, the dictionary's storage capacity + /// - Parameter keepCapacity: If `true`, the dictionary's storage capacity /// is preserved; if `false`, the underlying storage is released. The /// default is `false`. /// diff --git a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Values.swift b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Values.swift index 205d8874..3ecab5ba 100644 --- a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Values.swift +++ b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Values.swift @@ -298,8 +298,9 @@ extension OrderedDictionary.Values: MutableCollection { /// Accesses the element at the specified position. This can be used to /// perform in-place mutations on dictionary values. /// - /// - Parameter index: The position of the element to access. `index` must be - /// greater than or equal to `startIndex` and less than `endIndex`. + /// - Parameter position: The position of the element to access. + /// `position` must be greater than or equal to `startIndex` and less than + /// `endIndex`. /// /// - Complexity: O(1) @inlinable diff --git a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary.swift b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary.swift index 1f90bffb..9ca340c7 100644 --- a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary.swift +++ b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary.swift @@ -718,8 +718,10 @@ extension OrderedDictionary { /// - Parameters: /// - key: The key to look up (or append). If `key` does not already exist /// in the dictionary, it is appended with the supplied default value. - /// - defaultValue: The default value to append if `key` doesn't exist in + /// - defaultValue: The default value to insert if `key` doesn't exist in /// the dictionary. + /// - index: The index at which to insert the new element, if it doesn't + /// already exist. /// - body: A function that performs an in-place mutation on the dictionary /// value. /// diff --git a/Sources/OrderedCollections/OrderedSet/OrderedSet+Insertions.swift b/Sources/OrderedCollections/OrderedSet/OrderedSet+Insertions.swift index f08928fe..e035db46 100644 --- a/Sources/OrderedCollections/OrderedSet/OrderedSet+Insertions.swift +++ b/Sources/OrderedCollections/OrderedSet/OrderedSet+Insertions.swift @@ -146,7 +146,11 @@ extension OrderedSet { /// Insert a new member to this set at the specified index, if the set doesn't /// already contain it. /// - /// - Parameter item: The element to insert. + /// - Parameters: + /// - item: The element to insert. + /// - index: The index at which to insert the new element, if the set + /// doesn't already contain it. `index` must be a valid index in the + /// original set. /// /// - Returns: A pair `(inserted, index)`, where `inserted` is a Boolean value /// indicating whether the operation added a new element, and `index` is diff --git a/Sources/OrderedCollections/OrderedSet/OrderedSet+Partial RangeReplaceableCollection.swift b/Sources/OrderedCollections/OrderedSet/OrderedSet+Partial RangeReplaceableCollection.swift index fd0c0e79..c91583ef 100644 --- a/Sources/OrderedCollections/OrderedSet/OrderedSet+Partial RangeReplaceableCollection.swift +++ b/Sources/OrderedCollections/OrderedSet/OrderedSet+Partial RangeReplaceableCollection.swift @@ -16,7 +16,7 @@ extension OrderedSet { /// Removes all members from the set. /// - /// - Parameter keepingCapacity: If `true`, the set's storage capacity is + /// - Parameter keepCapacity: If `true`, the set's storage capacity is /// preserved; if `false`, the underlying storage is released. The default /// is `false`. /// diff --git a/Sources/OrderedCollections/OrderedSet/OrderedSet+RandomAccessCollection.swift b/Sources/OrderedCollections/OrderedSet/OrderedSet+RandomAccessCollection.swift index 8d18ec6a..35c286a4 100644 --- a/Sources/OrderedCollections/OrderedSet/OrderedSet+RandomAccessCollection.swift +++ b/Sources/OrderedCollections/OrderedSet/OrderedSet+RandomAccessCollection.swift @@ -225,8 +225,9 @@ extension OrderedSet: RandomAccessCollection { /// Accesses the element at the specified position. /// - /// - Parameter index: The position of the element to access. `index` must be - /// greater than or equal to `startIndex` and less than `endIndex`. + /// - Parameter position: The position of the element to access. + /// `position` must be greater than or equal to `startIndex` and less than + /// `endIndex`. /// /// - Complexity: O(1) @inlinable diff --git a/Sources/OrderedCollections/OrderedSet/OrderedSet+SubSequence.swift b/Sources/OrderedCollections/OrderedSet/OrderedSet+SubSequence.swift index 4678550d..26ba74fb 100644 --- a/Sources/OrderedCollections/OrderedSet/OrderedSet+SubSequence.swift +++ b/Sources/OrderedCollections/OrderedSet/OrderedSet+SubSequence.swift @@ -289,8 +289,9 @@ extension OrderedSet.SubSequence: RandomAccessCollection { /// Accesses the element at the specified position. /// - /// - Parameter index: The position of the element to access. `index` must be - /// greater than or equal to `startIndex` and less than `endIndex`. + /// - Parameter position: The position of the element to access. + /// `position` must be greater than or equal to `startIndex` and less than + /// `endIndex`. /// /// - Complexity: O(1) @inlinable diff --git a/Sources/TrailingElementsModule/TrailingElementsModule.docc/TrailingElementsModule.md b/Sources/TrailingElementsModule/TrailingElementsModule.docc/TrailingElementsModule.md index 02c0bf9d..4208e4f8 100644 --- a/Sources/TrailingElementsModule/TrailingElementsModule.docc/TrailingElementsModule.md +++ b/Sources/TrailingElementsModule/TrailingElementsModule.docc/TrailingElementsModule.md @@ -112,4 +112,4 @@ var padded = TrailingPadding(header: SomeType(), totalSize: getSizeOfSomeTypeWit - ``TrailingPadding`` ### Protocols -- ``TrailingElements` +- ``TrailingElements`` diff --git a/Utils/generate-docs.sh b/Utils/generate-docs.sh index 641593b0..7537c6e6 100755 --- a/Utils/generate-docs.sh +++ b/Utils/generate-docs.sh @@ -30,7 +30,7 @@ output_dir_base=/tmp/foo rm -rf "$output_dir_base" components="\ - BitCollections DequeModule HeapModule OrderedCollections \ + BitCollections ContainersPreview DequeModule HeapModule OrderedCollections \ HashTreeCollections" if [ $# -eq 0 ]; then @@ -40,18 +40,6 @@ else fi for target in $targets; do - if [ "$target" = "Collections" ]; then - # Update extensions under Collections.docc - rm -rf Sources/Collections/Collections.docc/Extensions/*.md - for component in $components; do - for file in Sources/"$component"/"$component".docc/Extensions/*.md; do - output="Sources/Collections/Collections.docc/Extensions/$(basename $file)" - blurb="" - sed 's?^# ``[^/]*/\(.*\)``?# ``Collections/\1``\n\n'"$blurb"'\n?' "$file" > "$output" - done - done - fi - mkdir -p "$build_dir/$target/build" mkdir -p "$build_dir/$target/symbol-graphs" mkdir -p "$build_dir/$target/docc"