Skip to content
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

[SR-9937] Swift 5: Unexpected String interpolation warnings #52343

Closed
groue opened this issue Feb 16, 2019 · 3 comments
Closed

[SR-9937] Swift 5: Unexpected String interpolation warnings #52343

groue opened this issue Feb 16, 2019 · 3 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@groue
Copy link

groue commented Feb 16, 2019

Previous ID SR-9937
Radar None
Original Reporter @groue
Type Bug
Status Resolved
Resolution Done
Environment

Xcode Version 10.1 (10B61)
Toolchain Swift 5 Snapshot 2019-02-06

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @beccadax
Priority Medium

md5: 55af157ff9913122988d0460437cabc2

Issue Description:

The Swift 5 compiler can emit unexpected String interpolation warnings in 4.2 mode, for code guarded with a #if swift(>=5.0) clause:

#if swift(>=5.0)
// Unexpected warning: Labeled interpolations will not be ignored in Swift 5
let sql: SQLLiteral = """
    SELECT * \(sql: "FROM player")
    """

// Unexpected warning: Interpolating multiple values will not form a tuple in Swift 5
let sql: SQLLiteral = """
    SELECT * \(sql: "AND \("name") = :name", arguments: ["name": "Arthur"])
    """
#endif

Those warnings come from https://github.com/apple/swift-evolution/blob/master/proposals/0228-fix-expressiblebystringinterpolation.md#source-compatibility

They are unexpected because the code is guarded by #if swift(>=5.0).

For more information, see this tweet: https://twitter.com/brentdax/status/1096827747920371712

@beccadax
Copy link
Contributor

It looks like this diagnostic is not emitted during compilation, but only during code highlighting and other IDE operations. I can probably still fix it, if only by disabling the warning if we're not evaluating #ifs.

@groue
Copy link
Author

groue commented Feb 19, 2019

> It looks like this diagnostic is not emitted during compilation, but only during code highlighting and other IDE operations.

Confirmed!

@beccadax
Copy link
Contributor

Fix merged. #24464 I don't know exactly when it will ship, but it's in master.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants