Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?
Description
When a Swift package specifies a resource as part of a build target, SwiftPM synthesizes a resource_bundle_accessor.swift to provide runtime hooks to access the resource. With Swift 6.1, if the target uses access levels on import (internal/private/public import), then the target fails to build with:
error: ambiguous implicit access level for import of 'Foundation'
Once any other file in the same module declares an access-qualified import, the compiler requires every import in the module (including this generated one) to be explicit. As users cannot modify this file, the only workaround for this issue is to make the Foundation import in the package public.
Expected behavior
The generated resource_bundle_accessor.swift declares an access level for its imports, and allows the target to build successfully.
Actual behavior
The build fails with:
error: ambiguous implicit access level for import of 'Foundation'
Steps to reproduce
- Create a package with
swift-tools-version: 6.1.
- Add a target with
resources: [.copy("SomeFolder")] so SwiftPM synthesizes resource_bundle_accessor.swift.
- In one of that target's source files, add
internal import Foundation.
- Run
swift build.
Is it reproducible with SwiftPM command-line tools:
swift build,swift test,swift packageetc?swift build,swift test,swift packageetc.Description
When a Swift package specifies a resource as part of a build target, SwiftPM synthesizes a
resource_bundle_accessor.swiftto provide runtime hooks to access the resource. With Swift 6.1, if the target uses access levels on import (internal/private/public import), then the target fails to build with:Once any other file in the same module declares an access-qualified import, the compiler requires every import in the module (including this generated one) to be explicit. As users cannot modify this file, the only workaround for this issue is to make the Foundation import in the package public.
Expected behavior
The generated
resource_bundle_accessor.swiftdeclares an access level for its imports, and allows the target to build successfully.Actual behavior
The build fails with:
Steps to reproduce
swift-tools-version: 6.1.resources: [.copy("SomeFolder")]so SwiftPM synthesizesresource_bundle_accessor.swift.internal import Foundation.swift build.