Skip to content

fix: i18n attribute bindings should not inflate xref IDs for @for index variables#7

Merged
Brooooooklyn merged 1 commit into
mainfrom
02-04-fix_for_index_xref_inflation
Feb 4, 2026
Merged

fix: i18n attribute bindings should not inflate xref IDs for @for index variables#7
Brooooooklyn merged 1 commit into
mainfrom
02-04-fix_for_index_xref_inflation

Conversation

@Brooooooklyn
Copy link
Copy Markdown
Member

@Brooooooklyn Brooooooklyn commented Feb 4, 2026

In Angular's TS compiler, BindingOp.i18nMessage stores a direct object reference to the i18n.Message -- no XrefId is allocated during ingest. The xref for the i18n context is only allocated later in the create_i18n_contexts phase.

Oxc was allocating xrefs for i18n messages during ingest, inflating the xref counter and causing @for body views to get higher xref values than Angular. This made generated variable names like ɵ$index_N use the wrong N value (e.g., ɵ$index_70 instead of ɵ$index_66).

Change i18n_message fields from Option to Option across all ops, using the i18n message's instance_id as a dedup key instead of allocating xrefs. This matches Angular TS's approach of using object identity for dedup without consuming xref slots.

Fixes 8 mismatched files in the ClickUp comparison (158 → 150).


Note

Medium Risk
Touches i18n IR/plumbing across ingest and multiple phases, so mistakes could break message extraction/dedup and downstream codegen. Scoped to i18n message identity tracking (switching to instance_id) with added regression coverage, lowering likelihood of unnoticed behavior drift.

Overview
Stops i18n attribute bindings from consuming extra XrefIds during ingest by switching i18n message references across IR ops and phases from Option<XrefId> to Option<u32> (the parser-assigned instance_id).

ComponentCompilationJob now stores i18n_message_metadata keyed by instance_id and removes the message-key→xref cache, with ingest and i18n phases (create_i18n_contexts, extract_i18n_messages, ICU/i18n propagation/wrapping) updated to use instance_id for dedup and metadata lookup.

Adds an integration snapshot test ensuring an i18n attribute before an @for does not shift xref allocation, keeping generated ɵ$index_N variable naming aligned with Angular.

Written by Cursor Bugbot for commit fce544d. This will update automatically on new commits. Configure here.

…ex variables

In Angular's TS compiler, BindingOp.i18nMessage stores a direct object
reference to the i18n.Message -- no XrefId is allocated during ingest.
The xref for the i18n context is only allocated later in the
create_i18n_contexts phase.

Oxc was allocating xrefs for i18n messages during ingest, inflating the
xref counter and causing @for body views to get higher xref values than
Angular. This made generated variable names like ɵ$index_N use the wrong
N value (e.g., ɵ$index_70 instead of ɵ$index_66).

Change i18n_message fields from Option<XrefId> to Option<u32> across all
ops, using the i18n message's instance_id as a dedup key instead of
allocating xrefs. This matches Angular TS's approach of using object
identity for dedup without consuming xref slots.

Fixes 8 mismatched files in the ClickUp comparison (158 → 150).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Brooooooklyn Brooooooklyn merged commit bf443cb into main Feb 4, 2026
3 checks passed
@Brooooooklyn Brooooooklyn deleted the 02-04-fix_for_index_xref_inflation branch February 4, 2026 07:53
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