-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[ty] fix global symbol lookup from eager scopes #21317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[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
|
https://github.com/astral-sh/ruff/actions/runs/19173434027/job/54811898939?pr=21317 |
|
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 <micha@reiser.io>
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.