[5.9][Serialization] Load non-public transitive dependencies on @testable imports #64794
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A
@testable
import allows a client to call internal decls which may refer to non-public dependencies. To support such a use case, load non-public transitive dependencies of a module when it's imported@testable
from the main module.We apply this behavior only to
@testable
imports from the main module being built, not transitively trough@testable
imports of a library. It should support the vast majority of@testable
uses and provide a reasonable behavior without surprises.This replaces the previous behavior where we loaded those dependencies for any modules built for testing. This would load more modules for any debug build, opening the door to a different behavior between debug and release builds. In contrast, applying this logic to
@testable
clients will only change the behavior of test targets.rdar://107329303
Cherry-pick of the feature from #64693, plus as support: #64516 and #64522.
This affects only the new kind of imports using access level, as it's still behind a flag it should be low risk and not affect existing projects.