Skip to content

[5.3] Check SPI usage of implementation-only types, in frozen types and on protocol requirements #31761

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
merged 3 commits into from
May 13, 2020

Conversation

xymus
Copy link
Contributor

@xymus xymus commented May 13, 2020

Cherry-pick of #31744 and #31737.

  • Explanation:
    Check for three invalid uses of Swift SPI:
    • Exposing implementation-only types in SPI function signatures could make the compiler emit invalid .private.swiftinterface files.
    • Marking a stored property in a frozen struct as SPI would prevent external clients from knowing the correct struct layout.
    • Declaring a protocol requirement as SPI in a public protocol could break external clients unless there is a default implementation in the defining module.
  • Scope: The checks apply only to the use of the @_spi attribute.
  • Risk: Low
  • Testing: Added new tests for each case.
  • Resolves rdar://63193289
  • Reviewed by @nkcsgexi and @brentdax

@xymus xymus requested a review from a team as a code owner May 13, 2020 18:57
@xymus

This comment has been minimized.

@xymus xymus force-pushed the spi-checks-5.3 branch from b0d109d to 0a945fa Compare May 13, 2020 19:00
@xymus
Copy link
Contributor Author

xymus commented May 13, 2020

@swift-ci Please test

@swift-ci

This comment has been minimized.

@swift-ci

This comment has been minimized.

@xymus
Copy link
Contributor Author

xymus commented May 13, 2020

@swift-ci Please nominate

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.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants