-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
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
…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.
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
|
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.
…used to define the
extra_items
type for a generic TypedDict. This addresses #10545.