-
Notifications
You must be signed in to change notification settings - Fork 2k
[red-knot] fix deferred annotations referencing other scopes #13176
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workingtyMulti-file analysis & type inferenceMulti-file analysis & type inference
Description
Our current handling for resolving deferred annotations uses the inferred types of symbols as they exist at the end of the current scope (rather than the current point in control flow of the current scope), which is correct (or at least the most reasonable option) since their resolution is deferred.
But it currently does this by piggy-backing on the same logic we use for e.g. import resolution, where the name must exist in the scope's namespace, there's no fallback to other scopes. So we can't resolve a deferred annotation that's a builtin, or a global or nonlocal referred to from a nested scope. This should be fixed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingtyMulti-file analysis & type inferenceMulti-file analysis & type inference