Found while fixing #583. Filed rather than folded in, per AGENTS.md: it is a
stale claim about grouping, left behind by #574/#581, and has nothing to do
with the sign change #583 is about.
Verification status: reproduced by reading the code, against real output
Revision: 992b190c (current master). The contradiction is textual, so "read
the code" is the whole of it — but the behaviour the comment describes is
measured below, not assumed.
include/morph/render/locale_format.hpp, the Doxygen block on
formatCanonicalNumber:
/// The display-direction inverse of `normalizeLocaleNumber`'s
/// decimal-separator substitution, plus display-only thousands grouping
/// (grouping is never accepted back on entry — `normalizeLocaleNumber`
/// strips it unconditionally). Passing `decimalSeparator == "."` and an empty
/// @p groupSeparator is the identity transform.
Both halves of the parenthetical are now false:
-
"grouping is never accepted back on entry" — it is. A correctly placed
group separator normalises:
normalizeLocaleNumber("1.050,25", dec=",", grp=".") -> "1050.25"
normalizeLocaleNumber("1.000.000,25", dec=",", grp=".") -> "1000000.25"
(tests/test_render_locale_format.cpp, "every well-formed locale entry still
normalises", pins exactly this.)
-
"strips it unconditionally" — that is precisely what morph#574 stopped it
doing, three doc paragraphs earlier in the same header, under the heading
"Grouping is validated, not stripped (morph#574)". A misplaced separator
is now rejected:
normalizeLocaleNumber("1.5", dec=",", grp=".") -> NULLOPT
normalizeLocaleNumber("1.2.3.4", dec=",", grp=".") -> NULLOPT
git log -S "strips it unconditionally" dates the sentence to d2cb3ae1, long
before #574 — so this is a doc comment that was correct when written and was not
updated when the behaviour it describes was deliberately reversed.
docs/spec/forms/forms.md, "Locale data formatting", has the correct account
("Grouping is validated, never merely stripped."), so the spec and the header
disagree, with the header wrong. Per AGENTS.md that makes the header the thing to
change, not the spec.
Why it matters at all
It is only a comment — no behaviour depends on it. But it is the comment a reader
hits when deciding whether formatCanonicalNumber's output can be fed back
through normalizeLocaleNumber, and it tells them the round trip does not hold
when it does. The whole point of the #574 work was that the grouping contract is
the thing people get wrong.
Fix
Delete or rewrite the parenthetical, e.g. "grouping is validated on the way back
in — see normalizeLocaleNumber — so a grouped display round-trips". A one-line
documentation change with no behavioural component.
What would change the verdict
Close it when the comment no longer claims either of the two false things. Re-open
only if normalizeLocaleNumber is ever changed back to stripping grouping
unconditionally, which #574 exists to prevent.
Not verified here
Whether the same stale claim appears anywhere else in the tree. Grepped for the
exact phrase — "strips it unconditionally" occurs once, in this header — but
not for paraphrases of it.
Found while fixing #583. Filed rather than folded in, per AGENTS.md: it is a
stale claim about grouping, left behind by #574/#581, and has nothing to do
with the sign change #583 is about.
Verification status: reproduced by reading the code, against real output
Revision:
992b190c(current master). The contradiction is textual, so "readthe code" is the whole of it — but the behaviour the comment describes is
measured below, not assumed.
include/morph/render/locale_format.hpp, the Doxygen block onformatCanonicalNumber:Both halves of the parenthetical are now false:
"grouping is never accepted back on entry" — it is. A correctly placed
group separator normalises:
(
tests/test_render_locale_format.cpp, "every well-formed locale entry stillnormalises", pins exactly this.)
"strips it unconditionally" — that is precisely what morph#574 stopped it
doing, three doc paragraphs earlier in the same header, under the heading
"Grouping is validated, not stripped (morph#574)". A misplaced separator
is now rejected:
git log -S "strips it unconditionally"dates the sentence tod2cb3ae1, longbefore #574 — so this is a doc comment that was correct when written and was not
updated when the behaviour it describes was deliberately reversed.
docs/spec/forms/forms.md, "Locale data formatting", has the correct account("Grouping is validated, never merely stripped."), so the spec and the header
disagree, with the header wrong. Per AGENTS.md that makes the header the thing to
change, not the spec.
Why it matters at all
It is only a comment — no behaviour depends on it. But it is the comment a reader
hits when deciding whether
formatCanonicalNumber's output can be fed backthrough
normalizeLocaleNumber, and it tells them the round trip does not holdwhen it does. The whole point of the #574 work was that the grouping contract is
the thing people get wrong.
Fix
Delete or rewrite the parenthetical, e.g. "grouping is validated on the way back
in — see
normalizeLocaleNumber— so a grouped display round-trips". A one-linedocumentation change with no behavioural component.
What would change the verdict
Close it when the comment no longer claims either of the two false things. Re-open
only if
normalizeLocaleNumberis ever changed back to stripping groupingunconditionally, which #574 exists to prevent.
Not verified here
Whether the same stale claim appears anywhere else in the tree. Grepped for the
exact phrase —
"strips it unconditionally"occurs once, in this header — butnot for paraphrases of it.