swiftlang/swift-package-manager

Cannot @testable import executable target

Closed this issue · 0 comments

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI.

Description

swift-mmio fails to build with SwiftPM from main with the following note: "note: module 'SVD2Swift' is the main module of an executable, and cannot be imported by tests and other targets".

Expected behavior

Build succeeds (as is the case with 5.9 and 5.10)

Actual behavior

build fails with:

/code/Tests/SVD2SwiftTests/SVD2SwiftTests+BitWidths.swift:13:18: error: no such module 'SVD2Swift'
 12 | @testable import SVD
 13 | @testable import SVD2Swift
    |                  `- error: no such module 'SVD2Swift'

Steps to reproduce

swift test with swift-mmio @ 822f5e231dacb686030437ef18654d586a1575c6

Swift Package Manager version/commit hash

main

Swift & OS version (output of swift --version ; uname -a)

Swift version 6.0-dev (LLVM cef183591317ec7, Swift 66e311074bff491)
Target: aarch64-unknown-linux-gnu
Linux b1edcdcd4c95 6.1.68 #1 SMP Thu May  2 02:50:09 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux