Merge main into release/6.4.x#1727
Merged
stmontgomery merged 4 commits intoMay 27, 2026
Merged
Conversation
This PR adds helper members on `Trait` to allow casting between the different refining protocols and concrete trait types without relying on `as?` in Embedded Swift. I have left an `as? TimeLimitTrait` cast unmodified as I expect we won't support time limits in Embedded Swift and will probably just stub out that whole type. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Add more concrete overloads of `String(describingForTest:)` and `appendInterpolation(_:)` to eliminate more string-related diagnostics. And a few other related changes. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
Enable targeted interoperability by default
### Motivation:
Interoperability is a feature that makes it safer and easier than ever
to migrate from XCTest to Swift Testing.
It does this by addressing the problem of "lossy without interop", where
issues created by XCTest are normally not handled in a Swift Testing
test.
Interop supports a few modes:
class FooTests: XCTestCase {
func testInterop() {
// None: No-op
// Limited: ❌ "Interop failure"
// Complete: ❌ "Interop failure"
// Strict: ❌ "Interop failure"
Issue.record("Interop failure")
}
}
@test func `Test Interop`() {
// None: No-op
// Limited: ⚠️ "Interop failure", ⚠️ Adopt Swift Testing primitives
// Complete: ❌ "Interop failure", ⚠️ Adopt Swift Testing primitives
// Strict: 💥 fatalError: Adopt Swift Testing primitives
XCTFail("Interop failure")
}
The default is "complete" for `swift-tools-version: 6.4`[^1] and
"limited" otherwise.
Use env var `SWIFT_TESTING_XCTEST_INTEROP_MODE=<mode in lowercase>` to
override this mode at runtime.
[^1]: swiftlang/swift-package-manager#9857
To learn more, refer to the full proposal:
https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0021-targeted-interoperability-swift-testing-and-xctest.md
### Modifications:
* Remove SWT_EXPERIMENTAL_INTEROP_ENABLED flag and related checks. This
ensures that interoperability Just Works when you use a toolchain that
supports it.
* Add SWIFT_TESTING_XCTEST_INTEROP_MODE to EnvironmentVariables.md
Resolves rdar://177175523
## Checklist:
- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.
---------
Co-authored-by: Stuart Montgomery <smontgomery@apple.com>
stmontgomery
approved these changes
May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was automatically opened by a GitHub action. Review the changes included in this PR and determine if they should be included in the release branch. If yes, merge the PR. Otherwise revert changes that should not be included on this branch.