-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Further adoption of SemanticAvailableAttr
#78454
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
tshortli
merged 17 commits into
swiftlang:main
from
tshortli:adopt-semantic-available-attr-part-2
Jan 7, 2025
Merged
Further adoption of SemanticAvailableAttr
#78454
tshortli
merged 17 commits into
swiftlang:main
from
tshortli:adopt-semantic-available-attr-part-2
Jan 7, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@swift-ci please test |
@swift-ci please build macOS toolchain |
It replaces `AvailabilityInference::attrForAnnotatedAvailableRange()`.
It replaces the overload of AvailabilityInference::availableRange() that takes an AvailableAttr.
d2c2c63
to
77141c5
Compare
@swift-ci please smoke test |
@swift-ci please build macOS toolchain |
SymbolGraphGen updates look good. Thanks for pushing this out! |
tshortli
added a commit
to tshortli/swift
that referenced
this pull request
Jan 25, 2025
…ions. In swiftlang#78454 queries for the platform availability of decl were consolidated into `Decl::getAvailableAttrForPlatformIntroduction()`. In addition to checking the attributes directly attached to the decl, this method also checks whether the decl is a member directly contained inside of an extension and checks for attributes attached to the extension as well. Previously, this logic was only used for availability checking diagnostics, where special casing extension members was a requirement. As a result of the consolidation, though, the logic is now also shared by the query that determines whether to weakly link symbols associated with a decl. That determination already had its own way of handling members of extensions but it seemed like consolidating the logic would stil be a net improvement that would reduce overall complexity. Unfortunately, the existing approach to getting the availability of the enclosing extension had a subtle bug for both AccessorDecl and OpaqueTypeDecl. If an AvailableAttr was not directly attached to the immediate decl, then `Decl::getAvailableAttrForPlatformIntroduction()` would check if the enclosing decl context was an extension and look at its attributes as well. For AccessorDecl and OpaqueTypeDecl, checking the enclosing decl context would accidentally skip over the VarDecl and AbstractFunctionDecl that are formally the parents of those decls for the purposes of attribute inheritance. As a result, the availability of the enclosing property or function could be ignored if the enclosing extension had explicit availability attributes. The fix is to use `AvailabilityInference::parentDeclForInferredAvailability()` instead of `getDeclContext()` when looking for the immediately enclosing extension. Resolves rdar://143139472.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adopt
SemanticAvailableAttr
as a replacement forAvailableAttr
more thoroughly in much of the compiler. Builds on #78308.NFC.