fix: i18n attribute bindings should not inflate xref IDs for @for index variables#7
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 fromOption<XrefId>toOption<u32>(the parser-assignedinstance_id).ComponentCompilationJobnow storesi18n_message_metadatakeyed byinstance_idand removes the message-key→xref cache, with ingest and i18n phases (create_i18n_contexts,extract_i18n_messages, ICU/i18n propagation/wrapping) updated to useinstance_idfor dedup and metadata lookup.Adds an integration snapshot test ensuring an i18n attribute before an
@fordoes not shift xref allocation, keeping generatedɵ$index_Nvariable naming aligned with Angular.Written by Cursor Bugbot for commit fce544d. This will update automatically on new commits. Configure here.