Skip to content

fix(compiler): more permissive parsing of @ characters #62644

Closed
crisbeto wants to merge 2 commits intoangular:mainfrom
crisbeto:permissive-at
Closed

fix(compiler): more permissive parsing of @ characters #62644
crisbeto wants to merge 2 commits intoangular:mainfrom
crisbeto:permissive-at

Conversation

@crisbeto
Copy link
Copy Markdown
Member

When we introduced blocks, we made a deliberate decision to treat the @ character as a reserved character in case we need to use it for other syntax in the future. This meant that some common cases, like writing out an email address in the template, can be broken.

After some recent discussions we decided to relax the requirement and only treat @ as a reserve character if it's followed by a character sequence that matches a known block.

crisbeto added 2 commits July 15, 2025 11:40
There were 26 duplicated block tests in `lexer_spec.ts`, likely due to merge conflicts. These changes remove the duplicates while keeping the 6 tests that were different.
When we introduced blocks, we made a deliberate decision to treat the `@` character as a reserved character in case we need to use it for other syntax in the future. This meant that some common cases, like writing out an email address in the template, can be broken.

After some recent discussions we decided to relax the requirement and only treat `@` as a reserve character if it's followed by a character sequence that matches a known block.
@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label Jul 15, 2025
@angular-robot angular-robot bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Jul 15, 2025
@ngbot ngbot bot added this to the Backlog milestone Jul 15, 2025
@crisbeto crisbeto requested a review from atscott July 15, 2025 12:38
@crisbeto crisbeto added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jul 15, 2025
@crisbeto crisbeto marked this pull request as ready for review July 15, 2025 12:38
@JeanMeche
Copy link
Copy Markdown
Member

Currently, this doesn't allow joe@ifmail.com, should we maybe tokenize only if the previous character is a whitespace ? (space, linebreak, etc).

@crisbeto
Copy link
Copy Markdown
Member Author

Currently, this doesn't allow joe@ifmail.com, should we maybe tokenize only if the previous character is a whitespace ? (space, linebreak, etc).

I'm not sure we should do this, because in some cases if people want to control the whitespace, they might write something like text@if(foo) {value}more text.

@crisbeto
Copy link
Copy Markdown
Member Author

Passing TGP

@atscott atscott added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jul 15, 2025
@AndrewKushnir
Copy link
Copy Markdown
Contributor

This PR was merged into the repository by commit 18a6750.

The changes were merged into the following branches: main, 20.1.x

AndrewKushnir pushed a commit that referenced this pull request Jul 15, 2025
There were 26 duplicated block tests in `lexer_spec.ts`, likely due to merge conflicts. These changes remove the duplicates while keeping the 6 tests that were different.

PR Close #62644
AndrewKushnir pushed a commit that referenced this pull request Jul 15, 2025
When we introduced blocks, we made a deliberate decision to treat the `@` character as a reserved character in case we need to use it for other syntax in the future. This meant that some common cases, like writing out an email address in the template, can be broken.

After some recent discussions we decided to relax the requirement and only treat `@` as a reserve character if it's followed by a character sequence that matches a known block.

PR Close #62644
AndrewKushnir pushed a commit that referenced this pull request Jul 15, 2025
When we introduced blocks, we made a deliberate decision to treat the `@` character as a reserved character in case we need to use it for other syntax in the future. This meant that some common cases, like writing out an email address in the template, can be broken.

After some recent discussions we decided to relax the requirement and only treat `@` as a reserve character if it's followed by a character sequence that matches a known block.

PR Close #62644
@wartab
Copy link
Copy Markdown
Contributor

wartab commented Jul 16, 2025

Currently, this doesn't allow joe@ifmail.com, should we maybe tokenize only if the previous character is a whitespace ? (space, linebreak, etc).

I'm not sure we should do this, because in some cases if people want to control the whitespace, they might write something like text@if(foo) {value}more text.

I can confirm that this is sadly something we had to do in one or two places.

@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue 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 Aug 16, 2025
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.

5 participants