Skip to content

refactor(compiler): remove write-only collections from template pipeline phases - #70690

Merged
pkozlowski-opensource merged 1 commit into
angular:mainfrom
yoominho91:refactor/compiler-drop-write-only-collections
Sep 16, 2026
Merged

pkozlowski-opensource merged 1 commit into
angular:mainfrom
yoominho91:refactor/compiler-drop-write-only-collections

Conversation

@yoominho91

Copy link
Copy Markdown
Contributor

PR Checklist

PR Type

  • Refactoring (no functional changes, no api changes)

What is the current behavior?

Issue Number: N/A

Two phases in the template pipeline fill a collection that is never read:

  • allocateSlots builds slotMap (xref → slot) for every declaration. The
    comment above the second scan says slotMap will be used to propagate slot
    indexes into expressions, but the scan never reads it. Slot indexes already
    reach expressions through the shared op.handle, and the scan only copies
    each view's decls onto the op that declares it.
  • generateTemporaries adds each temporary to released on its final read,
    but nothing reads the set. Name reuse is driven by count alone.

What is the new behavior?

Both collections are removed. The comment on the second scan in
allocateSlots now describes what it does. Emitted output is unchanged, since
neither value was ever read.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Found with a static check for collections that are only ever written, then
confirmed by reading each phase.

https://claude.ai/code/session_01ABuXgtVFhvgie5kXCPcBja

@pullapprove
pullapprove Bot requested a review from kirjs September 11, 2026 13:27
@angular-robot angular-robot Bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Sep 11, 2026
@ngbot ngbot Bot added this to the Backlog milestone Sep 11, 2026
…ine phases

`allocateSlots` built a `slotMap` of every declaration's slot, and its comment
said the second scan would use it to propagate slot indexes into expressions.
The second scan never reads it: slot indexes reach expressions through the
shared `op.handle`, and the scan only copies each view's `decls` onto the op
that declares it. The comment now describes what the scan does.

`generateTemporaries` added each temporary to a `released` set on its final
read, but nothing read the set; name reuse is driven by `count` alone.
@yoominho91
yoominho91 force-pushed the refactor/compiler-drop-write-only-collections branch from c11aa6e to 9a04682 Compare September 11, 2026 13:37
@JeanMeche
JeanMeche removed the request for review from kirjs September 11, 2026 14:04
@JeanMeche JeanMeche added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Sep 11, 2026
@pkozlowski-opensource
pkozlowski-opensource merged commit 45e314f into angular:main Sep 16, 2026
27 checks passed
@pkozlowski-opensource

Copy link
Copy Markdown
Member

This PR was merged into the repository. The changes were merged into the following branches:

@angular-automatic-lock-bot

Copy link
Copy Markdown

This pull request has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Oct 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants