Skip to content

[Serialization] Attempt to load transitive implementation-only dependencies on testable imports #64783

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
Mar 31, 2023

Conversation

xymus
Copy link
Contributor

@xymus xymus commented Mar 30, 2023

Implementation-only dependencies may be referenced from internal decls. When that module is imported as @testable, clients see the internal decls and may fail accessing them if the transitive implementation-only dependencies are not loaded.

Let's consider such transitive implementation-only dependencies as optional for @testable clients. As such, the compiler will attempt to load them for test targets, and won't fail if the dependency is missing.

We can make these dependencies required for non-public imports, but it could be project breaking to do so for implementation-only dependencies. Considering them as optional is a decent compromise.

rdar://79459263

@xymus
Copy link
Contributor Author

xymus commented Mar 30, 2023

@swift-ci Please smoke test

@xymus
Copy link
Contributor Author

xymus commented Mar 30, 2023

@swift-ci Please Test Source Compatibility Debug

@@ -1702,7 +1702,7 @@ ModuleFileSharedCore::getTransitiveLoadingBehavior(
if (dependency.isImplementationOnly()) {
// Implementation-only dependencies are not usually loaded from
// transitive imports.
if (debuggerMode) {
if (debuggerMode || forTestable) {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

…testable imports

Implementation-only dependencies may be referenced from internal decls.
When that module is imported as @testable, clients see the internal
decls and may fail accessing them if the transitive implementation-only
dependencies are not loaded.

Let's consider such transtive implementation-only dependencies as
optional for @testable imports. As such, the compiler will attempt to
load them for test targets, and won't fail if the dependency is missing.

We can make these dependencies required for non-public imports, but it
could be project breaking to do so for implementation-only dependencies.
Considering them as optional is a decent compromise.

rdar://79459263
@xymus xymus force-pushed the impl-only-testable2 branch from 44bda35 to 4327c73 Compare March 31, 2023 16:35
@xymus
Copy link
Contributor Author

xymus commented Mar 31, 2023

@swift-ci Please smoke test

@xymus xymus merged commit 9405ba4 into swiftlang:main Mar 31, 2023
@xymus xymus deleted the impl-only-testable2 branch March 31, 2023 18:54
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