Repository navigation
fix: match Angular for safe-read guard temporaries and temp order - #739
Merged
Merged
Conversation
…g again When a safe access copies a guard that has no temporary of its own, the copy re-ran every expression the guard had stored in a temporary, e.g. `(tmp_0_1 = ctx.f2())` twice, so calls and their side effects ran twice. Port Angular's eliminateTemporaryAssignments: in the copy, `tmp = expr` becomes `tmp = tmp`. Output now matches Angular's compliance file safe_access_temporaries_template_use_null.js. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The declarations were sorted as strings, so with 11 or more temporaries in one op `tmp_0_10` came before `tmp_0_2`. Keep the order the names were first assigned, like Angular's `new Set(defs.values())`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Follow-ups found while working on #737.
1. Safe-read guard ran calls twice
When the guard is copied into the body, Angular's
eliminateTemporaryAssignmentsturnstmp = exprintotmp = tmp. We copied the guard as is, so every call in it ran twice. Output now matches Angular's own compliance filesafe_access_temporaries_template_use_null.js.Arrow functions inside the guard are skipped, because they are their own scope. Angular walks into them too, but then fails with "Found xref with unassigned name". Main's output for those stays the same.
2. Temp declarations sorted as strings
With 11+ temps in one op we declared
tmp_0_10beforetmp_0_2. Now they keep the order they were first assigned, like Angular'snew Set(defs.values()). That is always number order.3. One shared
is_js_whitespacetransform/boundaries.rsnow uses the helper fromutil/chars.rsinstead of its own copy. No behaviour change.Checks
/* @ts-ignore */comment in@fortrack)safe_access_temporariescompliance files, now as Angular expectscargo test --all-featuresNot fixed here (older, separate)
_tmp, so a nested safe call can overwrite a value that is still needed. Angular refuses such templates ("Assign of unnamed temporary").🤖 Generated with Claude Code