Skip to content
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 a bug that results in incorrect handling of a "bare" ClassVar a… #9724

Merged
merged 1 commit into from
Jan 18, 2025

Conversation

erictraut
Copy link
Collaborator

…nnotation either with or without an assignment. This addresses #9720.

…nnotation either with or without an assignment. This addresses #9720.
Copy link
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 "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"
+   /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: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"
-   /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"
+   /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 "Integer"
-     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 "Rational"
-     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)

... (truncated 51 lines) ...

@erictraut erictraut merged commit 951983a into main Jan 18, 2025
18 checks passed
@erictraut erictraut deleted the issue-9720 branch January 18, 2025 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant