-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fixed a bug that results in a false negative when the specialization … #10220
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
Merged
Conversation
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
…of a TypeVarTuple includes multiple unpacked tuples of unknown length. This addresses #10219.
Diff from mypy_primer, showing the effect of this PR on open source code: sympy (https://github.com/sympy/sympy)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:170:41 - error: Argument of type "Unknown | Zero | ZeroArray | ArrayContraction | Basic | PermuteDims | ArrayAdd | ArrayDiagonal" cannot be assigned to parameter "expr" of type "ArrayDiagonal" in function "_array_diag2contr_diagmatrix"
+ Type "Unknown | Zero | ZeroArray | ArrayContraction | Basic | PermuteDims | ArrayAdd | ArrayDiagonal" is not assignable to type "ArrayDiagonal"
+ "Basic" is not assignable to "ArrayDiagonal" (reportArgumentType)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:174:41 - error: Argument of type "Unknown | Zero | ZeroArray | ArrayContraction | Basic | PermuteDims | ArrayAdd | ArrayDiagonal" cannot be assigned to parameter "expr" of type "ArrayDiagonal" in function "_array_diag2contr_diagmatrix"
+ Type "Unknown | Zero | ZeroArray | ArrayContraction | Basic | PermuteDims | ArrayAdd | ArrayDiagonal" is not assignable to type "ArrayDiagonal"
+ "Basic" is not assignable to "ArrayDiagonal" (reportArgumentType)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:180:41 - error: Argument of type "Unknown | Zero | ZeroArray | ArrayContraction | Basic | PermuteDims | ArrayAdd | ArrayDiagonal" cannot be assigned to parameter "expr" of type "ArrayDiagonal" in function "_array_diag2contr_diagmatrix"
+ Type "Unknown | Zero | ZeroArray | ArrayContraction | Basic | PermuteDims | ArrayAdd | ArrayDiagonal" is not assignable to type "ArrayDiagonal"
+ "Basic" is not assignable to "ArrayDiagonal" (reportArgumentType)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:184:41 - error: Argument of type "Unknown | Zero | ZeroArray | ArrayContraction | Basic | PermuteDims | ArrayAdd | ArrayDiagonal" cannot be assigned to parameter "expr" of type "ArrayDiagonal" in function "_array_diag2contr_diagmatrix"
+ Type "Unknown | Zero | ZeroArray | ArrayContraction | Basic | PermuteDims | ArrayAdd | ArrayDiagonal" is not assignable to type "ArrayDiagonal"
+ "Basic" is not assignable to "ArrayDiagonal" (reportArgumentType)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:188:41 - error: Argument of type "Unknown | Zero | ZeroArray | ArrayContraction | Basic | PermuteDims | ArrayAdd | ArrayDiagonal" cannot be assigned to parameter "expr" of type "ArrayDiagonal" in function "_array_diag2contr_diagmatrix"
+ Type "Unknown | Zero | ZeroArray | ArrayContraction | Basic | PermuteDims | ArrayAdd | ArrayDiagonal" is not assignable to type "ArrayDiagonal"
+ "Basic" is not assignable to "ArrayDiagonal" (reportArgumentType)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:196:41 - error: Argument of type "Unknown | Zero | ZeroArray | ArrayContraction | Basic | PermuteDims | ArrayAdd | ArrayDiagonal" cannot be assigned to parameter "expr" of type "ArrayDiagonal" in function "_array_diag2contr_diagmatrix"
+ Type "Unknown | Zero | ZeroArray | ArrayContraction | Basic | PermuteDims | ArrayAdd | ArrayDiagonal" is not assignable to type "ArrayDiagonal"
+ "Basic" is not assignable to "ArrayDiagonal" (reportArgumentType)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:205:41 - error: Argument of type "Unknown | Zero | ZeroArray | ArrayContraction | Basic | PermuteDims | ArrayAdd | ArrayDiagonal" cannot be assigned to parameter "expr" of type "ArrayDiagonal" in function "_array_diag2contr_diagmatrix"
+ Type "Unknown | Zero | ZeroArray | ArrayContraction | Basic | PermuteDims | ArrayAdd | ArrayDiagonal" is not assignable to type "ArrayDiagonal"
+ "Basic" is not assignable to "ArrayDiagonal" (reportArgumentType)
- Attribute "split_multiple_contractions" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:213:15 - error: Cannot access attribute "split_multiple_contractions" for class "ArrayDiagonal"
- Attribute "split_multiple_contractions" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:213:15 - error: Cannot access attribute "split_multiple_contractions" for class "ArrayAdd"
- /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:217:15 - error: Cannot access attribute "split_multiple_contractions" for class "ArrayDiagonal"
- Attribute "split_multiple_contractions" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:217:15 - error: Cannot access attribute "split_multiple_contractions" for class "ArrayAdd"
- Attribute "split_multiple_contractions" is unknown (reportAttributeAccessIssue)
- Attribute "split_multiple_contractions" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:223:15 - error: Cannot access attribute "split_multiple_contractions" for class "ArrayDiagonal"
- Attribute "split_multiple_contractions" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:223:15 - error: Cannot access attribute "split_multiple_contractions" for class "ArrayAdd"
- /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:227:15 - error: Cannot access attribute "split_multiple_contractions" for class "ArrayDiagonal"
- Attribute "split_multiple_contractions" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:227:15 - error: Cannot access attribute "split_multiple_contractions" for class "ArrayAdd"
- Attribute "split_multiple_contractions" is unknown (reportAttributeAccessIssue)
- Attribute "split_multiple_contractions" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:231:15 - error: Cannot access attribute "split_multiple_contractions" for class "ArrayDiagonal"
- Attribute "split_multiple_contractions" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:231:15 - error: Cannot access attribute "split_multiple_contractions" for class "ArrayAdd"
- /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:235:15 - error: Cannot access attribute "split_multiple_contractions" for class "ArrayDiagonal"
- Attribute "split_multiple_contractions" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:235:15 - error: Cannot access attribute "split_multiple_contractions" for class "ArrayAdd"
- Attribute "split_multiple_contractions" is unknown (reportAttributeAccessIssue)
- Attribute "split_multiple_contractions" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:241:15 - error: Cannot access attribute "split_multiple_contractions" for class "ArrayDiagonal"
- Attribute "split_multiple_contractions" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:241:15 - error: Cannot access attribute "split_multiple_contractions" for class "ArrayAdd"
- /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:245:39 - error: Cannot access attribute "split_multiple_contractions" for class "ArrayDiagonal"
- Attribute "split_multiple_contractions" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:245:39 - error: Cannot access attribute "split_multiple_contractions" for class "ArrayAdd"
- Attribute "split_multiple_contractions" is unknown (reportAttributeAccessIssue)
- Attribute "split_multiple_contractions" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:249:15 - error: Cannot access attribute "split_multiple_contractions" for class "ArrayDiagonal"
- Attribute "split_multiple_contractions" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:249:15 - error: Cannot access attribute "split_multiple_contractions" for class "ArrayAdd"
- /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:255:15 - error: Cannot access attribute "split_multiple_contractions" for class "ArrayDiagonal"
- Attribute "split_multiple_contractions" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py:255:15 - error: Cannot access attribute "split_multiple_contractions" for class "ArrayAdd"
- Attribute "split_multiple_contractions" is unknown (reportAttributeAccessIssue)
... (truncated 268 lines) ...
|
erictraut
added a commit
that referenced
this pull request
Mar 31, 2025
* main: Fixed a bug that results in a false negative when a class that derives from `type[Any]` is assigned to any other type. This addresses #10185. (#10224) Removed support for `ru` and `ur` string prefixes. These were supported in Python 2.7 but are syntax errors in Python 3.x. This addresses #10222. (#10223) Fixed a bug that results in a false negative when the specialization of a TypeVarTuple includes multiple unpacked tuples of unknown length. This addresses #10219. (#10220) Extended `reportUnknownVariableType` check to include cases where a value whose type is a generic class parameterized by `Unknown` is assigned to a variable with a declared type. This addresses #10214. (#10217) Partly addressed inconsistency between override validation and protocol matching introduced in recent change. (#10215) Fix typo in docs (#10213)
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.
…of a TypeVarTuple includes multiple unpacked tuples of unknown length. This addresses #10219.