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
Under --strict-optional, something goes wrong in handling Callable types with return type None so that we don't allow them to be used even where the very same type is expected.
Short repro:
$ cat /tmp/foo.py
from typing import Callable
def f() -> None:
...
x = f # type: Callable[[], None]
$ mypy /tmp/foo.py --strict-optional
/tmp/foo.py:6: error: Incompatible types in assignment (expression has type Callable[[], None], variable has type Callable[[], None])
This is perfectly well-typed code, and we shouldn't be giving an error. Running mypy --strict-optional on mypy itself, there are 16 error messages that appear to be caused by this issue.
The error message itself also has the problem that it's complaining of incompatible types and then printing precisely the same type description twice. This may indicate a second independent bug; that'll become clearer with a diagnosis of this one.
The text was updated successfully, but these errors were encountered:
Under
--strict-optional
, something goes wrong in handlingCallable
types with return typeNone
so that we don't allow them to be used even where the very same type is expected.Short repro:
This is perfectly well-typed code, and we shouldn't be giving an error. Running
mypy --strict-optional
on mypy itself, there are 16 error messages that appear to be caused by this issue.The error message itself also has the problem that it's complaining of incompatible types and then printing precisely the same type description twice. This may indicate a second independent bug; that'll become clearer with a diagnosis of this one.
The text was updated successfully, but these errors were encountered: