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
{{ message }}
Repository navigation
[1.15 regression] (Temporary) false positive for reachability with unannotated partial type #18606
λ cat e.py
def merge_debugs(debugs: list[int | None]) -> None:
metadata = None
for debug in debugs:
if debug is not None:
if metadata is None:
metadata = {}
λ mypy e.py --warn-unreachable
e.py:6: error: Need type annotation for "metadata" (hint: "metadata: dict[<type>, <type>] = ...") [var-annotated]
e.py:6: error: Statement is unreachable [unreachable]
Found 2 errors in 1 file (checked 1 source file)
If you add an annotation to metadata (standalone or with the assignment) the unreachable warning goes away
changed the title [-]False positive for reachability with unannotated partial type[/-][+](Temporary) false positive for reachability with unannotated partial type[/+]on Feb 5, 2025
changed the title [-](Temporary) false positive for reachability with unannotated partial type[/-][+][1.15 regression] (Temporary) false positive for reachability with unannotated partial type[/+]on Feb 12, 2025
Activity
[-]False positive for reachability with unannotated partial type[/-][+](Temporary) false positive for reachability with unannotated partial type[/+]Garrett-R commentedon Feb 9, 2025
Another example:
(playground)
[-](Temporary) false positive for reachability with unannotated partial type[/-][+][1.15 regression] (Temporary) false positive for reachability with unannotated partial type[/+]Avoid false `unreachable` and `redundant-expr` warnings in loops more…
Avoid false `unreachable`, `redundant-expr`, and `redundant-casts` wa…