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 #13980

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft

[red-knot] Remove Type::Unbound #13980

wants to merge 17 commits into from

Conversation

sharkdp
Copy link
Contributor

@sharkdp sharkdp commented Oct 29, 2024

Early draft, no need to review

Summary

Remove Type::Unbound.

closes #13671

TODO

  • Get rid of todo_unwrap_type()
  • Do we need the concept of declaredness in addition to boundness? not necessarily for the first version of this
  • Design a better API for SymbolLookupResult (see ideas in ticket)
  • Expand CallOutcome to handle unboundness, such that we can use ty.class_member(…).call(…), with a new SymbolLookupResult::call method? Or maybe ty.class_member(…).call_result_ty(…)?
  • Clean up everything
  • Update function/module documentation, search for remnants of Unbound
  • Look into diagnostics that have changed.

Test Plan

TODO

@MichaReiser MichaReiser added the red-knot Multi-file analysis & type inference label Oct 29, 2024
@sharkdp sharkdp changed the title Remove Type::Unbound [red-knot] Remove Type::Unbound Oct 29, 2024
@@ -120,7 +120,7 @@ if returns_bool():
__name__ = 1

reveal_type(__file__) # revealed: Literal[42]
reveal_type(__name__) # revealed: str | Literal[1]
reveal_type(__name__) # revealed: Literal[1] | str
Copy link
Contributor Author

@sharkdp sharkdp Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To do: restore original order?

Comment on lines 71 to 72
# error: [non-subscriptable] "Cannot subscript object of type `Literal[Spam, Spam]` with no `__class_getitem__` method"
# revealed: Unknown
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To do

Comment on lines 988 to 999
let any_unbound = union
.elements(db)
.iter()
.any(|ty| ty.member(db, name).is_unbound());
if any_unbound {
SymbolLookupResult::Unbound // TODO
} else {
SymbolLookupResult::Bound(
union.map(db, |ty| ty.member(db, name).expect_bound()),
Boundedness::DefinitelyBound,
)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To do

Copy link
Contributor

github-actions bot commented Oct 30, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

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] remove Type::Unbound
2 participants