-
Notifications
You must be signed in to change notification settings - Fork 27k
@let bug fixes #56752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@let bug fixes #56752
Conversation
Fixes that we were only capturing `@let` declarations at the top level of the scope, not any of the nested children.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that this is the most elegant way of solving it, but I think it's likely the most future-proof. Some alternatives that were considered, but didn't work:
- Iterating the instructions in reverse seems to break cases where variables depend on other variables. Otherwise this would've been the simplest.
- We can't hoist the local
@letvariables to the top, because they need anadvancecall.
thePunderWoman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reviewed-for: public-api
atscott
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reviewed-for: public-api
…cal symbols Expands the check around conflicting `@let` declarations to also cover template variables and local references.
packages/compiler/src/template/pipeline/src/phases/resolve_names.ts
Outdated
Show resolved
Hide resolved
…ones Currently the logic that maps a name to a variable looks at the variables in their definition order. This means that `@let` declarations from parent views will always come before local ones, because the local ones are declared inline whereas the parent ones are hoisted to the top of the function. These changes resolve the issue by giving precedence to the local variables. Fixes angular#56737.
…ones (#56752) Currently the logic that maps a name to a variable looks at the variables in their definition order. This means that `@let` declarations from parent views will always come before local ones, because the local ones are declared inline whereas the parent ones are hoisted to the top of the function. These changes resolve the issue by giving precedence to the local variables. Fixes #56737. PR Close #56752
|
This PR was merged into the repository by commit 2a1291e. The changes were merged into the following branches: main |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Includes the following fixes related to
@let:fix(compiler-cli): type check let declarations nested inside nodes
Fixes that we were only capturing
@letdeclarations at the top level of the scope, not any of the nested children.fix(compiler-cli): flag all conflicts between let declarations and local symbols
Expands the check around conflicting
@letdeclarations to also cover template variables and local references.fix(compiler): give precedence to local let declarations over parent ones
Currently the logic that maps a name to a variable looks at the variables in their definition order. This means that
@letdeclarations from parent views will always come before local ones, because the local ones are declared inline whereas the parent ones are hoisted to the top of the function.These changes resolve the issue by giving precedence to the local variables.
Fixes #56737.