Skip to content

Commit ca7ca34

Browse files
committed
group has_nonlocal_binding with global and add a comment
1 parent d233d8c commit ca7ca34

File tree

1 file changed

+6
-4
lines changed
  • crates/ty_python_semantic/src/semantic_index

1 file changed

+6
-4
lines changed

crates/ty_python_semantic/src/semantic_index/builder.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2697,6 +2697,12 @@ impl SemanticSyntaxContext for SemanticIndexBuilder<'_, '_> {
26972697
None
26982698
}
26992699

2700+
// We handle the one syntax error that relies on this method (`NonlocalWithoutBinding`) directly
2701+
// in `infer_nonlocal_statement`, so this just returns `true`.
2702+
fn has_nonlocal_binding(&self, _name: &str) -> bool {
2703+
true
2704+
}
2705+
27002706
fn in_async_context(&self) -> bool {
27012707
for scope_info in self.scope_stack.iter().rev() {
27022708
let scope = &self.scopes[scope_info.file_scope_id];
@@ -2776,10 +2782,6 @@ impl SemanticSyntaxContext for SemanticIndexBuilder<'_, '_> {
27762782
)
27772783
}
27782784

2779-
fn has_nonlocal_binding(&self, _name: &str) -> bool {
2780-
true
2781-
}
2782-
27832785
fn in_notebook(&self) -> bool {
27842786
self.source_text().is_notebook()
27852787
}

0 commit comments

Comments
 (0)