InternalImportsByDefault issue on Swift 6.0 Toolchain #81248
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
InternalImportsByDefault
is a feature flag which can be opt-in since Swift 5.9.And I just noticed it has some strange bug behavior occurring on Swift 6.0 toolchain.
Description
If you enable
InternalImportsByDefault
as a upcoming feature, you will be able to use other package's package API even you are not in the same package.Example 1:
We have Demo and DemoKit package, and Demo has a dependency on DemoKit.
It will be buildable that Demo use DemoKit's package API if we are using Xcode 16.0 with Swift 6.0 compiler.
Example 2:
The same thing applies for the system framework.
SwiftUI.framework & SwiftUICore.framework has some @inlinable package API in its public interface.
We can also call it directly on Demo package if we enable
InternalImportsByDefault
and compile it under Xcode 16.0 with Swift 6.0 compiiler.Reproduction
Demo.zip
See Demo package in the attachment.
Expected behavior
Not able to call package API in other package and fail to compile.
Environment
swiftc -version
swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)
Target: arm64-apple-macosx15.0
Additional information
The bug seem to be fixed on Swift 6.1 / Xcode 16.3.
But I did not find any existing issue or test case covering it in the Swift repo.
cc @xymus
The text was updated successfully, but these errors were encountered: