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
Concatenate strings if not formatting [ci: last-only] #10364
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
29f116f
Concatenate if not formatting
som-snytt 7fb9052
Format constant args constantly consistently
som-snytt 0f566b3
s interpolator constantenates
som-snytt 803dd57
Only assume the string value of strings
som-snytt 1c0dba3
Add f-formats that should warn but do not
som-snytt 27fa48c
Check duplicate flags
som-snytt 55ef130
Improve message for unsupported escapes
som-snytt c24f6e2
Avoid deprecation in test
som-snytt c5df2f0
Tweak f-interp test
som-snytt File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
|
||
trait X { | ||
final val x = "hello, world" | ||
def f = Seq( | ||
f"""a\""", | ||
f"a\xc", | ||
// following could suggest \u000b for vertical tab, similar for \a alert | ||
f"a\vc" | ||
f"a\vc", | ||
f"\v$x%.4s, Fred", | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
t8650.scala:19: warning: method s in class C is deprecated (since MyLib 17): hello world | ||
def t = s | ||
^ | ||
t8650.scala:21: warning: method f in class C is deprecated (since MyLib 17): hello world | ||
def g = f | ||
^ | ||
error: No warnings can be incurred under -Werror. | ||
2 warnings | ||
1 error |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could
reported
be a local variable next toformatting
? It's not obvious when instances ofFormatInterpolator
are created.There are also some invocations of
c.error
inescapeHatch
- does that matter?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cached FastTrack mechanism results in a
ctx => (new { val c = ctx } with FastStringInterpolator).interpolateF
, so a new interpolator per invocation. Not obvious.reported
is set also byConversion#errorAt
, so that is why it's not local. The flag is needed so that it doesn't attempt a bad compiletime format, so the bad escapes inescapeHatch
should matter. I'll make a test.Edit: there is already a test; took me a while to realize that
format()
doesn't complain about bad escapes in a format string, Scala does.