-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable more flags to check for concurrency compatibility #3443
Comments
I'm not sure how much of an impact these will have on the totals but we should make sure to mark the date when these flags went into effect on the Ready for Swift 6 charts in case their impact is significant. |
I've tried applying these flags with Xcode 16.1 but I'm struggling to find a variant that works with SwiftPM builds:
I've tried all manner of variations:
It does appear to be working when setting |
hmmm. How about this:
|
Ah, of course, it's a We're currently reprocessing with 16.1 so these new flags won't land straight away (so we don't mix results). It'll go live later this week. |
So I have this in place and passing our builder tests but I'm having second thoughts whether we should run with these flags. We're already seeing discrepancies between what we report and what users see and these custom flags will make it even harder for authors to compare their local results with what we show. Enabling complete concurrency checking or running in language mode 6 are well enough documented but setting upcoming feature flags is trickier. While this would presumably help with the error and compatible package counts, shouldn't we be testing as plain a build config as possible? To you point, @mattmassicotte
On reflection, I don't think we want to achieve the minimum number of warnings, we want to show the number of warnings you're getting when you run the stock compiler with concurrency warnings enabled. This may guide the decision on defaults but it can't do so if we part with the defaults. |
I agree wholeheartedly with this 👍 |
Makes total sense! It's true that the only way to get a valid picture of Swift 6 mode compatibiilty is by running with Swift 6 mode. That's not the same thing as Swift 5 + StrictConcurrency, but that may not be what you want. Totally trust your judgement here! |
We run in Swift 5 mode with If we ran in Swift 6 mode we could only really report a boolean "worked" / "didn't work" and no error or warning count, unfortunately. |
This is not as close as possible to Swift 6 mode though! Swift 6 mode is, roughly, all flags on + concurrency warnings become errors. But, I totally get that these things are in tension. If you turn on the ~ 20 upcoming feature flags, you are almost at Swift 6 mode while preserving warnings. But you also have the most annoying-to-reproduce build set up. I think keeping things simple is very desirable though. |
I actually almost raised that question yesterday, if including these flags is closer to mode 6 than just mode 5 + One of the questions is what users are more likely interested in:
When planning the feature we assumed these two to be the same but if that's not the case, we should revisit that assumption. A few more observations/thoughts:
I think we may want mode 5 + all the flags, awkward as it is. It's about language mode 6 and mode + complete concurrency doesn't seem to cover it well enough. |
The answer to this is clear to me. Swift 5 mode + extra concurrency warnings is no longer a real world situation now that Swift 6 is released. Developers want the results as if Swift 6 mode were switched on. It's truly a shame that we can't get the error numbers in that situation, but in my opinion that's clearly what we're aiming for. |
You are correct. The Swift 6 language mode is (pretty much) defined as Swift 5 + ALL upcoming feature flags. So, turning on any more flags gets you closer to 6 mode. I just specifically suggested these particular flags because they can have a meaningful impact on concurrency-specific warnings. There's no way I know of to go in the opposite direction and only downgrade errors to warnings in 6 mode. |
Just to record a link here as well, there might be a resource to track what flags we should be using in the making here: https://toot.iamkonstantin.eu/@konstantin/113464415244283221 |
Also cc-ing @hborla for awareness/review of the idea to include additional build flags. |
Discussed in #3442
Originally posted by mattmassicotte October 17, 2024
Hello friends! There are two additional flags that, while technically can be source-incompatible, can also have a meaningfully-positive impact on warnings produced by strict concurrency.
InferSendableFromCaptures
: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0418-inferring-sendable-for-methods.mdGlobalActorIsolatedTypesUsability
: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0434-global-actor-isolated-types-usability.mdI've had to use both of these to address warnings that I would otherwise not be able to fix. I think it may make sense to consider enabling these as well. Thoughts?
The text was updated successfully, but these errors were encountered: