Skip to content

Conversation

RalucaP
Copy link
Contributor

@RalucaP RalucaP commented Oct 7, 2025

Bug/issue: rdar://158142013

Summary

This PR addresses an inconsistency in platform representation within declaration fragments. Previously, when iOS was present in a symbol's platform availability, declaration fragments would only show iOS, while other parts of the system correctly included fallback platforms (iPadOS and Mac Catalyst).

The implementation adds automatic platform expansion using the existing DefaultAvailability.fallbackPlatforms mapping to ensure consistent platform representation across all documentation outputs.

Dependencies

None.

Testing

The functionality can be tested using the provided Availability.docc sample bundle.
Availability.docc.zip

Steps:

  1. Run swift run docc convert Availability.docc --output-dir /tmp/docc-test-output --emit-digest
  2. Examine the generated JSON files to verify platform expansion:
    cat /tmp/docc-test-output/data/documentation/availability/availability-*.json | \
      jq '.primaryContentSections[] | select(.kind == "declarations") | .declarations[].platforms'
  3. Expected output
    [
       "iOS",
       "iPadOS", 
       "Mac Catalyst"
    ]

Checklist

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

Updates test assertions to expect iOS + iPadOS + Mac Catalyst when iOS is present in declaration platforms, using Set-based comparisons for order-independent testing. The modified tests are temporarily skipped until the platform expansion functionality is implemented in the next commit.
… fragments

Automatically expands iOS to include its fallback platforms (iPadOS and Mac Catalyst) in declaration fragment platform arrays to ensure consistent platform representation. Uses the existing DefaultAvailability.fallbackPlatforms mapping to determine which platforms should be included when a base platform is present.

rdar://158142013
@RalucaP RalucaP force-pushed the fix-missing-platforms-in-declaration-fragments branch from 3a1efba to a3a88e7 Compare October 7, 2025 17:50
Copy link
Contributor

@QuietMisdreavus QuietMisdreavus 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, thanks!

@QuietMisdreavus
Copy link
Contributor

@swift-ci Please test

@d-ronnqvist d-ronnqvist merged commit c5f99a2 into swiftlang:main Oct 8, 2025
2 checks passed
@RalucaP RalucaP deleted the fix-missing-platforms-in-declaration-fragments branch October 8, 2025 14:24
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