-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Better narrowing with custom equality #20643
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: A5rocks
| else_map = {} | ||
| partial_type_maps.append((if_map, else_map)) | ||
|
|
||
| for i in custom_eq_indices: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a later PR that condenses this a little bit / adds more comments
Maybe worth looking at the version on my dev branch: https://github.com/hauntsaninja/mypy/pull/5/files#diff-f96a2d6138bc6cdf2a07c4d37f6071cc25c1631afc107e277a28d5b59fc0ef04R6699
This comment has been minimized.
This comment has been minimized.
|
graphql one will be fixed by improving logic around this: Lines 8544 to 8546 in 21d6773
I have a commit for this later in my stack Still minimising the dd-trace-py one |
|
Okay dd-trace-py is a "true positive". It gets a little confusing in that |
This comment has been minimized.
This comment has been minimized.
|
Diff from mypy_primer, showing the effect of this PR on open source code: graphql-core (https://github.com/graphql-python/graphql-core)
+ tests/execution/test_resolve.py:322: error: Value of type "list[SourceLocation] | None" is not indexable [index]
dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/debugging/_function/discovery.py:219: error: Argument 2 to "undecorated" has incompatible type "str | Any | int | type[staticmethod[Any, Any]] | type[classmethod[Any, Any, Any]]"; expected "str" [arg-type]
|
Relates to this comment from A5rocks: #20492 (comment)
Fixes #20532
Fixes #18029
Fixes #17229
Fixes #16465
Closes #18574