Skip to content

Conversation

@tshortli
Copy link
Contributor

@tshortli tshortli commented Feb 9, 2025

Computing the unsatisfied availability constraints for a declaration when used in a given context is a fundamental building block of availability checking, but the implementation is a bit scattered and hard to share everywhere it's needed. Begin consolidating that logic in swift::getAvailabilityConstraintsForDecl() and adopt it when constraining an AvailabilityContext with the attributes of a declaration.

This new query is designed to become the canonical source of information
regarding whether a declaration is available to use in a given
`AvailabilityContext`. It should be adopted as the foundational building block
for all other queries that answer more specific questions about the
availability of a specific delcaration.

The implementation of this query has been copied from a variety of sources
which should eventually be deleted once the new query has been fully adopted.

NFC.
Call `swift::getAvailabilityConstraintsForDecl()` to gather the constraints
that should be added to an AvailabilityContext when constraining it to the
availability of a given declaration.
@tshortli
Copy link
Contributor Author

tshortli commented Feb 9, 2025

@swift-ci please test

@tshortli tshortli enabled auto-merge February 9, 2025 08:16
@tshortli tshortli merged commit 716cc5c into swiftlang:main Feb 9, 2025
4 of 5 checks passed
@tshortli tshortli deleted the availability-constraints branch February 9, 2025 17:04
tshortli added a commit to tshortli/swift that referenced this pull request Feb 21, 2025
If a conformance is unavailable then checking for the potential unavailability
of a witness doesn't make sense so skip it. This is necessary now because
availability scopes no longer constrain the platform introduction version for a
source range in that is annotated in source to be simultaneously unavailable
and also introduced in a later version.

This fixes a regression caused by swiftlang#79249.

Resolves rdar://145255592.
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