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
Type[Enum] does not properly infer from classmethod when passed to list #14110
main.py:12: error: Need type annotation for "colors" (hint: "colors: List[<type>] = ...") [var-annotated]
main.py:13: note: Revealed type is "builtins.list[Any]"
Found 1 error in 1 file (checked 1 source file)
Your Environment
Mypy version used: mypy 0.991 (compiled: yes)
Mypy command-line flags: None
Mypy configuration options from mypy.ini (and other config files): N/A (default settings)
changed the title [-]`Type[Enum]` does not properly infer when passed to `list`[/-][+]`Type[Enum]` does not properly infer from `classmethod` when passed to `list`[/+]on Nov 16, 2022
Activity
johnthagen commentedon Nov 16, 2022
When a
(str, Enum)type is used:The revealed type is
list[str]instead oflist[Color]:Even though at runtime, it is a
list[Color]:[-]`Type[Enum]` does not properly infer when passed to `list`[/-][+]`Type[Enum]` does not properly infer from `classmethod` when passed to `list`[/+]erictraut commentedon Aug 14, 2023
This bug appears to have been fixed in mypy 1.1.0. I'm not able to repro it in that version or any subsequent version.
hauntsaninja commentedon Aug 14, 2023
Fixed in #14554