Skip to content

fix(compiler): port specializeControlProperties for Angular >= 21.2 (22.2 compat) - #530

Merged
Brooooooklyn merged 1 commit into
mainfrom
fix/angular-22-2-control-instructions
Oct 4, 2026
Merged

Brooooooklyn merged 1 commit into
mainfrom
fix/angular-22-2-control-instructions

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Member

Summary

Ports Angular's specializeControlProperties pipeline phase so oxc emits ɵɵcontrolCreate()/ɵɵcontrol() for Signal Forms bindings, fixing fixture-compare mismatches against Angular 22.2.0 (the failures seen on the #500 Renovate bump).

What changed

  • New phase specialize_control_properties (template jobs only, between specializeBindings and convertAnimations): scans Property/Attribute/TwoWayProperty update ops, inserts ControlCreate after the owning create op and Control after the binding update op.
  • Removed the previous emit sites — ingest-time ControlCreate and the control insertions inside binding_specialization — so Attribute-op scanning and version-dependent anchor selection work correctly.
  • Version gating on AngularVersion:
    • < 21.2: no control instructions.
    • 21.2–22.1.x: eligible = formField (Property) / extended set on 22.x; controlCreate anchors after the last eligible create op (Element/ElementStart/ElementEnd/Container/ContainerStart/ContainerEnd/Template).
    • >= 22.2: controlCreate anchors after the first eligible create op (Element/ElementStart/Container/ContainerStart only), so ng-template no longer qualifies and controlCreate sits right after the element start.
    • Unknown version behaves like latest.
  • Regenerated 3 snapshots (controlCreate now follows elementStart).

Verification

  • cargo test -p oxc_angular_compiler: all green.
  • Fixture compare suite (napi/angular-compiler/e2e/compare): 835/835 pass against both Angular 22.1.7 and 22.2.0 (previously 8 mismatches on 22.2.0).

…21.2

Angular 21.2 introduced ɵɵcontrolCreate/ɵɵcontrol emission for
form-field bindings, and 22.2 changed where controlCreate anchors
(first element/container start op instead of last anchor op, and
ng-template no longer qualifies).

Replace the ingest-time and binding-specialization emit sites with a
faithful port of the upstream specializeControlProperties phase:

- scans Property/Attribute/TwoWayProperty update ops against the
  ELIGIBLE_CONTROL_PROPERTIES map (formField on 21.2+; formControl,
  formControlName, ngModel on 22.0+)
- anchors ControlCreate after the last eligible create op on
  21.2-22.1.x (ElementEnd/ContainerEnd/Template count) and after the
  first eligible create op on 22.2+ (element/container starts only)
- inserts Control right after the source binding update op
- gates everything behind angular_version predicates; unknown version
  behaves like latest

Verified: cargo test green; fixture compare suite passes against
Angular 22.1.7 and 22.2.0 (835/835 each).
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@Brooooooklyn
Brooooooklyn merged commit 8db7ac4 into main Oct 4, 2026
10 checks passed
@Brooooooklyn
Brooooooklyn deleted the fix/angular-22-2-control-instructions branch October 4, 2026 12:11
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