I’ve been trying out the upcoming NonisolatedNonsendingByDefault
flag and I’ve come across an error that I’m not sure how to properly address. Here’s a minimal reproduction:
import Testing
struct NoopScope: TestScoping {
func provideScope(
for test: Test,
testCase: Test.Case?,
performing function: @Sendable () async throws -> Void
) async throws {
try await function()
}
}
Type 'NoopScope' does not conform to protocol 'TestScoping'
Candidate has non-matching type '(Test, Test.Case?, nonisolated(nonsending) @Sendable () async throws -> Void) async throws -> ()'
Protocol requires function 'provideScope(for:testCase:performing:)' with type '(Test, Test.Case?, @Sendable () async throws -> Void) async throws -> ()'
I did stumble across the following which clears up the error but I do not know if it’s the correct or expected way to address it.
import Testing
struct NoopScope: TestScoping {
func provideScope(
for test: Test,
testCase: Test.Case?,
performing function: @isolated(any) () async throws -> Void
) async throws {
try await function()
}
}
I am using Xcode 26 beta 7.
swift-driver version: 1.127.14.1 Apple Swift version 6.2 (swiftlang-6.2.0.19.9 clang-1700.3.19.1)
Target: arm64-apple-macosx26.0