Error about non-Sendable
type when using Swift 5 mode with @preconcurrency API
#76652
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler itself
concurrency
Feature: umbrella label for concurrency language features
expressions
Feature: expressions
Sendable
Area → standard library: The Sendable protocol
type checker
Area → compiler: Semantic analysis
Uh oh!
There was an error while loading. Please reload this page.
Description
After updating to Swift 6, I am getting Swift Concurrency warnings, even with the Swift 5 language mode, for code that used to compile cleanly. For example, the example below produces this error:
Reproduction
I can reproduce this issue with a CLI project created in Xcode 16, configured to use Swift 5 language mode.
Expected behavior
I expected this to compile without any warnings or errors using the Swift 5 mode of the Swift 6 compiler, as it did with Swift 5 and Xcode 15.
DispatchQueue.concurrentPerform()
is annotated with@preconcurrency
, which I thought was supposed to suppress these sorts of warnings.Environment
Version 16.1 beta 2 (16B5014f)
swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.11 clang-1600.0.26.2)
Target: x86_64-apple-macosx15.0
Additional information
The problem does not occur if I write it like this:
I am also seeing similar issues calling
DispatchQueue.main.sync()
as well as these APIs:and can provide more info on that if you think these are separate issues.
The text was updated successfully, but these errors were encountered: