Open
Description
Bug Report
Looks like mypy loses information about filter parameters only when put directly (inline) into any
function with list of objects.
- It works fine without
any
function for example using list:list(filter(...))
. - It works fine with list of primitive types like integers:
any(filter(lambda x: x == 1, [1, 2, 3]))
. - Works fine when filter object is saved on variable before applying
any
.
To Reproduce
https://mypy-play.net/?mypy=latest&python=3.11&gist=2a5a544f2e2ae02f57066ffe5adfa8b7
Expected Behavior
No errors
Actual Behavior
error: Argument 1 to "filter" has incompatible type "Callable[[Any], Any]"; expected "Callable[[Foo], TypeGuard[object]]" [arg-type]
error: "object" has no attribute "value" [attr-defined]
Found 2 errors in 1 file (checked 1 source file)
Your Environment
- Mypy version used: 1.5.1/1.6.0
- Mypy command-line flags: none
- Mypy configuration options from
mypy.ini
(and other config files): not allowed to share but nothing special, just some import ignores - Python version used: 3.11.0rc1
Metadata
Metadata
Assignees
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity