Describe the bug
Two related defects affect the test target: one makes it incompatible with the package's declared minimum Swift version, while the other prevents the intended release-only performance-test path from ever being enabled.
swift test does not build on Swift 6.2.x.
Sources/Tests/TestPerformance.swift:42 calls Testing.Test.cancel(_:). That API ships with the swift-testing bundled in Swift 6.3 (Xcode 26.6) and is not present in Swift 6.2.x. Package.swift declares swift-tools-version: 6.1 and README states "Swift 6.1 or later", so the test target requires a newer toolchain than the package says it supports.
Anyone on Swift 6.1–6.2.x cannot run the test suite at all, which is the check CONTRIBUTING.md asks contributors to perform before submitting.
ENABLE_PERFORMANCE_TESTS is discarded by the manifest.
Package.swift declares it on the test target:
swiftSettings: [.define("ENABLE_PERFORMANCE_TESTS", .when(configuration: .release))]
but the trailing loop then assigns to the same property:
for target in package.targets {
target.swiftSettings = [ .enableUpcomingFeature("ExistentialAny"), ... ]
}
Assignment replaces the per-target settings declared above, so the define never reaches the compiler. As currently configured by Package.swift, the seven performance tests are never enabled by either the debug or release package configuration — and because the #else branch is always the one compiled, Swift 6.2.x encounters the unavailable Test.cancel API in both configurations.
Steps to reproduce
- Install a toolchain with Swift 6.2.x (e.g. Xcode 26.3).
- git clone https://github.com/apple/xcode-project-format && cd xcode-project-format
- swift test
For defect 2, on Swift 6.3+ where the test target itself builds:
- Run:
swift build -c release --build-tests
The performance tests are still reported as disabled even though the package is being built in release configuration, showing that ENABLE_PERFORMANCE_TESTS is not reaching the compiler.
Expected behavior
swift test builds and runs on every Swift version the package declares support for.
Performance tests should be reported as skipped, with a reason, rather than breaking the build.
- ENABLE_PERFORMANCE_TESTS is defined for release builds of the test target, so the performance tests actually run under
swift test -c release.
Stack trace
$ swift --version
Apple Swift version 6.2.4 (swiftlang-6.2.4.1.4 clang-1700.6.4.2)
$ xcodebuild -version
Xcode 26.3
$ rm -rf .build && swift test
Building for debugging...
/…/Sources/Tests/TestPerformance.swift:42:18: error: type 'Test' has no member 'cancel'
40 | print(" total: \(total.formattedSeconds())")
41 | #else
42 | try Test.cancel("Performance tests are only enabled in release builds.")
| `- error: type 'Test' has no member 'cancel'
43 | #endif
44 | }
[108/110] Compiling XcodeProjectFormatTests JSONTests.swift
error: fatalError
$ rm -rf .build && swift test -c release
Building for production...
/…/Sources/Tests/TestPerformance.swift:42:18: error: type 'Test' has no member 'cancel'
(same error — proving ENABLE_PERFORMANCE_TESTS is undefined in release too)
error: fatalError
Environment
- Version: main (c132630)
- OS: macOS Tahoe 26.7, arm64
- Swift version
- 6.2.4 / Xcode 26.3 — fails
- 6.3.3 / Xcode 26.6 — builds
- 6.4 / Xcode 27.0 — builds
Additional context
Test.cancel was introduced by ST-0016, which is marked as implemented in Swift 6.3. It is present in Testing.framework's swiftinterface from Xcode 26.6 onward and absent in Xcode 26.3 and 26.0.1, verified across the toolchains installed locally:
extension Testing.Test {
public static func cancel(
_ comment: Testing.Comment? = nil,
sourceLocation: SourceLocation = #_sourceLocation
) throws -> Never
}
If requiring Swift 6.3 for the test target is intentional, the fix is to raise the declared minimum in Package.swift and README rather than to change this code. Defect 2 stands either way.
Describe the bug
Two related defects affect the test target: one makes it incompatible with the package's declared minimum Swift version, while the other prevents the intended release-only performance-test path from ever being enabled.
swift testdoes not build on Swift 6.2.x.Sources/Tests/TestPerformance.swift:42callsTesting.Test.cancel(_:). That API ships with the swift-testing bundled in Swift 6.3 (Xcode 26.6) and is not present in Swift 6.2.x.Package.swiftdeclaresswift-tools-version: 6.1and README states "Swift 6.1 or later", so the test target requires a newer toolchain than the package says it supports.Anyone on Swift 6.1–6.2.x cannot run the test suite at all, which is the check CONTRIBUTING.md asks contributors to perform before submitting.
ENABLE_PERFORMANCE_TESTSis discarded by the manifest.Package.swiftdeclares it on the test target:but the trailing loop then assigns to the same property:
Assignment replaces the per-target settings declared above, so the define never reaches the compiler. As currently configured by Package.swift, the seven performance tests are never enabled by either the debug or release package configuration — and because the #else branch is always the one compiled, Swift 6.2.x encounters the unavailable Test.cancel API in both configurations.
Steps to reproduce
For defect 2, on Swift 6.3+ where the test target itself builds:
The performance tests are still reported as disabled even though the package is being built in release configuration, showing that ENABLE_PERFORMANCE_TESTS is not reaching the compiler.
Expected behavior
swift testbuilds and runs on every Swift version the package declares support for.Performance tests should be reported as skipped, with a reason, rather than breaking the build.
swift test -c release.Stack trace
Environment
Additional context
Test.cancel was introduced by ST-0016, which is marked as implemented in Swift 6.3. It is present in Testing.framework's swiftinterface from Xcode 26.6 onward and absent in Xcode 26.3 and 26.0.1, verified across the toolchains installed locally:
If requiring Swift 6.3 for the test target is intentional, the fix is to raise the declared minimum in Package.swift and README rather than to change this code. Defect 2 stands either way.