- Notifications
You must be signed in to change notification settings - Fork3.1k
Add-Wtostring-interpolated to warn if interpolator usestoString#10776
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Add-Wtostring-interpolated to warn if interpolator usestoString#10776
Uh oh!
There was an error while loading.Please reload this page.
Conversation
6e463fb toab4a1d1Comparesom-snytt commentedMay 8, 2024
Previous feedback at wartremover is to allow at least Therefore, no accommodation is made yet here. A future version can take a typeclass, implicit locale, etc. |
ab4a1d1 tocbf369dComparecbf369d todc21f58Comparesom-snytt commentedJun 16, 2024
Added the exclusion for primitives but not Dotty reflect says don't use
|
som-snytt commentedJun 17, 2024
spurious error on first commit after rebase then |
lrytz left a comment
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.
LGTM otherwise! I'm not familiar with the code though.
Uh oh!
There was an error while loading.Please reload this page.
dc21f58 to6afc3a5Comparesom-snytt commentedJun 17, 2024
gah |
som-snytt commentedJun 17, 2024
/rebuild |
som-snytt commentedJun 17, 2024
fool me twice |
lrytz left a comment
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.
Nice, thank you! Let's squash before merge.
d138e6c to1ac2451Comparesom-snytt commentedJun 19, 2024
Squashed & rebased for ✔️ (🤞 ) |
Adds -Wtostring-interpolated to warn if interpolator usestoStringAdds -Wtostring-interpolated to warn if interpolator usestoString-Wtostring-interpolated to warn if interpolator usestoString
Uh oh!
There was an error while loading.Please reload this page.
Adds
-Wtostring-interpolatedwhich warns if a standard interpolator usestoStringto convert a value which is not string or primitive type.-Wconf:cat=w-flag-tostring-interpolated:eto boost.Also restores edge case
f"${ "hello" }%b"which is"true"for non-boolean arg. That became an error in previous refactor, possibly intentionally. (It is arguably an obscure feature of format.) (Edit: the C.I. error reminds me that the change was to make the expected type Boolean, so that conversions work normally. That is also edge casey. Maybe it can try boolean, null, and any? Edit: yes, try non-any first, then any if allowed.)The "default"
%sis improved so that the warning position is at the interpolated element ins"$x".Follow-up to#8654