Skip to content

[5.3][ModuleInterface] Print some implementation-only imports in the private interface #32902

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 1 commit into from
Jul 17, 2020

Conversation

xymus
Copy link
Contributor

@xymus xymus commented Jul 15, 2020

Introduce an experimental feature to print implementation-only imports that include SPIs in the private swiftinterface, e.g. @_implementationOnly @_spi(Private) import A. This allows projects to export types from implementation-only imports in local SPI and aligns the behavior of compiling against binary interfaces with the use of private textual interfaces.

This is a temporary solution behind the frontend flag -experimental-spi-imports.

  • Scope of Issue: This is affecting the private swiftinterface of projects exporting implementation-only imported types in SPI.
  • Origination: The introduction of the @_spi attribute.
  • Risk: Very low, this feature is hidden behind a feature flag.
  • Resolves: rdar://65696882

@xymus xymus added the r5.3 label Jul 15, 2020
@xymus xymus requested a review from a team as a code owner July 15, 2020 17:06
@xymus

This comment has been minimized.

@xymus
Copy link
Contributor Author

xymus commented Jul 15, 2020

@swift-ci Please test

@swift-ci

This comment has been minimized.

@swift-ci

This comment has been minimized.

Copy link
Contributor

@beccadax beccadax left a comment

Choose a reason for hiding this comment

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

This seems okay as a workaround, but I'm a little confused about what happens when you're working with swiftmodule files instead of swiftinterfaces. Can you explain?

@xymus
Copy link
Contributor Author

xymus commented Jul 15, 2020

This seems okay as a workaround, but I'm a little confused about what happens when you're working with swiftmodule files instead of swiftinterfaces. Can you explain?

A swiftmodule file that has implementation-only imports and SPIs relying on the imports works because of deserialization recovery. A client can access the SPIs only if the client also imported the module behind the related implementation-only import. If the module isn't imported by the client, the SPIs fail to deserialize and are not visible. We don't want to rely on deserialization recovery for this in the long term either.

…te interface

Print implementation-only imports in the private textual interface
only if also importing SPI. This allows to export types from
implementation-only imports in SPI and brings the private textual
interfaces in line with the binary interfaces.

This is a temporary solution as we need to better design the language
feature around this.

This feature requires passing -experimental-spi-imports to the frontend
that generates the private swiftinterface file.
@xymus
Copy link
Contributor Author

xymus commented Jul 15, 2020

Integrated comments and move the feature behind an opt-in flag as suggested by @nkcsgexi.

@swift-ci Please 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.

Thank you, @xymus !

@swift-ci

This comment has been minimized.

@swift-ci

This comment has been minimized.

@xymus
Copy link
Contributor Author

xymus commented Jul 17, 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.

6 participants