The Swift 6 compiler available in Xcode 16 beta introduces many warnings related to the new concurrency model, even when compiling in Swift 5 mode.
In some cases, it's completely impossible to avoid warnings.
Consider the following code:
import WebKit
This produces the following warning: Add '@preconcurrency' to suppress 'Sendable'-related warnings from module 'WebKit'
If the suggestion is applied:
@preconcurrency import WebKit
Now, the following warning is produced: '@preconcurrency' attribute on module 'WebKit' has no effect
My projects always use -warnings-as-errors
.
This makes it impossible to compile Swift 5 code with the new Swift 6 compiler.
I created a radar about that problem (FB14338964) just to be told to disable -warnings-as-errors
.
This is not an acceptable solution for me.
What’s the point of the Swift 5 mode if perfectly valid Swift 5 code now raises warnings?
Some warnings might be beneficial when planning a migration, but there should at least be a way to disable them.
As I understand, some concurrency-related warnings were introduced in Swift 5.5.x and then relaxed in Swift 5.6 (SE-0302 / SE-0337).
Am I the only one to think that the behavior of the Swift 6 compiler feels like a regression?
How do you folks deal with these warnings in your codebases?