-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Labels
tyMulti-file analysis & type inferenceMulti-file analysis & type inference
Milestone
Description
It is fairly common (often in test code, but also in regular code) to use assertions to encode invariants that are hard/impossible to detect statically. So we should be able to perform type narrowing via assert statements:
def f(x: str | None):
assert x is not None
reveal_type(x) # Should be 'str'(https://playknot.ruff.rs/d44edb95-1204-484c-b6c8-2a11ba6cef51)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
tyMulti-file analysis & type inferenceMulti-file analysis & type inference