-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
bugmypy got something wrongmypy got something wrongdiagnosticstopic-error-reportingHow we report errorsHow we report errors
Description
from math import inf, nan
from typing import Literal
x: Literal[1.1]
y: Literal[inf]
z: Literal[nan]mypy 0.910 output:
a.py:4: error: Parameter 1 of Literal[...] cannot be of type "float"
a.py:5: error: Parameter 1 of Literal[...] is invalid
a.py:5: error: Variable "math.inf" is not valid as a type
a.py:5: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
a.py:6: error: Parameter 1 of Literal[...] is invalid
a.py:6: error: Variable "math.nan" is not valid as a type
a.py:6: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
The linked documentation is unrelated to the issue, as Literal does not expect types.
Expected output:
a.py:4: error: Parameter 1 of Literal[...] cannot be of type "float"
a.py:5: error: Parameter 1 of Literal[...] cannot be of type "float"
a.py:6: error: Parameter 1 of Literal[...] cannot be of type "float"
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongdiagnosticstopic-error-reportingHow we report errorsHow we report errors