Skip to content

[5.9] Sema: Correct availability for @inlinable global var accessors bodies #67851

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

Conversation

tshortli
Copy link
Contributor

@tshortli tshortli commented Aug 10, 2023

  • Explanation: The bodies of unavailable functions should be typechecked as if they would always run at the deployment target, even if they are @inlinable. This was not the case in the bodies of unavailable @inlinable global var accessors, though, because the availability of the accessor, rather than enclosing var, was being queried. The fix is to use getSemanticUnavailableAttr().
  • Scope: Medium. This typechecking change affects availability checking in the bodies of inlinable function bodies in API libraries. The effect is limited to the bodies of functions that are marked unavailable with @available, so that mitigates the impact.
  • Risk: Medium. This kind of change to availability checking can reveal additional compiler bugs and previously undiagnosed issues in projects.
  • Reviewed by: @xymus @artemcm
  • Original pull request: Sema: Correct availability for @inlinable global var accessors bodies #67850
  • Issue: rdar://113642576

@tshortli
Copy link
Contributor Author

@swift-ci please test

@tshortli tshortli added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.9 labels Aug 10, 2023
@tshortli tshortli force-pushed the unavailable-inlinable-computed-property-availability-5.9 branch 2 times, most recently from 9948342 to 2c18fc6 Compare August 10, 2023 05:22
The bodies of unavailable functions should be typechecked as if they would
always run at the deployment target, even if they are `@inlinable`. This was
not the case in the bodies of unavailable `@inlinable` global var accessor,
though, because the availability of the accessor, rather than enclosing var,
was being queried. The fix is to use `getSemanticUnavailableAttr()`.

Resolves rdar://113642576
@tshortli tshortli force-pushed the unavailable-inlinable-computed-property-availability-5.9 branch from 2c18fc6 to 06265dc Compare August 10, 2023 16:40
@tshortli
Copy link
Contributor Author

@swift-ci please test

@tshortli tshortli marked this pull request as ready for review August 10, 2023 17:24
@tshortli tshortli requested a review from a team as a code owner August 10, 2023 17:24
@tshortli tshortli merged commit af4aa98 into swiftlang:release/5.9 Aug 10, 2023
@tshortli tshortli deleted the unavailable-inlinable-computed-property-availability-5.9 branch August 10, 2023 23:02
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