Skip to content
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

Make CatchClause scope optional #4345

Closed
overlookmotel opened this issue Jul 18, 2024 · 1 comment · Fixed by #4346
Closed

Make CatchClause scope optional #4345

overlookmotel opened this issue Jul 18, 2024 · 1 comment · Fixed by #4346
Labels
A-semantic Area - Semantic C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Comments

@overlookmotel
Copy link
Contributor

overlookmotel commented Jul 18, 2024

CatchClause does not need a scope if there's no param e.g. try {} catch {}. Add back #[scope(if(self.param.is_some()))].

As discussed in #4192 (review), there's an argument for making all scopes unconditional. But in my opinion, either way the most important thing is to be consistent, so scopes-related code is easier to reason about.

At present, our policy is not to create a scope if none is needed (because it has no bindings). So we should keep to that policy for CatchClause. If we want to change the policy, we can do that, but we should do it consistently for all scopes.

@overlookmotel overlookmotel added A-semantic Area - Semantic C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Jul 18, 2024
@overlookmotel
Copy link
Contributor Author

Fixed in #4346.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-semantic Area - Semantic C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant