Skip to content

Derive the supported collations from the per-locale lists - #3006

Merged
lahma merged 1 commit into
sebastienros:mainfrom
lahma:fix/supportedvaluesof-collation-derived
Aug 13, 2026
Merged

Derive the supported collations from the per-locale lists#3006
lahma merged 1 commit into
sebastienros:mainfrom
lahma:fix/supportedvaluesof-collation-derived

Conversation

@lahma

@lahma lahma commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

The follow-up #2989's commit message promised: Intl.supportedValuesOf("collation") was backed by DefaultCldrProvider.GetSupportedCollations(), a third hand-kept list not derived from LocaleCollationSupport — consistent today only because #2989 edited it in the same commit, and free to drift exactly the way the #2974 bug did. It is now the union of every per-language list plus the root pair, per AvailableCanonicalCollations: sorted in ascending code-unit order, unique, with standard/search excluded at derivation (the IsReportableCollation filter, so a future table edit cannot reintroduce them).

A behavioural red is impossible — #2989 already made the hand-kept list agree — so the test's teeth were proven by injection: adding one fake collation to the table makes SupportedValuesOfCollationIsTheUnionOfEveryLocalesCollations fail against a hardcoded list and pass once derived. Injection reverted; the reported values are unchanged at the same twelve. test262's collations-accepted-by-Collator.js stays green.

Rebased onto current main after #2989's merge; IntlTests 171/171 on both TFMs.

🤖 Generated with Claude Code

Intl.supportedValuesOf("collation") was a third hardcoded collation list, in
DefaultCldrProvider.GetSupportedCollations, next to the per-language table and
the root pair the other two views read.
https://tc39.es/ecma402/#sec-availablecanonicalcollations asks for "the
collations for which the implementation provides the functionality of
Intl.Collator objects", sorted in lexicographic code unit order and unique -
which is the union of the one [[co]] list every locale has and nothing else, so
there was never a second fact for that list to hold. It is now read off
LocaleCollations, the same derived data getCollations and Intl.Collator resolve
against.

It agreed with them when this was written, and the previous change is what made
that true again - but agreeing today is exactly what the two views did before
sebastienros#2974. The failure modes are asymmetric and only one of them is caught:
a value listed that no locale resolves turns
intl402/Intl/supportedValuesOf/collations-accepted-by-Collator.js red, which is
how the deprecated CLDR types were noticed, while a collation some locale
reports and the list omits is invisible to test262 - AvailableCollations is
implementation-defined, so nothing checks it from that side. Adding a collation
to LocaleCollationSupport used to produce exactly that silent second case; it
now shows up in all three views by the same act.

"standard", "search" and "default" need no exclusion of their own here.
IsReportableCollation already keeps them out of every list being unioned, which
is what https://tc39.es/ecma402/#sec-intl-collator-internal-slots (10.2.3)
requires of the per-locale lists and what
intl402/Intl/supportedValuesOf/collations.js checks of this one - the same
guard now answering for both. Sorting is likewise not restated: the union is
built in code unit order, which is what 15.5.10 and this clause both ask for
and what IntlInstance.SupportedValuesOf sorts by anyway.

The values are unchanged: compat, dict, emoji, eor, phonebk, phonetic, pinyin,
searchjl, stroke, trad, unihan and zhuyin, the same twelve the hardcoded list
ended at. The tests pin both the derivation - the union over every language,
built from getCollations rather than from the expected answer - and that
literal list, so a change to the table has to be a deliberate edit in two
places rather than a silent divergence in one.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@lahma
lahma enabled auto-merge (squash) August 13, 2026 16:19
@lahma
lahma merged commit a262bfa into sebastienros:main Aug 13, 2026
5 checks passed
@lahma
lahma deleted the fix/supportedvaluesof-collation-derived branch August 13, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant