Skip to content
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

[red-knot] fix lookup of nonlocal names in deferred annotations #13236

Merged
merged 2 commits into from
Sep 4, 2024

Conversation

carljm
Copy link
Contributor

@carljm carljm commented Sep 3, 2024

Initially I had deferred annotation name lookups reuse the "public symbol type", since that gives the correct "from end of scope" view of reaching definitions that we want. But there is a key difference; public symbol types are based only on definitions in the queried scope (or "name in the given namespace" in runtime terms), they don't ever look up a name in nonlocal/global/builtin scopes. Deferred annotation resolution should do this lookup.

Add a test, and fix deferred name resolution to support nonlocal/global/builtin names.

Fixes #13176

@carljm carljm added the red-knot Multi-file analysis & type inference label Sep 3, 2024
Copy link

codspeed-hq bot commented Sep 3, 2024

CodSpeed Performance Report

Merging #13236 will not alter performance

Comparing cjm/deferred-lookup (5260214) with main (e965f9c)

Summary

✅ 32 untouched benchmarks

Copy link
Contributor

github-actions bot commented Sep 3, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@carljm carljm force-pushed the cjm/deferred-lookup branch from 23b23ca to 5260214 Compare September 4, 2024 16:36
@carljm carljm merged commit 66fe226 into main Sep 4, 2024
20 checks passed
@carljm carljm deleted the cjm/deferred-lookup branch September 4, 2024 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
red-knot Multi-file analysis & type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[red-knot] fix deferred annotations referencing other scopes
3 participants