[SortedCollections] Name the documented arguments the way the declarations name them

Same species as #701, in the module behind the UnstableSortedCollections
trait. 16 doc comments name an argument the declaration does not have, and
one block documents a function that is no longer there.

The Keys and Values views carry the same four each: - Parameter i where the
argument is index, and - Parameter index on subscript(position:).

In the B-tree internals the descriptions usually name the right thing while
the key does not: - node on toNode(leftChild:) says the argument becomes the
left child, and - newElement on exchangeChild(atSlot:with newChild:) says it
is the new child.

_BTree.swift keeps a doc block for a function that was removed: it documents
an offset parameter and sits above an unrelated declaration.
This commit is contained in:
Anton Karpov committed 2026-08-16 21:52:31 +03:00
1 parent f3e778f17a
commit ed41e49a16
7 files changed
+23 -28

No files matched your search

@@ -376,8 +376,8 @@ extension _BTree {
/// This 'consumes' the tree, however it expects the callee to retain the root of the tree for the duration of
/// the cursors lifetime.
///
/// - Parameter key: The key to search for
/// - Returns: A cursor to the key or where the key should be inserted.
/// - Parameter index: The index to take the cursor at
/// - Returns: A cursor to the element at that index.
/// - Complexity: O(`log n`)
@inlinable
internal mutating func takeCursor(at index: Index) -> UnsafeCursor {
@@ -58,7 +58,7 @@ extension _BTree {
/// - node: The node to which this index points.
/// - slot: The specific slot within node where the path points
/// - childSlots: The children's offsets for this path.
/// - index: The absolute offset of this path's element in the tree.
/// - offset: The absolute offset of this path's element in the tree.
/// - tree: The tree of this index.
@inlinable
@inline(__always)
@@ -451,11 +451,6 @@ extension _BTree {
// MARK: Custom Indexing Operations
extension _BTree {
/// Returns a path to the key at absolute offset `i`.
/// - Parameter offset: 0-indexed offset within BTree bounds, else may panic.
/// - Returns: the index of the appropriate element.
/// - Complexity: O(`log n`)
/// Obtains the start index for a key (or where it would exist).
@inlinable
@@ -34,7 +34,7 @@ extension _Node {
/// Converts the splinter object to a node.
/// - Parameters:
/// - node: The node generating the splinter. Becomes the returned
/// - leftChild: The node generating the splinter. Becomes the returned
/// node's left child.
/// - capacity: The desired capacity of the new node.
/// - Returns: A new node of `capacity` with a single element.
@@ -395,7 +395,7 @@ extension _Node.UnsafeHandle {
/// This moves initialized elements to an sequence of initialized element slots in the target handle.
///
/// - Parameters:
/// - newHandle: The destination handle to write to which could be the same
/// - target: The destination handle to write to which could be the same
/// as the source to move within a handle.
/// - sourceSlot: The offset of the source handle to move from.
/// - destinationSlot: The offset of the destination handle to write to.
@@ -437,7 +437,7 @@ extension _Node.UnsafeHandle {
/// This moves initialized children to an sequence of initialized element slots in the target handle.
///
/// - Parameters:
/// - newHandle: The destination handle to write to which could be the same
/// - target: The destination handle to write to which could be the same
/// as the source to move within a handle.
/// - sourceSlot: The offset of the source handle to move from.
/// - destinationSlot: The offset of the destintion handle to write to.
@@ -664,7 +664,7 @@ extension _Node.UnsafeHandle {
/// Swaps the child at a given slot, returning the old one
/// - Parameters:
/// - slot: The initialized slot at which to swap the child
/// - newElement: The new child to insert
/// - newChild: The new child to insert
/// - Returns: The old child from the slot.
@inlinable
@inline(__always)
@@ -118,7 +118,7 @@ extension SortedDictionary.Keys: BidirectionalCollection {
/// The specified index must be a valid index less than `endIndex`, or the
/// returned value won't be a valid index in the collection.
///
/// - Parameter i: A valid index of the collection.
/// - Parameter index: A valid index of the collection.
///
/// - Complexity: O(log(`self.count`))
@inlinable
@@ -132,9 +132,9 @@ extension SortedDictionary.Keys: BidirectionalCollection {
/// The specified index must be a valid index less than `endIndex`, or the
/// returned value won't be a valid index in the collection.
///
/// - Parameter i: A valid index of the collection.
/// - Parameter index: A valid index of the collection.
///
/// - Returns: The index immediately after `i`.
/// - Returns: The index immediately after `index`.
///
/// - Complexity: O(log(`self.count`))
@inlinable
@@ -148,7 +148,7 @@ extension SortedDictionary.Keys: BidirectionalCollection {
/// The specified index must be a valid index less than `endIndex`, or the
/// returned value won't be a valid index in the collection.
///
/// - Parameter i: A valid index of the collection.
/// - Parameter index: A valid index of the collection.
///
/// - Complexity: O(log(`self.count`))
@inlinable
@@ -162,9 +162,9 @@ extension SortedDictionary.Keys: BidirectionalCollection {
/// The specified index must be a valid index greater than `startIndex`, or
/// the returned value won't be a valid index in the collection.
///
/// - Parameter i: A valid index of the collection.
/// - Parameter index: A valid index of the collection.
///
/// - Returns: The index immediately before `i`.
/// - Returns: The index immediately before `index`.
///
/// - Complexity: O(log(`self.count`))
@inlinable
@@ -214,8 +214,8 @@ extension SortedDictionary.Keys: BidirectionalCollection {
extension SortedDictionary.Keys {
/// 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
@@ -118,7 +118,7 @@ extension SortedDictionary.Values: BidirectionalCollection {
/// The specified index must be a valid index less than `endIndex`, or the
/// returned value won't be a valid index in the collection.
///
/// - Parameter i: A valid index of the collection.
/// - Parameter index: A valid index of the collection.
///
/// - Complexity: O(log(`self.count`))
@inlinable
@@ -132,9 +132,9 @@ extension SortedDictionary.Values: BidirectionalCollection {
/// The specified index must be a valid index less than `endIndex`, or the
/// returned value won't be a valid index in the collection.
///
/// - Parameter i: A valid index of the collection.
/// - Parameter index: A valid index of the collection.
///
/// - Returns: The index immediately after `i`.
/// - Returns: The index immediately after `index`.
///
/// - Complexity: O(log(`self.count`))
@inlinable
@@ -148,7 +148,7 @@ extension SortedDictionary.Values: BidirectionalCollection {
/// The specified index must be a valid index less than `endIndex`, or the
/// returned value won't be a valid index in the collection.
///
/// - Parameter i: A valid index of the collection.
/// - Parameter index: A valid index of the collection.
///
/// - Complexity: O(log(`self.count`))
@inlinable
@@ -162,9 +162,9 @@ extension SortedDictionary.Values: BidirectionalCollection {
/// The specified index must be a valid index greater than `startIndex`, or
/// the returned value won't be a valid index in the collection.
///
/// - Parameter i: A valid index of the collection.
/// - Parameter index: A valid index of the collection.
///
/// - Returns: The index immediately before `i`.
/// - Returns: The index immediately before `index`.
///
/// - Complexity: O(`log n`) where `n` is the number of key-value pairs in the
/// sorted dictionary.
@@ -215,8 +215,8 @@ extension SortedDictionary.Values: BidirectionalCollection {
extension SortedDictionary.Values {
/// 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