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
When you return a function call like return list(...), return dict(...), and the type doesn't match the return annotation, the error message says that list(...) is not valid code.
Removing the bug label, since the error message is consistent with how type inference is designed to work in mypy, but I agree that this can be confusing and a generating a more useful error message would be nice.
Bug Report
When you return a function call like
return list(...)
,return dict(...)
, and the type doesn't match the return annotation, the error message says thatlist(...)
is not valid code.To Reproduce
Expected Behavior
I was expecting mypy to tell me that the type annotation doesn't match the return type.
Instead it says that the arguments to
list()
are wrong, i.e.list
doesn't take this type.Like so:
Actual Behavior
I think this is misleading.
Your Environment
mypy.ini
(and other config files): N/AThe text was updated successfully, but these errors were encountered: