From 7f3cd6352e167d12e8b61c91c60e90f0a61e969f Mon Sep 17 00:00:00 2001 From: Jack O'Connor Date: Wed, 9 Jul 2025 11:35:02 -0700 Subject: [PATCH] remove a reference to "`infer_place_load` only looks at bindings" That's true, but I think it's actually a bug in `infer_place_load`: https://github.com/astral-sh/ty/issues/793 --- crates/ty_python_semantic/src/types/infer.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/ty_python_semantic/src/types/infer.rs b/crates/ty_python_semantic/src/types/infer.rs index 5f389cb847..74b931a1f9 100644 --- a/crates/ty_python_semantic/src/types/infer.rs +++ b/crates/ty_python_semantic/src/types/infer.rs @@ -4707,11 +4707,10 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> { // looping and report that this `nonlocal` statement is invalid. break; } - // We found a definition. Note that (unlike in `infer_place_load`) this does *not* - // need to binding. We've checked that the name isn't `global` in this scope, but - // it's ok if it's `nonlocal`. If a "chain" of `nonlocal` statements fails to lead - // to a valid binding, the outermost one will be an error; we don't need to walk - // the whole chain for each one. + // We found a definition. We've checked that the name isn't `global` in this scope, + // but it's ok if it's `nonlocal`. If a "chain" of `nonlocal` statements fails to + // lead to a valid binding, the outermost one will be an error; we don't need to + // walk the whole chain for each one. continue 'names; } // There's no matching binding in an enclosing scope. This `nonlocal` statement is