Skip to content

Conversation

@d-ronnqvist
Copy link
Contributor

Bug/issue #, if applicable: rdar://160232871

Summary

This fixes issues where certain type disambiguation spellings with generics in symbol links wouldn't match the corresponding symbol.

Dependencies

None

Testing

  • Define two method overloads that differ by a generic parameter. For example:

    public struct Something {
        public func doSomething(_ keyPath: KeyPath<Something, Int>)    {}
        public func doSomething(_ keyPath: KeyPath<Something, String>) {}
    }
  • Write an ambiguous link to these overloads. For example:

    /// An ambiguous link to ``doSomething(_:)``
    
  • Build DocC's suggestion and accept one of the suggestions for how to disambiguate the link. For example:

    ``doSomething(_:)-(KeyPath<Something,Int>)``
    
  • Build documentation again.

    • The link should resolve successfully to that overload.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist d-ronnqvist force-pushed the links-with-generic-type-disambiguation branch from 7e362ab to ea39ee8 Compare November 7, 2025 12:49
@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@patshaughnessy patshaughnessy left a comment

Choose a reason for hiding this comment

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

Looks good!

return scan(past: predicate)
}

mutating func scanValue() -> Substring? {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a doc comment with an example value, to make this code a bit easier to follow. Same throughout for scanArgument, scanTuple, etc.

We have the nice ascii-art diagrams above near the definition of parseTypeSignatureDisambiguation. Maybe just paste a piece of that for each of these utility functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added some documentation to the private scanner API—with examples that show the scanner's state—in 6a9718b

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist d-ronnqvist merged commit a9569b4 into swiftlang:main Nov 12, 2025
2 checks passed
@d-ronnqvist d-ronnqvist deleted the links-with-generic-type-disambiguation branch November 12, 2025 13:55
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