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] remove Type::Unbound #13671

Open
carljm opened this issue Oct 7, 2024 · 2 comments
Open

[red-knot] remove Type::Unbound #13671

carljm opened this issue Oct 7, 2024 · 2 comments
Assignees
Labels
red-knot Multi-file analysis & type inference

Comments

@carljm
Copy link
Contributor

carljm commented Oct 7, 2024

We should not represent "unbound" as a type, because it's only meaningful within a scope, it shouldn't "travel" across scopes as a type.

Instead, we should explicitly use the use-def map methods to check whether a name may be unbound in the places where it matters.

@carljm carljm added the red-knot Multi-file analysis & type inference label Oct 7, 2024
@MichaReiser
Copy link
Member

Depends on #13563

@MichaReiser
Copy link
Member

MichaReiser commented Oct 9, 2024

Some extra notes from my conversation with @carljm the other day regarding on how this should be implemented

In general, when we query the type of a symbol from another scope, and that symbol either doesn't exist or is definitely unbound, that should be a diagnostic and we should return Unknown.
if the symbol is conditionally bound, we should just return the type from the bound paths (and possibly a diagnostic in this case as well)
the "diagnostic" part may require some of these methods to gain a more complex Outcome-style return type
but it would also be possible to remove Unbound (and just return Unknown in those cases) without handling the diagnostic part at all yet

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

No branches or pull requests

2 participants