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
This commit is contained in:
Jack O'Connor 2025-07-09 11:35:02 -07:00
parent 71cd7bb170
commit 7f3cd6352e
1 changed files with 4 additions and 5 deletions

View File

@ -4707,11 +4707,10 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
// looping and report that this `nonlocal` statement is invalid. // looping and report that this `nonlocal` statement is invalid.
break; break;
} }
// We found a definition. Note that (unlike in `infer_place_load`) this does *not* // We found a definition. We've checked that the name isn't `global` in this scope,
// need to binding. We've checked that the name isn't `global` in this scope, but // but it's ok if it's `nonlocal`. If a "chain" of `nonlocal` statements fails to
// it's ok if it's `nonlocal`. If a "chain" of `nonlocal` statements fails to lead // lead to a valid binding, the outermost one will be an error; we don't need to
// to a valid binding, the outermost one will be an error; we don't need to walk // walk the whole chain for each one.
// the whole chain for each one.
continue 'names; continue 'names;
} }
// There's no matching binding in an enclosing scope. This `nonlocal` statement is // There's no matching binding in an enclosing scope. This `nonlocal` statement is