[syntax-errors] nonlocal declaration at module level (#17559)
## Summary Part of #17412 Add a new compile-time syntax error for detecting `nonlocal` declarations at a module level. ## Test Plan - Added new inline tests for the syntax error - Updated existing tests for `nonlocal` statement parsing to be inside a function scope Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
538393d1f3
commit
cf59cee928
@@ -538,7 +538,7 @@ impl SemanticSyntaxContext for SemanticSyntaxCheckerVisitor<'_> {
|
||||
}
|
||||
|
||||
fn in_module_scope(&self) -> bool {
|
||||
true
|
||||
self.scopes.len() == 1
|
||||
}
|
||||
|
||||
fn in_function_scope(&self) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user