[ty] fix global symbol lookup from eager scopes#21317
Conversation
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
|
fb1bc92 to
9f904d1
Compare
|
|
|
I found another example of a too-many-cycle-iteration panic. if C:
class C[_T](C): ...The panic occurred because |
|
I don't have time right now (I originally found this bug while working on #20566), but I think the logic in |
crates/ty_python_semantic/resources/corpus/cyclic_symbol_in_comprehension.py
Show resolved
Hide resolved
|
The new diagnostic on the conformance suite looks incorrect. We are now throwing an error on the reference to |
|
This is looking great, thanks! Just as a heads-up: I am making some (minor: code organization and naming) changes to this PR and then I will merge it. |
Co-authored-by: Micha Reiser <[email protected]>
annotation scopes can see names defined in an immediately-enclosing class scope
e9d70dd to
ab62b0b
Compare
Summary
cf. #20962
In the following code,
fooin the comprehension was not reported as unresolved:In fact, this is a more serious bug than it looks: for
foo,explicit_global_symbolis called, causing a symbol that should actually beUndefinedto be reported as being of typeDivergent.This PR fixes this bug. As a result, the code in
mdtest/regression/pr_20962_comprehension_panics.mdno longer panics.Test Plan
corpus\cyclic_symbol_in_comprehension.pyis added.New tests are added in
mdtest/comprehensions/basic.md.