Fixed bug that results in a false positive when accessing a generic a…#10305
Merged
Fixed bug that results in a false positive when accessing a generic a…#10305
Conversation
…ttribute from an object whose type is `type[X]`. This addresses #10304.
Contributor
|
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/tests/test_indexed.py:358:36 - error: Cannot access attribute "diff" for class "Relational"
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:358:36 - error: Cannot access attribute "diff" for class "Unequality"
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:360:36 - error: Cannot access attribute "diff" for class "Relational"
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:360:36 - error: Cannot access attribute "diff" for class "Unequality"
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:363:36 - error: Cannot access attribute "diff" for class "Relational"
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:363:36 - error: Cannot access attribute "diff" for class "Unequality"
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:370:36 - error: Cannot access attribute "diff" for class "Relational"
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:370:36 - error: Cannot access attribute "diff" for class "Unequality"
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:372:36 - error: Cannot access attribute "diff" for class "Relational"
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:372:36 - error: Cannot access attribute "diff" for class "Unequality"
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:374:36 - error: Cannot access attribute "diff" for class "Relational"
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:374:36 - error: Cannot access attribute "diff" for class "Unequality"
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:376:36 - error: Cannot access attribute "diff" for class "Relational"
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:376:36 - error: Cannot access attribute "diff" for class "Unequality"
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:389:36 - error: Cannot access attribute "diff" for class "Relational"
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:389:36 - error: Cannot access attribute "diff" for class "Unequality"
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:390:36 - error: Cannot access attribute "diff" for class "Relational"
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:390:36 - error: Cannot access attribute "diff" for class "Unequality"
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:394:38 - error: Cannot access attribute "diff" for class "Relational"
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:394:38 - error: Cannot access attribute "diff" for class "Unequality"
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:395:38 - error: Cannot access attribute "diff" for class "Relational"
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:395:38 - error: Cannot access attribute "diff" for class "Unequality"
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:396:38 - error: Cannot access attribute "diff" for class "Relational"
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:396:38 - error: Cannot access attribute "diff" for class "Unequality"
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:397:38 - error: Cannot access attribute "diff" for class "Relational"
+ Attribute "diff" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_indexed.py:397:38 - error: Cannot access attribute "diff" for class "Unequality"
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:554:13 - error: Cannot access attribute "canon_bp" for class "Expr"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:554:13 - error: Cannot access attribute "canon_bp" for class "One"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:554:13 - error: Cannot access attribute "canon_bp" for class "Zero"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:554:13 - error: Cannot access attribute "canon_bp" for class "TensExpr"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:558:15 - error: Cannot access attribute "canon_bp" for class "Expr"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:558:15 - error: Cannot access attribute "canon_bp" for class "Zero"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:558:15 - error: Cannot access attribute "canon_bp" for class "One"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:558:15 - error: Cannot access attribute "canon_bp" for class "NegativeOne"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:558:15 - error: Cannot access attribute "canon_bp" for class "Integer"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:558:15 - error: Cannot access attribute "canon_bp" for class "Rational"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:558:15 - error: Cannot access attribute "canon_bp" for class "NaN"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:558:15 - error: Cannot access attribute "canon_bp" for class "ComplexInfinity"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:558:15 - error: Cannot access attribute "canon_bp" for class "Half"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:558:15 - error: Cannot access attribute "canon_bp" for class "Infinity"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:558:15 - error: Cannot access attribute "canon_bp" for class "NegativeInfinity"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:558:15 - error: Cannot access attribute "canon_bp" for class "Float"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:558:15 - error: Cannot access attribute "canon_bp" for class "Number"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:577:13 - error: Cannot access attribute "canon_bp" for class "Expr"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:577:13 - error: Cannot access attribute "canon_bp" for class "One"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:577:13 - error: Cannot access attribute "canon_bp" for class "NegativeOne"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:577:13 - error: Cannot access attribute "canon_bp" for class "Zero"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+ /tmp/mypy_primer/projects/sympy/sympy/tensor/tests/test_tensor.py:577:13 - error: Cannot access attribute "canon_bp" for class "Integer"
+ Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
... (truncated 65 lines) ...
pytest (https://github.com/pytest-dev/pytest)
- /tmp/mypy_primer/projects/pytest/src/_pytest/capture.py:933:56 - error: Access to generic instance variable through class is ambiguous (reportGeneralTypeIssues)
- /tmp/mypy_primer/projects/pytest/src/_pytest/capture.py:934:56 - error: Access to generic instance variable through class is ambiguous (reportGeneralTypeIssues)
- /tmp/mypy_primer/projects/pytest/src/_pytest/capture.py:966:48 - error: Access to generic instance variable through class is ambiguous (reportGeneralTypeIssues)
- /tmp/mypy_primer/projects/pytest/src/_pytest/capture.py:967:48 - error: Access to generic instance variable through class is ambiguous (reportGeneralTypeIssues)
- 634 errors, 58 warnings, 0 informations
+ 630 errors, 58 warnings, 0 informations
hydpy (https://github.com/hydpy-dev/hydpy)
- /tmp/mypy_primer/projects/hydpy/hydpy/docs/prepare.py:126:40 - error: Access to generic instance variable through class is ambiguous (reportGeneralTypeIssues)
- 1324 errors, 49 warnings, 0 informations
+ 1323 errors, 49 warnings, 0 informations
pwndbg (https://github.com/pwndbg/pwndbg)
- /tmp/mypy_primer/projects/pwndbg/pwndbg/aglib/heap/structs.py:175:42 - error: Access to generic instance variable through class is ambiguous (reportGeneralTypeIssues)
- /tmp/mypy_primer/projects/pwndbg/pwndbg/aglib/heap/structs.py:206:46 - error: Access to generic instance variable through class is ambiguous (reportGeneralTypeIssues)
- 2906 errors, 148 warnings, 0 informations
+ 2904 errors, 148 warnings, 0 informations
|
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.
…ttribute from an object whose type is
type[X]. This addresses #10304.