fix: listener handler scope should not merge parent local_definitions…#4
Merged
Merged
Conversation
… in resolve_names In Angular's resolve_names.ts, listener handler ops are processed as a completely separate lexical scope via recursive processLexicalScope(unit, op.handlerOps, savedView) — no merging from the parent view's scope. OXC incorrectly merged the parent view's update_scope (including local_definitions) into the handler scope. This caused @let declarations (which have local=true) from the update scope to take precedence over the handler's ContextLetReferenceExpr variables. The ContextLetReferenceExpr became unused, was removed by optimizeVariables, and then optimizeStoreLet couldn't find external @let usage — incorrectly removing the storeLet wrapper and causing cumulative pipe varOffset drift. The fix makes handler ops self-contained (matching Angular), since generateVariables already prepends all necessary variables to handler_ops. Fixes 43 ClickUp comparison mismatches (203 → 160, 96.5% → 97.3%). 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 resolve_names
In Angular's resolve_names.ts, listener handler ops are processed as a completely separate lexical scope via recursive processLexicalScope(unit, op.handlerOps, savedView) — no merging from the parent view's scope.
OXC incorrectly merged the parent view's update_scope (including local_definitions) into the handler scope. This caused @let declarations (which have local=true) from the update scope to take precedence over the handler's ContextLetReferenceExpr variables. The ContextLetReferenceExpr became unused, was removed by optimizeVariables, and then optimizeStoreLet couldn't find external @let usage — incorrectly removing the storeLet wrapper and causing cumulative pipe varOffset drift.
The fix makes handler ops self-contained (matching Angular), since generateVariables already prepends all necessary variables to handler_ops.
Fixes 43 ClickUp comparison mismatches (203 → 160, 96.5% → 97.3%).
Note
Medium Risk
Changes lexical name resolution for all listener/animation handler ops, which can alter generated JS and variable binding behavior across many templates. The logic is localized but touches core scoping used by event callbacks and could regress edge-case variable capture if mis-modeled.
Overview
Aligns
resolve_nameswith Angular by treating listener/animationhandler_opsas a fresh lexical scope built only from handler variables, removing the previous merge of parentscope/local_definitionsinto handler resolution.Adds integration coverage for
@letvalues produced via pipes when referenced from child views or listener callbacks, assertingɵɵstoreLetpreservation (avoiding pipevarOffsetdrift) and snapshotting the expecteddeclareLet/readContextLetoutput.Written by Cursor Bugbot for commit fddd914. This will update automatically on new commits. Configure here.