Skip to content

Migrate to internal imports #755

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 25, 2024
Merged

Conversation

tshortli
Copy link
Contributor

As of the Swift 6 compiler, @_implementationOnly import is deprecated in favor of internal import and as a result the use of @_implementationOnly import in this project is generating a lot of diagnostic noise when building the Swift standard library.

For Swift libraries with library evolution, @_implementationOnly import and internal import are roughly functionally equivalent, aside from improved diagnostics for internal import. For non-resilient libraries, the main difference is that internal import does not actually hide a module dependency from downstream clients because the layout of a type in a non-resilient library may depend on types coming from an internal import (with @_implementationOnly import the same situation would result in a silent mis-compile, which is the reason that @_implementationOnly import is deprecated). The _RegexParser module dependency does not need to be hidden from clients since it is installed in standard locations in the SDK/toolchain. Therefore this migration should be safe, regardless of library resilience mode.

As of the Swift 6 compiler, `@_implementationOnly import` is deprecated in
favor of `internal import` and as a result the use of `@_implementationOnly
import` in this project is generating a lot of diagnostic noise when building
the Swift standard library.

For Swift libraries with library evolution, `@_implementationOnly import` and
`internal import` are roughly functionally equivalent, aside from improved
diagnostics for `internal import`. For non-resilient libraries, the main
difference is that `internal import` does not actually hide a module dependency
from downstream clients because the layout of a type in a non-resilient library
may depend on types coming from an `internal import` (with
`@_implementationOnly import` the same situation would result in a silent
mis-compile, which is the reason that `@_implementationOnly import` is
deprecated). The `_RegexParser` module dependency does not need to be hidden
from clients since it is installed in standard locations in the SDK/toolchain.
Therefore this migration should be safe, regardless of library resilience mode.
@tshortli tshortli requested review from xymus and natecook1000 July 24, 2024 20:45
@tshortli
Copy link
Contributor Author

@swift-ci please test

@tshortli tshortli merged commit 1031c9d into swiftlang:main Jul 25, 2024
2 checks passed
@tshortli tshortli deleted the internal-import branch July 25, 2024 16:50
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.

2 participants