Skip to content

[5.9] AST: Get SPI status of PatternBindingDecl from anchoring VarDecl #67812

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 Aug 8, 2023

  • Explanation: Availability checking was inappropriately rejecting references to potentially unavailable types referenced by @_spi public property declarations in -library-level api modules. The fix is to make the isSPI() query in the compiler look for @_spi attributes attached to the VarDecl AST node associated with a given PatternBindingDecl AST node.
  • Scope: Medium. Affects the results of SPI queries which are performed in many parts of the compiler.
  • Risk: Medium. The isSPI() query returning true for more declarations could reveal additional typechecking bugs or otherwise break source in projects using @_spi.
  • Reviewed by: @xymus
  • Original pull request: AST: Get SPI status of PatternBindingDecl from anchoring VarDecl #67811
  • Issue: rdar://113587321

@tshortli tshortli requested a review from a team as a code owner August 8, 2023 23:25
@tshortli
Copy link
Contributor Author

tshortli commented Aug 8, 2023

@swift-ci please test

@tshortli tshortli added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.9 labels Aug 10, 2023
For property declarations, the `@_spi` attribute is attached to the VarDecl AST
node, rather than the PatternBindingDecl AST node, so the `isSPI()` query
should take this into account. Failing to do so caused the availability checker
to erroneously require that `@_spi` properties of types in `-library-level api`
libraries have availability annotations.

Resolves rdar://113587321.
@tshortli tshortli force-pushed the spi-property-availability-5.9 branch from 198462b to 560328f Compare August 10, 2023 05:04
@tshortli
Copy link
Contributor Author

@swift-ci please test

@tshortli tshortli requested a review from nkcsgexi August 10, 2023 15:49
@tshortli tshortli merged commit 204bdda into swiftlang:release/5.9 Aug 10, 2023
@tshortli tshortli deleted the spi-property-availability-5.9 branch August 10, 2023 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.9
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants