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
Conversation
59f62b5
to
f88e10d
Compare
The current caret position is unusual.
I saw that the ancient PR requested |
f88e10d
to
cda5da3
Compare
cda5da3
to
cedc4ad
Compare
cedc4ad
to
8c16fff
Compare
Random
|
ac45a89
to
8f525b5
Compare
Just noticed https://prog21.dadgum.com/76.html "Stop the Vertical Tab Madness" via "things rust shipped without" https://graydon2.dreamwidth.org/218040.html "vertical tab escapes along with the escapes for bell and form-feed".
|
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.
Looks good to me otherwise.
@@ -94,6 +98,7 @@ abstract class FormatInterpolator { | |||
else all.head + all.tail.map { case req(what) => what case _ => "?" }.mkString(", ", ", ", "") | |||
} | |||
c.error(args(argi).pos, msg) | |||
reported = true |
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 to formatting
? It's not obvious when instances of FormatInterpolator
are created.
There are also some invocations of c.error
in escapeHatch
- 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 by Conversion#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 in escapeHatch
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.
8f525b5
to
c5df2f0
Compare
Rebased, no squash, added a small test. |
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.
👍 thank you!
Fixes scala/bug#9784
Fixes scala/bug#8650