-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
help wantedContributions especially welcomeContributions especially welcometyMulti-file analysis & type inferenceMulti-file analysis & type inference
Description
The idea of this ticket is to support the following use case.
class C:
def __init__(self, x: int | None):
self.x = x
reveal_type(C().x) # Should be `int | None`, is currently `Unknown | int | None`We have pre-existing tests with TODO comments for this scenario. The goal of this issue it to get rid of these (there are more TODOs that would be resolved by this feature):
ruff/crates/red_knot_python_semantic/resources/mdtest/attributes.md
Lines 33 to 34 in 7ca778f
| # TODO: should be `int | None` | |
| reveal_type(c_instance.inferred_from_param) # revealed: Unknown | int | None |
Part of: #14164
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
help wantedContributions especially welcomeContributions especially welcometyMulti-file analysis & type inferenceMulti-file analysis & type inference