fix(angular): use fail-fast error handling for invariant violations and remove panics#37
Merged
Brooooooklyn merged 1 commit intomainfrom Feb 25, 2026
Merged
Conversation
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
crates/oxc_angular_compiler/src/pipeline/phases/variable_optimization.rs
Outdated
Show resolved
Hide resolved
…nd remove panics - Make i18n metadata type checks fail-fast (return early) instead of silently dropping placeholders, matching Angular's throw behavior - Make unknown @for loop variable checks fail-fast instead of emitting empty expressions, matching Angular's AssertionError throw - Add 4 unit tests for the fail-fast behavior - Replace all panic!/unreachable!/debug_assert! in production code with diagnostics-style error reporting or safe fallbacks (10 instances) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
f4b09d5 to
d8306dd
Compare
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.

silently dropping placeholders, matching Angular's throw behavior
empty expressions, matching Angular's AssertionError throw
diagnostics-style error reporting or safe fallbacks (10 instances)
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com
Note
Medium Risk
Touches core compiler ingestion/optimization paths and changes error-handling semantics to early-return with diagnostics, which can alter emitted IR/output on previously tolerated invalid states.
Overview
Aligns Angular template ingestion with Angular’s fail-fast behavior by treating unexpected i18n metadata and unknown
@forloop variables as hard errors:convert_i18n_meta_to_placeholder/get_computed_for_loop_variable_expressionnow returnResult, callers early-return to avoid emitting broken IR, and new unit tests cover these cases.Across several pipeline/output phases, replaces
panic!/unreachable!/debug_assert!-guarded invariants with diagnostics plus safe fallbacks (e.g., cloningWrappedIrNode→undefined, skipping multi-line arrow function conversion, handling short safe-ternary chains, reporting unexpectedUpdateOpvariants, and graceful CSS quote handling).Written by Cursor Bugbot for commit d8306dd. This will update automatically on new commits. Configure here.