Skip to content

fix(angular): fix 5 compiler divergences from Angular reference#34

Merged
Brooooooklyn merged 1 commit intomainfrom
fix/angular-5-compiler-divergences
Feb 24, 2026
Merged

fix(angular): fix 5 compiler divergences from Angular reference#34
Brooooooklyn merged 1 commit intomainfrom
fix/angular-5-compiler-divergences

Conversation

@Brooooooklyn
Copy link
Member

@Brooooooklyn Brooooooklyn commented Feb 24, 2026

  1. (High) @let self-reference: mark name as declared AFTER transforming
    the declaration op, so self-references like @let x = x + 1 are
    replaced with undefined — matching Angular's backward walk.

  2. (Medium) @for invalid-shape recovery: return None when expression
    parsing fails or track is missing, matching Angular which returns
    null node instead of synthesizing a broken ForLoopBlock.

  3. (Medium) @if invalid main-parameter recovery: only push the main
    branch (and @else if branches) when the expression parses
    successfully, matching Angular's conditional push.

  4. (Medium) @switch invalid parameter count: parse the first parameter
    when present (even with extra params), only use empty binding when
    there are no parameters — matching Angular's createSwitchBlock.

  5. (Low) Reify conditional contract: replace panic with
    OxcDiagnostic::error for missing processed expression, matching the
    StoreLet precedent in the same file and the project convention of
    diagnostics over panics.

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com


Note

Medium Risk
Changes affect control-flow block AST emission and @let reference rewriting, which can alter generated code and error-recovery behavior across templates. Risk is moderated by added conformance tests and diagnostics replacing panics.

Overview
Aligns several template-compiler behaviors with Angular’s reference implementation, primarily around control-flow and error recovery.

@let handling now treats the declaration op itself as not yet declared, so self-references like @let x = x + 1 are rewritten to undefined (matching Angular’s backward walk). Control-flow transforms now skip emitting @for nodes when parameter parsing fails or when track is missing, skip pushing @if/@else if branches when the condition expression didn’t parse, and adjust @switch to always parse the first parameter when present even if extra params exist.

Reify’s Conditional op no longer falls back to test/null; it emits a diagnostic and drops the stmt if the processed condition is missing. Adds/updates integration and R3-transform tests plus a snapshot to lock in the new conformance behavior.

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

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

1. (High) @let self-reference: mark name as declared AFTER transforming
   the declaration op, so self-references like `@let x = x + 1` are
   replaced with `undefined` — matching Angular's backward walk.

2. (Medium) @for invalid-shape recovery: return None when expression
   parsing fails or track is missing, matching Angular which returns
   null node instead of synthesizing a broken ForLoopBlock.

3. (Medium) @if invalid main-parameter recovery: only push the main
   branch (and @else if branches) when the expression parses
   successfully, matching Angular's conditional push.

4. (Medium) @switch invalid parameter count: parse the first parameter
   when present (even with extra params), only use empty binding when
   there are no parameters — matching Angular's createSwitchBlock.

5. (Low) Reify conditional contract: replace panic with
   OxcDiagnostic::error for missing processed expression, matching the
   StoreLet precedent in the same file and the project convention of
   diagnostics over panics.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Brooooooklyn Brooooooklyn force-pushed the fix/angular-5-compiler-divergences branch from dbb49c4 to d470ed7 Compare February 24, 2026 06:06
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@Brooooooklyn Brooooooklyn merged commit ddb8c9c into main Feb 24, 2026
4 checks passed
@Brooooooklyn Brooooooklyn deleted the fix/angular-5-compiler-divergences branch February 24, 2026 06:34
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