Repository navigation
Improve negative narrowing in contains checks - #22242
Merged
Merged
Conversation
This was an accident of history, I think we can just delegate to narrow_type_by_identity_equality entirely
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: discord.py (https://github.com/Rapptz/discord.py)
- discord/components.py:1750: error: Missing return statement [return]
pydantic (https://github.com/pydantic/pydantic)
- pydantic/v1/types.py:704: error: Unsupported operand types for >= ("Literal['n']" and "int") [operator]
- pydantic/v1/types.py:704: error: Unsupported operand types for >= ("Literal['N']" and "int") [operator]
- pydantic/v1/types.py:704: error: Unsupported operand types for >= ("Literal['F']" and "int") [operator]
- pydantic/v1/types.py:704: note: Left operand is of type "Literal['n', 'N', 'F'] | int"
- pydantic/v1/types.py:706: error: Unsupported operand types for + ("int" and "Literal['n']") [operator]
- pydantic/v1/types.py:706: error: Unsupported operand types for + ("int" and "Literal['N']") [operator]
- pydantic/v1/types.py:706: error: Unsupported operand types for + ("int" and "Literal['F']") [operator]
- pydantic/v1/types.py:706: note: Right operand is of type "Literal['n', 'N', 'F'] | int"
- pydantic/v1/types.py:714: error: Argument 1 to "abs" has incompatible type "Literal['n', 'N', 'F'] | int"; expected "SupportsAbs[int]" [arg-type]
- pydantic/v1/types.py:715: error: Argument 1 to "abs" has incompatible type "Literal['n', 'N', 'F'] | int"; expected "SupportsAbs[int]" [arg-type]
- pydantic/v1/types.py:718: error: Argument 1 to "abs" has incompatible type "Literal['n', 'N', 'F'] | int"; expected "SupportsAbs[int]" [arg-type]
pytest-autoprofile (https://gitlab.com/TTsangSC/pytest-autoprofile)
+ tests/test_subprocess.py:382: error: Redundant cast to "tuple[Literal[0, 1, 2], Literal[0, 1, 2]]" [redundant-cast]
sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/builders/_epub_base.py:34:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
- sphinx/testing/util.py:80:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
+ sphinx/transforms/post_transforms/code.py:9:1: note: (or run "mypy --install-types" to install all missing stub packages)
+ sphinx/transforms/post_transforms/code.py:9:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
- sphinx/cmd/build.py:460:1: note: Hint: "python3 -m pip install types-Pygments"
- sphinx/cmd/build.py:460:1: note: (or run "mypy --install-types" to install all missing stub packages)
- sphinx/application.py:48:1: note: Hint: "python3 -m pip install types-Pygments"
- sphinx/application.py:48:1: note: (or run "mypy --install-types" to install all missing stub packages)
- sphinx/application.py:48:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This was an accident of history, I think we can just delegate to narrow_type_by_identity_equality entirely