-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
bugmypy got something wrongmypy got something wrong
Description
[case testMultipleHasAttr]
# flags: --warn-unreachable
from __future__ import annotations
from typing import Any
def len(obj: object) -> Any: ...
def f(x: type | str):
if (
hasattr(x, "__origin__")
and x.__origin__ is list
and hasattr(x, "__args__")
and len(x.__args__) == 1
):
reveal_type(x.__args__[0]) # N: Revealed type is "Any"
[builtins fixtures/module.pyi]
Regression introduced in #20492 that I don't yet have fixed in my commit stack. Probably just need to manage the conditional type maps a little more carefully
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong