Skip to content

optionalRequirementOf relationships take precedence over non-optional ones #1252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

QuietMisdreavus
Copy link
Contributor

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

Summary

Prior to Swift 6.1 (specifically swiftlang/swift#76983), Swift symbol graphs would contain both requirementOf and optionalRequirementOf relationships for imported optional Objective-C protocol methods. This can confuse Swift-DocC into nondeterministically displaying a "Required" marker for optional requirements based on which relationship it reads last. This PR addresses this nondeterminism by making optionalRequirementOf relationships take precedence over requirementOf ones in the SymbolGraphRelationshipsBuilder.

Dependencies

None

Testing

Steps:

  1. Render documentation for a module with an imported Objective-C optional protocol requirement, as mentioned above.
  2. Ensure that the "Required" indicator is not rendered for the optional requirement, even on repeated runs.

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
  • [ n/a ] Updated documentation if necessary

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please test

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please test macOS

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.

1 participant