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
types.NoneType is the same as type(None) at runtime, and mypy doesn't recognize this. However, we don't want multiple was of representing None in type annotations, so we should generate an error if types.NoneType is used in a type annotation.
Hints:
Fix this in mypy.typeanal
Currently types.NoneType is treated as an mypy.types.Instance type but None is mapped to mypy.types.NoneType
If we'd create an Instance with fullname equal to types.NoneType, generate an error
Example illustrating the problem:
from types import NoneType
def f(x: NoneType) -> None:
pass
f(None) # Incompatible type None, expected NoneType
The text was updated successfully, but these errors were encountered:
types.NoneType
is the same astype(None)
at runtime, and mypy doesn't recognize this. However, we don't want multiple was of representingNone
in type annotations, so we should generate an error iftypes.NoneType
is used in a type annotation.Hints:
mypy.typeanal
types.NoneType
is treated as anmypy.types.Instance
type butNone
is mapped tomypy.types.NoneType
Instance
withfullname
equal totypes.NoneType
, generate an errorExample illustrating the problem:
The text was updated successfully, but these errors were encountered: