Skip to content
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

[TBDGen] Track unavailable declarations against the active platform for api generation #73284

Merged
merged 1 commit into from May 1, 2024

Conversation

cyndyishida
Copy link
Member

This resolves the bug where api json files recorded declarations as unavailable purely because it was unavailable on unrelated platforms.

Resolves: rdar://113552185

api generation

This resolves the bug where apijson files recorded declarations as
unavailable purely because it was unavailable on a unrelated platforms.

Resolves: rdar://113552185
Copy link
Member

@zixu-w zixu-w left a comment

Choose a reason for hiding this comment

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

Good find. Thanks Cyndy!

@cyndyishida
Copy link
Member Author

@swift-ci please test

Copy link
Contributor

@tshortli tshortli left a comment

Choose a reason for hiding this comment

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

Thanks Cyndy! I think this is the first time I'm reading this code in detail, and now that my attention has been drawn to it I see a number of issues because there's some complex logic implemented in Sema for availability checking that doesn't appear to be taken into account here. I don't think they need to be fixed in this PR, but I'll file some radars to track the following:

  • Availability declared in the enclosing scope, but not directly on the specific declaration, is not considered here.
  • For some platforms, availability is inherited implicitly from the attributes for other platforms when there is no explicit availability for the target platform (e.g. iOS availability is used for macCatalyst frameworks).
  • There may be some nuances with application extension availability attributes that aren't handled here.

@tshortli
Copy link
Contributor

I don't think they need to be fixed in this PR, but I'll file some radars

rdar://127126725

@cyndyishida
Copy link
Member Author

Thanks Cyndy! I think this is the first time I'm reading this code in detail, and now that my attention has been drawn to it I see a number of issues because there's some complex logic implemented in Sema for availability checking that doesn't appear to be taken into account here. I don't think they need to be fixed in this PR, but I'll file some radars to track the following:

  • Availability declared in the enclosing scope, but not directly on the specific declaration, is not considered here.
  • For some platforms, availability is inherited implicitly from the attributes for other platforms when there is no explicit availability for the target platform (e.g. iOS availability is used for macCatalyst frameworks).
  • There may be some nuances with application extension availability attributes that aren't handled here.

Sounds good! Thanks for flagging this. My preferred approach here is to be able to query given the active target triple, if this declaration is unavailable and the serialization code does not handle any platform-specific details like implied availability. Maybe it's useful to distinguish whether it's deployment version-specific. Not sure if sdkdb generation happens strictly after Sema but it likely should so that concrete availability has already been figured out.

@cyndyishida
Copy link
Member Author

@swift-ci please smoke test

@cyndyishida cyndyishida merged commit 84d3618 into apple:main May 1, 2024
5 checks passed
@cyndyishida cyndyishida deleted the eng/PR-unavailability branch May 1, 2024 14:14
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.

None yet

4 participants