Make CatchClause
scope optional
#4345
Labels
A-semantic
Area - Semantic
C-cleanup
Category - technical debt or refactoring. Solution not expected to change behavior
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.The text was updated successfully, but these errors were encountered: