Add -Wtostring-interpolated to warn if interpolator uses toString#10776
Conversation
6e463fb to
ab4a1d1
Compare
|
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 to
cbf369d
Compare
cbf369d to
dc21f58
Compare
|
Added the exclusion for primitives but not Dotty reflect says don't use
|
|
spurious error on first commit after rebase then |
lrytz
left a comment
There was a problem hiding this comment.
LGTM otherwise! I'm not familiar with the code though.
dc21f58 to
6afc3a5
Compare
|
gah |
|
/rebuild |
|
fool me twice |
lrytz
left a comment
There was a problem hiding this comment.
Nice, thank you! Let's squash before merge.
d138e6c to
1ac2451
Compare
|
Squashed & rebased for ✔️ (🤞 ) |
Adds -Wtostring-interpolated to warn if interpolator uses toString
Adds -Wtostring-interpolated to warn if interpolator uses toString-Wtostring-interpolated to warn if interpolator uses toString
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