-
Notifications
You must be signed in to change notification settings - Fork 27k
@let validation fixes #56843
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 validation fixes #56843
Conversation
…ead before definition Fixes that in some cases `@let` declarations that are read before they're defined were producing multiple diagnostics.
fe0a8b6 to
ed10722
Compare
…trol flow blocks When we process `@if` and `@for` blocks, we create a scope around their expressions in order to encapsulate the aliases to them. The problem is that this doesn't represent the actual structure since the expression is part of the outer scope. This surfaces by not raising the "used before declared" diagnostic for `@let` declarations. These changes resolve the issue by processing the expression as a part of the parent scope. Fixes angular#56842.
| this.expressionScopes.set(branch, expressionScope); | ||
| const outerScope = Scope.forNodes(this.tcb, this.scope, branch, [], null); | ||
| outerScope.render().forEach((stmt) => this.scope.addStatement(stmt)); | ||
| this.expressionScopes.set(branch, outerScope); |
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.
This is the only line that actually changed. The rest of the diff here is renaming expressionScope to outerScope to be a bit more accurate.
|
Since these changes also affect |
|
This PR was merged into the repository by commit d7ab5c3. The changes were merged into the following branches: main, 18.1.x |
…trol flow blocks (#56843) When we process `@if` and `@for` blocks, we create a scope around their expressions in order to encapsulate the aliases to them. The problem is that this doesn't represent the actual structure since the expression is part of the outer scope. This surfaces by not raising the "used before declared" diagnostic for `@let` declarations. These changes resolve the issue by processing the expression as a part of the parent scope. Fixes #56842. PR Close #56843
…trol flow blocks (#56843) When we process `@if` and `@for` blocks, we create a scope around their expressions in order to encapsulate the aliases to them. The problem is that this doesn't represent the actual structure since the expression is part of the outer scope. This surfaces by not raising the "used before declared" diagnostic for `@let` declarations. These changes resolve the issue by processing the expression as a part of the parent scope. Fixes #56842. PR Close #56843
|
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. |
Fixes a couple of issues when we check if a
@letdeclaration is used before it is defined:fix(compiler-cli): avoid duplicate diagnostics for let declarations read before definition
Fixes that in some cases
@letdeclarations that are read before they're defined were producing multiple diagnostics.fix(compiler-cli): used before declared diagnostic not firing for control flow blocks
When we process
@ifand@forblocks, we create a scope around their expressions in order to encapsulate the aliases to them. The problem is that this doesn't represent the actual structure since the expression is part of the outer scope. This surfaces by not raising the "used before declared" diagnostic for@letdeclarations.These changes resolve the issue by processing the expression as a part of the parent scope.
Fixes #56842.