Skip to content

Name the documented arguments the way the declarations name them - #701

Open
karpovantonme wants to merge 1 commit into
apple:mainfrom
karpovantonme:doc/parameter-names
Open

Name the documented arguments the way the declarations name them#701
karpovantonme wants to merge 1 commit into
apple:mainfrom
karpovantonme:doc/parameter-names

Conversation

@karpovantonme

@karpovantonme karpovantonme commented Aug 13, 2026

Copy link
Copy Markdown

25 doc comments in the shipping modules name an argument that the declaration below them does not have, so DocC has nothing to bind the description to and drops it. Nothing warns about this: Swift has no equivalent of -Wdocumentation, and DocC stays silent rather than complaining

Most are renames the comment did not follow, and the file itself usually holds the proof:

  • RigidDeque.prepend documents - maxCount while its own - Complexity: O(newItemCount ?? self.freeCapacity) two lines below already uses the new name
  • RigidArray.append(copying:) has 3 overloads. The oldest takes newElements and its comment is right; the 2 newer ones take items and carry the older one's wording
  • BitArray.index(after:) writes the name in backticks, which DocC does not bind either, and the argument is i. Two functions below, formIndex(after i:) gets it right

3 entries name an argument that no longer exists at all rather than a renamed one, so they are removed instead: stoppingOnFirstDuplicateValue on fill(untilFirstDuplicateIn:) and duplicates on the two _HashTable.create overloads, where the behaviour now lives in the function name

where a description or a - Complexity: line referred to the old name too, it was brought along, so each block reads consistently

SortedCollections is left out on purpose: it sits behind the UnstableSortedCollections trait and has 17 more of these, which felt like a separate conversation. Happy to send that as its own PR if you want it

One I left alone: UniqueArray.nextSpan(after:) documents maxCount, but the whole block looks copied from the nextSpan(maxCount:after:) overload, and I could not tell whether you would rather drop the entry or the block

Comments only, no API change

btw these came out of a checker I wrote for exactly this, run over the tree and then read one by one. 6 of the things it flagged turned out to be my parser rather than your code, and those are fixed on my side rather than sent to you

Checklist

  • I've read the Contribution Guidelines
  • My contributions are licensed under the Swift license.
  • I've followed the coding style of the rest of the project.
  • I've added tests covering all new code paths my change adds to the project (if appropriate).
  • I've added benchmarks covering new functionality (if appropriate).
  • I've verified that my change does not break any existing tests or introduce unexplained benchmark regressions.
  • I've updated the documentation if necessary.

Twenty-five doc comments in the shipping modules name an argument that the
declaration below them does not have, so DocC has nothing to bind the
description to and drops it. Nothing warns about this.

Most of them are renames that the comment did not follow, and the file itself
usually holds the proof: RigidDeque.prepend says - maxCount while its own
Complexity line already says newItemCount, and append(copying:) has three
overloads where the oldest still takes newElements and the two newer ones take
items with the older one's wording.

Three entries name an argument that no longer exists at all and are removed
rather than renamed.
karpovantonme added a commit to karpovantonme/swift-collections that referenced this pull request Aug 16, 2026
…tions name them

Same species as apple#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.
karpovantonme added a commit to karpovantonme/swift-collections that referenced this pull request Aug 16, 2026
…tions name them

Same species as apple#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.

@lorentey lorentey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing all these! 👍

@lorentey lorentey added this to the 1.7.0 milestone Aug 18, 2026
@lorentey

Copy link
Copy Markdown
Member

The failing check is due to a CI issue; #706 will eventually resolve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants