-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty lists result in overly broad types #289
Labels
Comments
Hmm, thanks for the report. Seems like this must have regressed at some point, since I'm fairly sure it wasn't the case when I used MonkeyType more actively. Will investigate. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
All of the following is tested on MonkeyType 23.3.0.
Suppose I have the following function as foo.py:
And run the following code in test_foo.py:
Then apply this with:
This results in the following type:
Presumably the root cause of this is that an empty list does not have an obvious type associated with its element, so it is being typed as
List[Any]
, but this results in fairly non-ideal behaviour because it means that if a function that takes a list of a specific type is ever called with an empty list, it will instead get this over broad typeThe text was updated successfully, but these errors were encountered: