Fix the parameter callout on the mutating trimPrefix(while:) - #287
Open
hxperl wants to merge 1 commit into
Open
Conversation
The `Collection where Self == Self.SubSequence` overload of `trimPrefix(while:)` writes its parameter callout as `- Parameters predicate:` — plural `Parameters`, which DocC reads as the header of a nested parameter list rather than as a `- Parameter <name>:` entry. Because no nested list follows, the entry binds to nothing and the description is dropped from the rendered page entirely: the method shows no Parameters section at all. The other eight callouts in this file, including the near-identical overload 25 lines above, already use the singular form.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's wrong
Sources/Algorithms/Trim.swift:83, on theCollection where Self == Self.SubSequenceoverload of
trimPrefix(while:), writes the parameter callout with a pluralParameters:DocC treats
- Parametersas the header of a nested parameter list, not as a- Parameter <name>:entry. No nested list follows, so the entry binds to nothingand — this is the part that matters — the description is not merely misplaced, it is
dropped from the rendered page entirely. The method documents one parameter and
ends up showing none.
The other eight parameter callouts in this file already use the singular form,
including the near-identical overload 25 lines above, so the file contradicts itself.
Reproduction
On
mainat5b7143f8e291dee0e14c118fd0212487f0b37af5, before changing anything.The two
trimPrefix(while:)overloads are an unusually clean control pair — DocCrenders their declarations identically, so the only variable is the callout spelling:
data/documentation/algorithms/swift/collection/:No
parameterssection. Grepping the rendered pages for the description text:The Discussion of the affected page contains only the heading, the example
paragraph, the code listing and the Complexity aside — the parameter text is not in
it. The
- Complexity:aside is unaffected and still renders correctly.Note that
-emit-extension-block-symbolsis required to reproduce:trimPrefix(while:)extends a stdlib protocol, so without it the page is not generated at all and there is
nothing to inspect. That is also why this is easy to miss.
Worth stating plainly: DocC emits no diagnostic for this.
docc convertexits 0with an empty warning list. The rendered output is the only evidence.
After
Same commands on this branch:
Scope
One word, one line. This is the only occurrence in the repository — I grepped
Sources/andTests/for- Parameters <name>:and for backticked parameter names(the other way DocC silently fails to bind a parameter) and found nothing else.
Tests
swift teston macOS 15 arm64, Swift 6.2:Exit code 0. For a comment-only change this is a regression check rather than evidence
for the fix — the rendered DocC output above is the evidence. macOS only; CI will need
to confirm the other platforms, though I would not expect a doc-comment change to
differ by platform.
Disclosure
This change was written with AI assistance. The reproduction, the DocC runs and the
test output above are real output from my machine, not generated text.