fix: handle TemplateLiteral in convert_ast_to_ir to register pipes and resolve @let variables#259
Merged
Brooooooklyn merged 2 commits intovoidzero-dev:mainfrom May 5, 2026
Conversation
…d resolve @let variables TemplateLiteral was not handled in convert_ast_to_ir and fell through to store_and_ref_expr, so any BindingPipe inside was never registered with pipe_creation and @let variable reads were resolved against ctx instead of the local scope. Fix adds an explicit arm for AngularExpression::TemplateLiteral that recursively converts inner expressions via convert_ast_to_ir, producing IrExpression::ResolvedTemplateLiteral with properly converted children. Also adds ResolvedTemplateLiteral traversal to pipe_creation and resolve_names so pipes are discovered and names are resolved correctly. Confirmed output matches Angular 21.2.4 ngtsc for the same templates.
Brooooooklyn
approved these changes
May 5, 2026
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.
Summary
AngularExpression::TemplateLiteralhad no explicit arm inconvert_ast_to_ir()(ingest.rs) and fell through tostore_and_ref_expr, which stores the entire node as a raw AST blob. This made the innerBindingPipeinvisible topipe_creation(no pipe slot allocated) and preventedresolve_namesfrom resolving@letvariable reads inside the literal.TemplateLiteralarms in three phases —ingest.rs(createIrExpression::ResolvedTemplateLiteralby recursively converting inner expressions),pipe_creation.rs(traverse inner expressions to register pipes), andresolve_names.rs(traverse inner expressions to resolve lexical reads).{{ `${num | percent}` }}with an@letvariable and pipe inside a template literal — previously produced incorrect output where the pipe was never registered and the variable was resolved againstctxinstead of the local scope.Test plan
tests/integration_test.rs(7 tests): pipe inside template literal, pipe + surrounding text, no-pipe regression, attribute binding, multiple pipes, pipe in child view@angular/compiler21.2.4 — identical runtime call sequencenapi/angular-compiler/test/transform.test.ts