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
There seems to be some strange interaction between hinted return types, lambdas and the callable type guard.
To Reproduce
Here is a minimal example, together with some related examples that are not broken, showing that the return type, lambda and callable are all required for this to break:
Bug Report
There seems to be some strange interaction between hinted return types, lambdas and the
callable
type guard.To Reproduce
Here is a minimal example, together with some related examples that are not broken, showing that the return type, lambda and callable are all required for this to break:
(Playground: https://mypy-play.net/?mypy=latest&python=3.11&gist=26f7a80bf3eff44ebf560ce5db694107)
Expected Behavior
Mypy should remember that
x
is aCallable
within thelambda
in thereturn
statement.Actual Behavior
MyPy forgets the type guard, and thinks that
x
isint | Callable
in line 5:Your Environment
mypy.ini
(and other config files): -The text was updated successfully, but these errors were encountered: