With Swift 6, swift run --repl
causes "redefinition of module" errors, depending on dependencies
#7971
Labels
swift run --repl
causes "redefinition of module" errors, depending on dependencies
#7971
Is it reproducible with SwiftPM command-line tools:
swift build
,swift test
,swift package
etc?swift build
,swift test
,swift package
etc.Description
Depending on the packages in the
dependencies
array inPackage.swift
, runningswift run --repl
and typing anything in the REPL leads to ancouldn't IRGen expression: Clang importer error
andredefinition of module
errors and I can't even tell whether anything is getting executed or not.Not all packages cause this; so far I've had this problem with
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.3.0")
.package(url: "https://github.com/pointfreeco/swift-parsing", branch: "main")
.package(url: "https://github.com/ordo-one/package-benchmark", from: "1.4.0")
But for example
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.0")
has not caused this.I've tried
swift package reset && swift package purge-cache
rm -rf ~/Library/Caches/org.swift.swiftpm/
fd --hidden --no-ignore --ignore-case --glob "*modulecache*" /var/folders --exec rm -rf
(to clear clang's module cache, based on an answer to this SO question)Expected behavior
No errors.
Actual behavior
Example with only
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.3.0")
as a dependency:The exact module redefinition errors vary depending on which package(s) I've got in my dependencies.
Full
swift run --repl -v
outputs for the 3 problematic packages in an empty project like in the reproduction steps (includes one:swift-healthcheck
output):https://gist.github.com/ORBAT/f29e1b15da3be9aeca9371f34ffe1752
Steps to reproduce
mkdir problem-package && cd problem-package
swift package init --type=library --disable-xctest --disable-swift-testing
swift package add-dependency https://github.com/apple/swift-argument-parser --from 1.3.0
swift package add-dependency https://github.com/pointfreeco/swift-parsing --branch main
swift package add-dependency https://github.com/ordo-one/package-benchmark --from 1.4.0
swift run --repl
let a = 1
Swift Package Manager version/commit hash
Swift Package Manager - Swift 6.0.0-dev
Swift & OS version (output of
swift --version ; uname -a
)Using the Swift toolchain from Xcode 16.0 (16A242d)
The text was updated successfully, but these errors were encountered: