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-4874] Warn about trailing whitespaces in multiline string literals #47451

Open
DevAndArtist mannequin opened this issue May 12, 2017 · 0 comments
Open

[SR-4874] Warn about trailing whitespaces in multiline string literals #47451

DevAndArtist mannequin opened this issue May 12, 2017 · 0 comments
Labels
compiler The Swift compiler in itself improvement

Comments

@DevAndArtist
Copy link
Mannequin

DevAndArtist mannequin commented May 12, 2017

Previous ID SR-4874
Radar None
Original Reporter @DevAndArtist
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement
Assignee None
Priority Medium

md5: b02403b86a147e7ddfe690b69150eb0d

Issue Description:

The PR for https://bugs.swift.org/browse/SR-170 implements a half baked multiline string literal.

There are two issues remaining, however this issue report is only about the first one:

1. Warning about trailing whitespaces.

2. Trailing backslash to escape new lines:

However Joe Groff said in the following posts, that it's a reasonable thing to warn about:

The following code sample is misleading and has to emit a warning, either to remove the trailing whitespaces manually or providing a `Fix-it` that will trim them.

let s = """
    abc                                                               
    """

print(s.characters.count) // prints 66

The current workaround without the trailing backslash if the white spaces are desired could look like this:

let s = """
    abc                                                               \("")
    """

print(s.characters.count) // prints 66
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself improvement
Projects
None yet
Development

No branches or pull requests

0 participants