feedback-assistant / reports

Open collection of Apple Feedback Assistant reports
237 stars 2 forks source link

FB14338964: Breaking - Incorrect Swift 6 Concurrency Errors in Swift 5 project #563

Open macmade opened 1 month ago

macmade commented 1 month ago

Description

Concurrency errors related to the Sendable protocol are produced in a project, although it is configured for Swift 5. This behavior is new in Xcode 16.0 beta 3 (16A5202i) and breaks the build. Previous beta versions were not affected.

I've attached an Xcode project showing the issues.

Error 1 - Using WebKit:

import WebKit

This produces the following error: Add '@preconcurrency' to suppress 'Sendable'-related warnings from module 'WebKit'

Error 2 - Using @preconcurrency

@preconcurrency import WebKit

In a Swift 5 project, this produces the following error: '@preconcurrency' attribute on module 'WebKit' has no effect

Error 3 - Closures and Sendable

let test = NSTreeController()
[self.observer](http://self.observer/) = self.observe( \.description )
{
    _, _ in print( test )
}

Capture of 'test' with non-sendable type 'NSTreeController' in a @Sendable closure; this is an error in the Swift 6 language mode

These issues make building a Swift 5 project impossible with Xcode 16.0 beta 3.

Files

Test.zip

macmade commented 1 month ago

This project has warnings-as-errors turned on. Switch the build setting and the warnings are just that - only warnings. This is correct behavior.

macmade commented 1 month ago

The project indeed has warnings-as-errors enabled. Disabling this is not a valid solution. Treating warnings as errors can be a requirement on some projects.

At least provide a way to turn these warnings in Swift 5 projects as a build setting.

macmade commented 1 month ago

Since there is a -warn-concurrency flag, please provide a -no-warn-concurrency or -disable-warn-concurrency so we can use them on specific files while keeping warning as errors on.