Skip to content

Test collator fallback overrides#7879

Merged
robertbastian merged 1 commit intounicode-org:mainfrom
robertbastian:sr
Apr 21, 2026
Merged

Test collator fallback overrides#7879
robertbastian merged 1 commit intounicode-org:mainfrom
robertbastian:sr

Conversation

@robertbastian
Copy link
Copy Markdown
Member

@robertbastian robertbastian commented Apr 16, 2026

Fixes #7873

Changelog

N/A

@robertbastian robertbastian requested review from a team, Manishearth and sffc as code owners April 16, 2026 10:02
@robertbastian robertbastian force-pushed the sr branch 3 times, most recently from 47f1dc5 to 2edce4f Compare April 16, 2026 10:20
@sffc
Copy link
Copy Markdown
Member

sffc commented Apr 17, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the collation provider to use a macro for data loading and conversion, and updates the ParentLocales struct to use HashMap instead of BTreeMap. I have identified two significant issues: first, the inclusion of CollationRootV1 and CollationTailoringV1 in the collation_provider! macro introduces logic errors regarding locale handling that require either manual implementation or macro extension. Second, the #[cfg(any(feature = "use_wasm", feature = "use_icu4c"))] attribute on several convert methods is overly restrictive and should be removed to prevent unnecessary compilation failures.

Comment thread provider/source/src/collator/mod.rs
Comment thread provider/source/src/collator/mod.rs
@sffc
Copy link
Copy Markdown
Member

sffc commented Apr 18, 2026

This is a big diff and I don't think this PR blocks anything so it's not currently at the top of my priority queue, but I will get to it when I have time.

@robertbastian
Copy link
Copy Markdown
Member Author

You asked me to do this as part of #7867, would you have also moved that to the back of your "priority queue" if I had done it in that PR?

Also, +116 -124 is really not a big diff.

@sffc
Copy link
Copy Markdown
Member

sffc commented Apr 20, 2026

You asked me to do this as part of #7867, would you have also moved that to the back of your "priority queue" if I had done it in that PR?

Also, +116 -124 is really not a big diff.

A big diff like this would have slowed down my review of #7867, yes.

It's moderate in line count, but it requires me to upload the structure of the whole file to understand what the new macro does and doesn't accomplish. I just need some focus time to give this PR a review, which I expect to have soon.

Copy link
Copy Markdown
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work

let parent = parent.into();

$(
if !$marker::INFO.is_singleton {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (optional): Since this depends only on $marker, I would prefer if this function were not inside a macro, and the macro can call it, like check_fallback::<$marker>()

Comment thread provider/source/src/collator/mod.rs
#[serde(rename = "parentLocale")]
pub(crate) parent_locale: HashMap<LanguageIdentifier, LanguageIdentifier>,
pub(crate) collations: BTreeMap<String, LanguageIdentifier>,
pub(crate) collations: HashMap<LanguageIdentifier, LanguageIdentifier>,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Observation: the HashMap could make the test nondeterministic if it starts failing, but right now it is fine because the test is passing

@robertbastian robertbastian merged commit d6d295c into unicode-org:main Apr 21, 2026
35 checks passed
@robertbastian robertbastian deleted the sr branch April 21, 2026 06:45
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.

Test the collator fallback behavior in datagen

2 participants