Skip to content

Fixed bug that results in incorrect behavior when a type variable is … #10563

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
merged 1 commit into from
Jun 8, 2025

Conversation

erictraut
Copy link
Collaborator

…used to define the extra_items type for a generic TypedDict. This addresses #10545.

…used to define the `extra_items` type for a generic TypedDict. This addresses #10545.
erictraut added a commit that referenced this pull request Jun 8, 2025
…peVarTuple that has a non-TypeVarTuple after it in the type parameter list. This addresses #10563.
Copy link
Contributor

github-actions bot commented Jun 8, 2025

Diff from mypy_primer, showing the effect of this PR on open source code:

sympy (https://github.com/sympy/sympy)
+   ...:554:13 - error: Cannot access attribute "canon_bp" for class "Expr"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:554:13 - error: Cannot access attribute "canon_bp" for class "One"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:554:13 - error: Cannot access attribute "canon_bp" for class "Zero"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:554:13 - error: Cannot access attribute "canon_bp" for class "TensExpr"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:558:15 - error: Cannot access attribute "canon_bp" for class "Expr"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:558:15 - error: Cannot access attribute "canon_bp" for class "Zero"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:558:15 - error: Cannot access attribute "canon_bp" for class "One"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:558:15 - error: Cannot access attribute "canon_bp" for class "NegativeOne"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:558:15 - error: Cannot access attribute "canon_bp" for class "Integer"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:558:15 - error: Cannot access attribute "canon_bp" for class "NaN"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:558:15 - error: Cannot access attribute "canon_bp" for class "ComplexInfinity"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:558:15 - error: Cannot access attribute "canon_bp" for class "Rational"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:558:15 - error: Cannot access attribute "canon_bp" for class "Infinity"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:558:15 - error: Cannot access attribute "canon_bp" for class "NegativeInfinity"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:558:15 - error: Cannot access attribute "canon_bp" for class "Float"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:558:15 - error: Cannot access attribute "canon_bp" for class "Number"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:577:13 - error: Cannot access attribute "canon_bp" for class "Expr"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:577:13 - error: Cannot access attribute "canon_bp" for class "One"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:577:13 - error: Cannot access attribute "canon_bp" for class "NegativeOne"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:577:13 - error: Cannot access attribute "canon_bp" for class "Zero"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:577:13 - error: Cannot access attribute "canon_bp" for class "Integer"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:577:13 - error: Cannot access attribute "canon_bp" for class "NaN"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:577:13 - error: Cannot access attribute "canon_bp" for class "ComplexInfinity"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:577:13 - error: Cannot access attribute "canon_bp" for class "Rational"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:577:13 - error: Cannot access attribute "canon_bp" for class "Infinity"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:577:13 - error: Cannot access attribute "canon_bp" for class "NegativeInfinity"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:577:13 - error: Cannot access attribute "canon_bp" for class "Float"
+     Attribute "canon_bp" is unknown (reportAttributeAccessIssue)
+   ...:1602:36 - error: "__getitem__" method not defined on type "NegativeOne" (reportIndexIssue)
+   ...:1602:36 - error: "__getitem__" method not defined on type "One" (reportIndexIssue)
+   ...:1602:36 - error: "__getitem__" method not defined on type "TensExpr" (reportIndexIssue)
+   ...:1608:43 - error: "__getitem__" method not defined on type "NegativeOne" (reportIndexIssue)
+   ...:1608:43 - error: "__getitem__" method not defined on type "One" (reportIndexIssue)
+   ...:1608:43 - error: "__getitem__" method not defined on type "TensExpr" (reportIndexIssue)
+   ...:1694:44 - error: Cannot access attribute "data" for class "NegativeOne"
+     Attribute "data" is unknown (reportAttributeAccessIssue)
+   ...:1694:44 - error: Cannot access attribute "data" for class "One"
+     Attribute "data" is unknown (reportAttributeAccessIssue)
+   ...:1694:44 - error: Cannot access attribute "data" for class "TensExpr"
+     Attribute "data" is unknown (reportAttributeAccessIssue)
-   ...:1802:43 - error: Cannot access attribute "simplify" for class "tuple[Unknown | Basic | Add | Dict, bool]"
+   ...:1802:43 - error: Cannot access attribute "simplify" for class "tuple[Unknown | Basic | Add | Expr | Mul | Dict, bool]"
-   ...:1828:48 - error: Cannot access attribute "simplify" for class "tuple[Unknown | Basic | Add | Dict, bool]"
+   ...:1828:48 - error: Cannot access attribute "simplify" for class "tuple[Unknown | Basic | Add | Expr | Mul | Dict, bool]"
+   ...:253:7 - error: Base classes for class "DyadicAdd" define method "as_content_primitive" in incompatible way
+     Return type mismatch: base method returns type "tuple[One, Self@Expr]", override returns type "tuple[One | NegativeOne | Zero | Integer | Expr | Unknown | Rational | NaN | ComplexInfinity, Expr | Unknown | Self@Add]"
+       "tuple[One | NegativeOne | Zero | Integer | Expr | Unknown | Rational | NaN | ComplexInfinity, Expr | Unknown | Self@Add]" is not assignable to "tuple[One, Self@Expr]"
+         Tuple entry 1 is incorrect type
+           Type "One | NegativeOne | Zero | Integer | Expr | Unknown | Rational | NaN | ComplexInfinity" is not assignable to type "One"
+             "Expr" is not assignable to "One" (reportIncompatibleMethodOverride)
+   ...:496:7 - error: Base classes for class "VectorAdd" define method "as_content_primitive" in incompatible way
+     Return type mismatch: base method returns type "tuple[One, Self@Expr]", override returns type "tuple[One | NegativeOne | Zero | Integer | Expr | Unknown | Rational | NaN | ComplexInfinity, Expr | Unknown | Self@Add]"
+       "tuple[One | NegativeOne | Zero | Integer | Expr | Unknown | Rational | NaN | ComplexInfinity, Expr | Unknown | Self@Add]" is not assignable to "tuple[One, Self@Expr]"
+         Tuple entry 1 is incorrect type
+           Type "One | NegativeOne | Zero | Integer | Expr | Unknown | Rational | NaN | ComplexInfinity" is not assignable to type "One"
+             "Expr" is not assignable to "One" (reportIncompatibleMethodOverride)
- 33353 errors, 74 warnings, 0 informations 
+ 33391 errors, 74 warnings, 0 informations 

@erictraut erictraut merged commit 29ce473 into main Jun 8, 2025
17 checks passed
@erictraut erictraut deleted the issue-10545 branch June 8, 2025 21:39
erictraut added a commit that referenced this pull request Jun 8, 2025
…peVarTuple that has a non-TypeVarTuple after it in the type parameter list. This addresses #10563. (#10564)
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