Files
angular/packages/compiler-cli
jhjh1214 4e4df4a696 fix(compiler): report errors for malformed template literal interpolations
The expression parser silently discarded any tokens that followed the
expression inside a template literal interpolation. For example,
`${a b}` was parsed as `${a}` and `${flags & 1}` as `${flags}`, without
a diagnostic. A template literal with an interpolation that was never
terminated was also accepted, because its lexer error was skipped in the
same way.

`parseTemplateLiteral` used a catch-all `advance()` to consume the `}`
that closes an interpolation, which also consumed anything else that was
left over. The closing brace is now expected explicitly, before
`rbracesExpected` is decremented so that error recovery still stops at
the brace of the interpolation, and lexer errors are reported.

Templates that were previously accepted with the extra tokens dropped
(or with an unterminated literal) now fail to compile with a parse
error. Valid expressions are not affected.

(cherry picked from commit 8ffc232bbf)
2026-10-24 13:54:54 -07:00
..