mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Serialization] Attempt to load transitive impl-only dependencies on 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
This commit is contained in:
@@ -1702,7 +1702,7 @@ ModuleFileSharedCore::getTransitiveLoadingBehavior(
|
||||
if (dependency.isImplementationOnly()) {
|
||||
// Implementation-only dependencies are not usually loaded from
|
||||
// transitive imports.
|
||||
if (debuggerMode) {
|
||||
if (debuggerMode || forTestable) {
|
||||
// In the debugger, try to load the module if possible.
|
||||
// Same in the case of a testable import, try to load the dependency
|
||||
// but don't fail if it's missing as this could be source breaking.
|
||||
|
||||
Reference in New Issue
Block a user