Skip to content

Hide parameter and return value documentation from properties. #968

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

Merged

Conversation

d-ronnqvist
Copy link
Contributor

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

Summary

This fixes a bug where parameter and return value documentation wasn't hidden from language representations of a symbol without a function signature (for example properties).

With these changes, if one of the symbol's language representation has a function signature, all property and return value documentation will be hidden from its language representations that don't have function signatures.

Dependencies

None

Testing

  • In a mixed Swift and Objective-C project, add a symbol that's a function in C but refines to a property in Swift. For example

    typedef struct {
        CGPoint center;
        CGFloat radius;
    } TLACircle NS_SWIFT_NAME(Circle);
    
    /// Returns whether a circle has zero radius.
    /// - Parameter circle: The circle to examine.
    /// - Returns: `YES` if the specified circle is empty; otherwise, `NO`.
    BOOL TLACircleIsEmpty(TLACircle circle) NS_SWIFT_NAME(getter:Circle.isEmpty(self:));
  • Build documentation for the project and view the isEmpty Swift property documentation.

    • The Swift language representation shouldn't display a parameters or return value section.
    • The C/Objective-C language representation should display both a parameters or return value section.

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 Not applicable.

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@anferbui anferbui left a comment

Choose a reason for hiding this comment

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

Left some small comments, feel free to address them if you think they're relevant, otherwise I'm happy with this being merged.

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist d-ronnqvist merged commit 5280182 into swiftlang:main Jul 9, 2024
2 checks passed
@d-ronnqvist d-ronnqvist deleted the no-parameters-for-properties branch July 9, 2024 16:47
d-ronnqvist added a commit to d-ronnqvist/swift-docc that referenced this pull request Jul 9, 2024
…lang#968)

* Hide parameter and return value documentation from properties

rdar://130750134

* Apply suggestions from code review

Co-authored-by: Pete Lawrence <[email protected]>
Co-authored-by: Andrea Fernandez Buitrago <[email protected]>

* Fix misaligned guard conditions

---------

Co-authored-by: Pete Lawrence <[email protected]>
Co-authored-by: Andrea Fernandez Buitrago <[email protected]>
d-ronnqvist added a commit that referenced this pull request Jul 10, 2024
…#978)

* Hide parameter and return value documentation from properties

rdar://130750134

* Apply suggestions from code review

Co-authored-by: Pete Lawrence <[email protected]>
Co-authored-by: Andrea Fernandez Buitrago <[email protected]>

* Fix misaligned guard conditions
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.

3 participants