You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is probably not a high-priority feature, but it would be great if we could detect attribute assignments in unreachable code sections, and eliminate them from the set of possible answers:
classC:
def__init__(self) ->None:
ifTrue:
self.x=1else:
self.x="a"returnself.y="unreachable"reveal_type(C().x) # should be `Unknown | Literal[1]` (i.e. not include `Literal["a"]`)# Should be an error:C().y
Note that we have one existing test for this here:
sharkdp
changed the title
Hide attributes assignments that occur in statically-known-to-be-false branches
[red-knot] Attributes assignments in statically-known branches
Feb 5, 2025
sharkdp
changed the title
[red-knot] Attributes assignments in statically-known branches
[red-knot] Detect unreachable attributes assignments
Feb 5, 2025
This is probably not a high-priority feature, but it would be great if we could detect attribute assignments in unreachable code sections, and eliminate them from the set of possible answers:
Note that we have one existing test for this here:
ruff/crates/red_knot_python_semantic/resources/mdtest/attributes.md
Lines 434 to 448 in 16f2a93
The text was updated successfully, but these errors were encountered: