Swift 5.7 support in SonarCloud

We are making use of Swift 5.7 (Swift.org - Swift 5.7 Released!) and the “New shorthand syntax for common boilerplate code, including if let statements and multi-statement closure type annotations”.

As seen on Swift | SonarCloud Docs, SonarCloud only supports Swift 3 up to Swift 5.6 at the moment.

At the moment, we are getting “ERROR: String is not parsed” errors in the SonarCloud Analysis when making use of new unwrapping syntax in Swift 5.7.

Is there a ETA when Swift 5.7 will be supported?

1 Like

Hi Ashok, we have started the work to support the new Swift 5.7 features, including the if-let shorthand syntax.

If everything goes well, by the end of October, SonarCloud should thus support this new syntax.

Thanks and Regards
Francois Mora

4 Likes

Any news on this as it’s now November? :see_no_evil:

The warnings we get from this are quite annoying for valid Swift syntax. :disappointed:

Hey there.

Swift 5.7 should now be supported – can you give more details about the warnings you’re getting?

1 Like

Ironically I haven’t seen anymore false positives in this area since I posted, so hopefully it’s fixed now and not that we haven’t hit this again since. :smile: Thanks for the response though :smile:

1 Like

2 posts were split to a new topic: S1854 FP on Swift 5.7 syntax

Hi guys,
going forward will it stop working always when a new Swift syntax is introduced? It shouldn’t be a problem if the “problematic” part is skipped but we experienced a different behavior; the tool failed to complete the analysis and always exited with an error.

Thank you for the clarification.

Best regards,
Jan

Hi @janc, thank you for your feedback, and welcome to the Sonar community!

As you probably guessed, the Swift analyzer has a parser that follows the versions of Swift. And after the announcement of a new version, we need to implement the new language constructs.
Unfortunately, the parser can’t recover from a parsing error. So, a file using features introduced after the latest version of Swift supported in SonarCloud may generate errors, and the analysis will then stop for that file.

Hope this helps,
François