Skip to content

[Sema] Forbid leaking implementation-only imported types in SPI decls #31744

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

Conversation

xymus
Copy link
Contributor

@xymus xymus commented May 12, 2020

The use of @_spi(Secret) @_implementationOnly import Lib means that the API and Secret SPI of Lib is imported for use in local implementation details and the dependency on Lib is hidden from all clients. This PR fixes a flaw allowing types imported as implementation-only to be exposed in the SPI of the local module. This could lead to the compiler emitting an invalid .private.swiftinterface file that would use types in SPI signatures without the related import hidden from even internal clients.

We are considering changing the meaning of such an import but for now let’s make sure to enforce the expected behavior in a consistent way.

@xymus xymus requested a review from nkcsgexi May 12, 2020 23:45
@xymus xymus force-pushed the dont-leak-ioi-in-spi branch from 37644c8 to 08abc0d Compare May 12, 2020 23:54
@xymus
Copy link
Contributor Author

xymus commented May 12, 2020

@swift-ci Please smoke test

1 similar comment
@shahmishal
Copy link
Member

@swift-ci Please smoke test

Copy link
Contributor

@nkcsgexi nkcsgexi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@xymus xymus merged commit 4c4724c into swiftlang:master May 13, 2020
@xymus xymus deleted the dont-leak-ioi-in-spi branch May 13, 2020 18:14
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.

3 participants