Downgrade "upcoming feature is already enabled" error to a warning

SE-0362: Piecemeal adoption of upcoming language improvements specifies that it is an error to enable an upcoming feature while also building in a language mode that enables the upcoming feature by default. I've found that this error adds some friction when migrating to -swift-version 6, because it's extremely common to have already enabled some if not all of Swift 6's upcoming features. Immediately hitting errors when enabling -swift-version 6 isn't a great experience, and the existence of these flags isn't harmful - it's just nice to clean them up. It also might be the case that someone switches back and forth between language modes for testing purposes, in which case they would need to toggle the upcoming features on and off at the same time. Instead, I'd like to downgrade this error to a warning.

Thoughts?

47 Likes

+1, this would be a great usability improvement when migrating to Swift 6!

6 Likes

Yes! People are bouncing back and forth between 5 and 6 mode a lot, and the current behavior makes that workflow a lot trickier.

9 Likes

In theory I like these as errors but in practice I only see the diagnostic when building with spm:

% swift build
Building for debugging...
<unknown>:0: error: upcoming feature '#####' is already enabled as of Swift version 6`

When building with with Xcode all I get is a cryptic:

Command SwiftCompile failed with a nonzero exit code

It would be nicer if Xcode's "Resolve Packages" phase was where the diagnostic was raised with a fixit to remove the enablement. If warning makes this implementation easier then I think that is a big win.

3 Likes

+1, completely agree this should be lowered to a warning for all the reasons you mentioned.

1 Like

Big thumbs up :sweat_smile:

2 Likes