-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compiler): unclear lexer error when using private identifier in e…
…xpressions (#42027) TypeScript supports ECMAScript private identifiers. It can happen that developers intend to access such members from within an expression. This currently results in an unclear error from the lexer. e.g. ``` 'Parser Error: Unexpected token # at column 1 in [{{#myField}}] in C:/test.ts@5:2 ``` We could improve such errors by tokenizing private identifiers similar to how the TypeScript scanner processes them. Later we can report better errors in the expression parser or in the typecheck block. This commit causes all private identifier tokens to be disallowed, so it never reaches the type checker. This is done intentionally as private identifiers should not be considered valid Angular syntax, especially because private fields are not guaranteed to be accessible from within a component/directive definition (e.g. there cases where a template function is generated outside of the class; which results in private members not being accessible; and this results in mixed/confusing behavior). Fixes #36003. PR Close #42027
- Loading branch information
1 parent
63383c1
commit 3c726c3
Showing
5 changed files
with
97 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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