Skip to content

fix(lexer): a < doesn't end a @let value - #600

Open
Rush wants to merge 1 commit into
voidzero-dev:mainfrom
encharm:fix/let-value-less-than
Open

Rush wants to merge 1 commit into
voidzero-dev:mainfrom
encharm:fix/let-value-less-than

Conversation

@Rush

@Rush Rush commented Oct 21, 2026

Copy link
Copy Markdown

@let small = count < 10; was cut at the <, which the HTML lexer took for the start of a tag, and reported as an incomplete @let declaration, so the component was left uncompiled.

Angular's _consumeLetDeclarationValue ends the value only at a ; outside quotes (or EOF), so a < is part of the expression. The lexer now does the same; the quote handling it already had is unchanged.

Tests: two lexer cases next to the existing @let ones (html_lexer_test.rs), and tests/let_value_less_than_test.rs, which compiles

@let small = count < 10; @let both = a < b && b < c;
<span>{{ small }} {{ both }}</span>

to const small_r1 = (ctx.count < 10); and const both_r2 = ((ctx.a < ctx.b) && (ctx.b < ctx.c));, as @angular/compiler-cli 21.0.1 does (without the parentheses). The lexer tests fail without the change.

`@let small = count < 10;` was cut at the `<`, which the lexer took for a tag,
and reported as an incomplete @let declaration, so the component wasn't
compiled. Like Angular's `_consumeLetDeclarationValue`, only a `;` outside
quotes (or EOF) ends the value now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant