Skip to content

Commit 7cfebf3

Browse files
authored
Make Test.xcTestCompatibleSelector nonisolated(unsafe) so it can be used with Xcode 15 CLTools. (#582)
When building Swift Testing using Xcode 15.3 or the Xcode 15.3 CLTools and a prerelease Swift 6 toolchain, the compiler produces an error: > /Volumes/Dev/Source/swift-testing/Sources/Testing/Test.swift:69:14: error: stored property 'xcTestCompatibleSelector' of 'Sendable'-conforming struct 'Test' has non-sendable type '__XCTestCompatibleSelector?' (aka 'Optional<Selector>') > 67 | /// property is always `nil`. > 68 | @_spi(ForToolsIntegrationOnly) > 69 | public var xcTestCompatibleSelector: __XCTestCompatibleSelector? > | `- error: stored property 'xcTestCompatibleSelector' of 'Sendable'-conforming struct 'Test' has non-sendable type '__XCTestCompatibleSelector?' (aka 'Optional<Selector>') Although Xcode 15.3 is not formally supported, this is trivial to resolve by marking the offending property `nonisolated(unsafe)`. The property's type (`Selector?` on Darwin, `Never?` elsewhere) is `Sendable` but `Selector` was not marked as such until Xcode 16. This change will unblock some workflows that still use Xcode 15.3. ### 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.
1 parent 33c16da commit 7cfebf3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/Testing/Test.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public struct Test: Sendable {
6666
/// On platforms that do not support Objective-C interop, the value of this
6767
/// property is always `nil`.
6868
@_spi(ForToolsIntegrationOnly)
69-
public var xcTestCompatibleSelector: __XCTestCompatibleSelector?
69+
public nonisolated(unsafe) var xcTestCompatibleSelector: __XCTestCompatibleSelector?
7070

7171
/// An enumeration describing the evaluation state of a test's cases.
7272
///

0 commit comments

Comments
 (0)