Skip to content

Commit 90aafad

Browse files
committed
Suppress Swift 6 concurrency warning when using XCTWaiter and XCTestExpectation.
This change annotates the `fulfillment(of:)` overloads so that they won't trigger Swift 6 diagnostics. This is a late-breaking change that has started to [affect](https://forums.swift.org/t/swift-5-10-concurrency-and-xctest/69929) developers using strict concurrency checking with Swift 5.10. Resolves rdar://124966292.
1 parent aba63a7 commit 90aafad

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Sources/XCTest/Public/Asynchronous/XCTWaiter.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ open class XCTWaiter {
277277
/// swift-corelibs-xctest and Apple XCTest, it is not recommended to pass
278278
/// explicit values for `file` and `line`.
279279
@available(macOS 12.0, *)
280-
@discardableResult
280+
@discardableResult @_unsafeInheritExecutor
281281
open func fulfillment(of expectations: [XCTestExpectation], timeout: TimeInterval, enforceOrder: Bool = false, file: StaticString = #file, line: Int = #line) async -> Result {
282282
return await withCheckedContinuation { continuation in
283283
// This function operates by blocking a background thread instead of one owned by libdispatch or by the
@@ -327,7 +327,7 @@ open class XCTWaiter {
327327
/// expectations are not fulfilled before the given timeout. Default is the line
328328
/// number of the call to this method in the calling file. It is rare to
329329
/// provide this parameter when calling this method.
330-
@available(macOS 12.0, *)
330+
@available(macOS 12.0, *) @_unsafeInheritExecutor
331331
open class func fulfillment(of expectations: [XCTestExpectation], timeout: TimeInterval, enforceOrder: Bool = false, file: StaticString = #file, line: Int = #line) async -> Result {
332332
return await XCTWaiter().fulfillment(of: expectations, timeout: timeout, enforceOrder: enforceOrder, file: file, line: line)
333333
}

Sources/XCTest/Public/Asynchronous/XCTestCase+Asynchronous.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public extension XCTestCase {
110110
/// provide this parameter when calling this method.
111111
///
112112
/// - SeeAlso: XCTWaiter
113-
@available(macOS 12.0, *)
113+
@available(macOS 12.0, *) @_unsafeInheritExecutor
114114
func fulfillment(of expectations: [XCTestExpectation], timeout: TimeInterval, enforceOrder: Bool = false, file: StaticString = #file, line: Int = #line) async {
115115
let waiter = XCTWaiter(delegate: self)
116116
await waiter.fulfillment(of: expectations, timeout: timeout, enforceOrder: enforceOrder, file: file, line: line)

0 commit comments

Comments
 (0)