-
Notifications
You must be signed in to change notification settings - Fork 300
match-case: false positive [unbound-name] #2932
Copy link
Copy link
Labels
needs-triagescoping-control-flowissues related to scoping and control flowissues related to scoping and control flowtypecheckingv1-consider-addingTop-ranked but not in V1 milestone (consider adding)Top-ranked but not in V1 milestone (consider adding)
Description
Describe the Bug
from typing import assert_type
def test(x: int | None, y: int | None) -> None:
match x, y:
case None, None:
raise ValueError
case int(m), None:
u = m * 3
v = m
case None, int(n):
u = n
v = n // 3
case _, _:
raise ValueError
assert_type(u, int)
assert_type(v, int)ERROR sandbox.py:16:17-18: `u` may be uninitialized [unbound-name]
ERROR sandbox.py:17:17-18: `v` may be uninitialized [unbound-name]
Sandbox Link
(Only applicable for extension issues) IDE Information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
needs-triagescoping-control-flowissues related to scoping and control flowissues related to scoping and control flowtypecheckingv1-consider-addingTop-ranked but not in V1 milestone (consider adding)Top-ranked but not in V1 milestone (consider adding)