Unexpected concurrency warning when using ThrowingTaskGroup.reduce(into:)

Hey there,
I think I bumped into something that's either a bug, or simply unexpected.

I've just upgraded to the RC1 of Xcode 15.3 and noticed the following code causes this warning:

Passing argument of non-sendable type 'ThrowingTaskGroup<MediaPicker.Selection?, any Error>' outside of main actor-isolated context may introduce data races

If I switch this up to a regular for-in loop, there's no warning:

Both of these options are inside the scope of:

try await withThrowingTaskGroup(of: Selection?.self) { group in
...
}

Also, MediaPicker.Selection is Sendable. Is this a bug, or just an unexpected behavior of reduce(into:) that I might be missing?

Thanks :)

2 Likes