-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fixed bug in x is <Literal>
and x == <Literal>
type guard logic. …
#6110
Conversation
This file contains 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
…It was not properly handling the case where `x` is `Any` or `Unknown`. This addresses #6109.
Diff from mypy_primer, showing the effect of this PR on open source code: spack (https://github.com/spack/spack)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/test/spec_semantics.py:807:28 - error: Cannot access member "family" for type "Literal['x86_64']"
+ Member "family" is unknown (reportGeneralTypeIssues)
- 3873 errors, 48 warnings, 0 informations
+ 3874 errors, 48 warnings, 0 informations
Tanjun (https://github.com/FasterSpeeding/Tanjun)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:1472:19 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:1498:19 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:1617:19 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:1680:19 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:1885:19 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:1949:19 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:2104:19 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:2188:19 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:2337:19 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:2360:19 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:2496:19 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:2519:19 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:2655:19 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:2678:19 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:2748:16 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:2766:16 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:2809:19 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:2833:19 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:3027:19 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:3050:19 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:3186:19 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- /tmp/mypy_primer/projects/Tanjun/tests/commands/test_slash.py:3209:19 - warning: Argument type is unknown
- Argument corresponds to parameter "__key" in function "__getitem__" (reportUnknownArgumentType)
- 2344 errors, 9841 warnings, 0 informations
+ 2344 errors, 9819 warnings, 0 informations
dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/appsec/_iast/taint_sinks/ast_taint.py:33:46 - error: Operator "+" not supported for types "Literal['Random.']" and "Any | None"
+ Operator "+" not supported for types "Literal['Random.']" and "None" (reportGeneralTypeIssues)
- /tmp/mypy_primer/projects/dd-trace-py/ddtrace/contrib/botocore/patch.py:585:52 - error: Argument of type "Any | None" cannot be assigned to parameter "endpoint_name" of type "str" in function "_add_api_param_span_tags"
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/contrib/botocore/patch.py:585:52 - error: Argument of type "Any | Literal['sns', 'kinesis', 'events', 'sqs', 'lambda'] | None" cannot be assigned to parameter "endpoint_name" of type "str" in function "_add_api_param_span_tags"
- Type "Any | None" cannot be assigned to type "str"
+ Type "Any | Literal['sns', 'kinesis', 'events', 'sqs', 'lambda'] | None" cannot be assigned to type "str"
- /tmp/mypy_primer/projects/dd-trace-py/ddtrace/vendor/dogstatsd/base.py:469:76 - error: Argument of type "float | Unknown" cannot be assigned to parameter "sample_rate" of type "int" in function "_serialize_metric"
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/vendor/dogstatsd/base.py:469:76 - error: Argument of type "float | Unknown | Literal[1]" cannot be assigned to parameter "sample_rate" of type "int" in function "_serialize_metric"
- Type "float | Unknown" cannot be assigned to type "int"
+ Type "float | Unknown | Literal[1]" cannot be assigned to type "int"
- 9364 errors, 465 warnings, 0 informations
+ 9365 errors, 465 warnings, 0 informations
|
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.
…It was not properly handling the case where
x
isAny
orUnknown
. This addresses #6109.