Skip to content

Sema: Introduce getUnmetAvailabilityRequirement() #77362

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

tshortli
Copy link
Contributor

@tshortli tshortli commented Nov 3, 2024

Replace the family of checkDeclarationAvailability() functions with getUnmetAvailabilityRequirement(). This will ensure that callers correctly handle all of the possible reasons for unavailability, instead of checking for them piecemeal.

NFC.

It's now unused outside of `TypeCheckAvailability.cpp`.
Type checker functions with the prefix "check" usually check some requirement
and then diagnose it if it isn't satisfied. `checkDeclarationAvailability()`
doesn't diagnose on its own, so it should be named differently.
This type will need to be used outside of Sema.
Introduce a convenience overload for the common case where the
AvailabilityContext must first be looked up by source location.
Adopt `getUnmetDeclAvailabilityRequirement()` instead.
@tshortli tshortli changed the title Replace checkDeclarationAvailability() with getUnmetAvailabilityRequirement() Introduce getUnmetAvailabilityRequirement() Nov 3, 2024
@tshortli tshortli changed the title Introduce getUnmetAvailabilityRequirement() Sema: Introduce getUnmetAvailabilityRequirement() Nov 3, 2024
@tshortli tshortli marked this pull request as ready for review November 3, 2024 19:59
@tshortli tshortli force-pushed the replace-check-declaration-availability branch from 7f7664a to 242b9cc Compare November 3, 2024 20:10
Adopt `getUnmetDeclAvailabilityRequirement()` instead.
@tshortli tshortli force-pushed the replace-check-declaration-availability branch from 242b9cc to c044321 Compare November 4, 2024 01:42
@tshortli
Copy link
Contributor Author

tshortli commented Nov 4, 2024

@swift-ci please smoke test

@tshortli tshortli merged commit 229ca24 into swiftlang:main Nov 4, 2024
3 checks passed
@tshortli tshortli deleted the replace-check-declaration-availability branch November 4, 2024 18:20
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