-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Do not discard amended format when f-interpolator warns #23697
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
base: main
Are you sure you want to change the base?
Conversation
Note to self: it would have been easier to see what was going on if Edit: went ahead and inlined that code. The other suboptimal thing is "string is empty" means "error". |
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.
Just one comment on a comment, but otherwise LGTM
tests/warn/i23693.scala
Outdated
@@ -0,0 +1,19 @@ | |||
//> using options -Wtostring-interpolated | |||
|
|||
// verify warning messages and runtime result |
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.
I guess "and runtime result" is inaccurate here, isn't it?
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.
Because I had to split the test between warn and run, for the rest of time, or until the test rig is improved, these tests must remain linked like "Rey and Ben" in Star Wars.
Edit: Rey. I must have been thinking "Jen and Ben".
8b91da5
to
f73185f
Compare
Tweaked the test and rebased. I was not ambitious to make a |
Also use the same error of kind
Interpolation
for warnings ins
.There are assorted errors that
f
emits, and a handful of warnings (about format string edge cases).Previously,
f
would discard the amended "parts" and adapted "args" on any diagnostic; the transform would just call format directly, so the output looks normal. But thetoString
warning revealed that it loses the "injected"%s
specifier; that would be witnessed only if one of the rare "edge case" warnings happened to be emitted. Now it does not discard on warnings, only on hard errors.Fixes #23693