Fixed bug that results in spurious errors when a wildcard import targ…#10903
Merged
Fixed bug that results in spurious errors when a wildcard import targ…#10903
Conversation
…ets a traditional `TypeVar` with the same name as a PEP 695 TypeVar. This addresses #10900.
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: sympy (https://github.com/sympy/sympy)
+ .../projects/sympy/sympy/solvers/diophantine/diophantine.py:173:44 - error: Cannot access attribute "expand" for class "Basic"
+ Attribute "expand" is unknown (reportAttributeAccessIssue)
- .../projects/sympy/sympy/solvers/diophantine/diophantine.py:528:23 - error: Operator "+" not supported for types "Generator[Unknown | int, Unknown, None] | list[Unknown | int]" and "list[Unknown | int]"
+ .../projects/sympy/sympy/solvers/diophantine/diophantine.py:528:23 - error: Operator "+" not supported for types "Generator[Unknown | Literal[1], Unknown, None] | list[Unknown | Literal[1]]" and "list[Unknown | int]"
- Operator "+" not supported for types "Generator[Unknown | int, Unknown, None]" and "list[Unknown | int]" (reportOperatorIssue)
+ Operator "+" not supported for types "Generator[Unknown | Literal[1], Unknown, None]" and "list[Unknown | int]" (reportOperatorIssue)
+ .../projects/sympy/sympy/solvers/ode/lie_group.py:618:61 - error: Operator "-" not supported for type "Unknown | Basic" (reportOperatorIssue)
- .../projects/sympy/sympy/solvers/ode/single.py:865:9 - error: Expression with type "tuple[ComplexInfinity | Unknown | Any, list[tuple[Unknown, Unknown]] | list[Unknown]] | tuple[ComplexInfinity | Unknown | Any, list[tuple[Unknown, Unknown]] | list[Unknown], list[tuple[Unknown, Unknown]] | list[Unknown]]" cannot be assigned to target tuple
- Type "tuple[ComplexInfinity | Unknown | Any, list[tuple[Unknown, Unknown]] | list[Unknown], list[tuple[Unknown, Unknown]] | list[Unknown]]" is incompatible with target tuple
- Tuple size mismatch; expected 2 but received 3 (reportAssignmentType)
+ .../projects/sympy/sympy/solvers/ode/single.py:2636:27 - error: Argument of type "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr" cannot be assigned to parameter "stop" of type "SupportsIndex" in function "__new__"
+ Type "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr" is not assignable to type "SupportsIndex"
+ "Expr" is incompatible with protocol "SupportsIndex"
+ "__index__" is not present (reportArgumentType)
- .../projects/sympy/sympy/solvers/ode/systems.py:1213:26 - error: Argument of type "dict[str, str | Unknown | Expr | bool | Symbol]" cannot be assigned to parameter "m" of type "Iterable[tuple[str, str]]" in function "update"
+ .../projects/sympy/sympy/solvers/ode/systems.py:1213:26 - error: Argument of type "dict[str, str | Unknown | Pow | bool | Symbol]" cannot be assigned to parameter "m" of type "Iterable[tuple[str, str]]" in function "update"
- .../projects/sympy/sympy/solvers/solveset.py:775:18 - error: Argument of type "Unknown | None" cannot be assigned to parameter "expr" of type "Expr" in function "together"
+ .../projects/sympy/sympy/solvers/solveset.py:775:18 - error: Argument of type "Unknown | Expr | Any | None" cannot be assigned to parameter "expr" of type "Expr" in function "together"
- Type "Unknown | None" is not assignable to type "Expr"
+ Type "Unknown | Expr | Any | None" is not assignable to type "Expr"
- .../projects/sympy/sympy/solvers/solveset.py:1324:21 - error: Argument of type "One | Expr | Relational | Basic | NegativeOne | Zero | Integer | ComplexInfinity | NaN | Rational | Unknown | Add" cannot be assigned to parameter "args" of type "Expr | complex" in function "__new__"
- Type "One | Expr | Relational | Basic | NegativeOne | Zero | Integer | ComplexInfinity | NaN | Rational | Unknown | Add" is not assignable to type "Expr | complex"
- Type "Basic" is not assignable to type "Expr | complex"
- "Basic" is not assignable to "Expr"
- "Basic" is not assignable to "complex" (reportArgumentType)
- .../projects/sympy/sympy/stats/crv_types.py:2542:9 - error: Method "_cdf" overrides class "SingleContinuousDistribution" in an incompatible manner
- Return type mismatch: base method returns type "None", override returns type "ComplexInfinity | Unknown"
- Type "ComplexInfinity | Unknown" is not assignable to type "None"
- "ComplexInfinity" is not assignable to "None" (reportIncompatibleMethodOverride)
- .../projects/sympy/sympy/stats/crv_types.py:2721:9 - error: Method "_cdf" overrides class "SingleContinuousDistribution" in an incompatible manner
- Return type mismatch: base method returns type "None", override returns type "Expr | Unknown"
- Type "Expr | Unknown" is not assignable to type "None"
- "Expr" is not assignable to "None" (reportIncompatibleMethodOverride)
- .../projects/sympy/sympy/stats/symbolic_probability.py:74:9 - error: Method "doit" overrides class "Basic" in an incompatible manner
- Return type mismatch: base method returns type "Basic", override returns type "Unknown | Any | BernoulliDistribution | Probability | Zero | One | tuple[Unknown, ...] | Sum | Expr | NaN | Piecewise | Basic | ComplexInfinity | Float | Infinity | Integer | Lambda | Mul | NegativeInfinity | NegativeOne | Number | Rational | Integral | Literal[0] | None"
- Type "Unknown | Any | BernoulliDistribution | Probability | Zero | One | tuple[Unknown, ...] | Sum | Expr | NaN | Piecewise | Basic | ComplexInfinity | Float | Infinity | Integer | Lambda | Mul | NegativeInfinity | NegativeOne | Number | Rational | Integral | Literal[0] | None" is not assignable to type "Basic"
- "Literal[0]" is not assignable to "Basic" (reportIncompatibleMethodOverride)
- .../projects/sympy/sympy/stats/tests/test_continuous_rv.py:1542:12 - error: No overloads for "simplify" match the provided arguments (reportCallIssue)
- .../projects/sympy/sympy/stats/tests/test_continuous_rv.py:1542:21 - error: Argument of type "Unknown | Any | BernoulliDistribution | Probability | Zero | One | tuple[Unknown, ...] | Sum | Expr | NaN | Piecewise | Basic | ComplexInfinity | Float | Infinity | Integer | Lambda | Mul | NegativeInfinity | NegativeOne | Number | Rational | Integral | Literal[0] | None" cannot be assigned to parameter "expr" of type "Basic" in function "simplify"
- Type "Unknown | Any | BernoulliDistribution | Probability | Zero | One | tuple[Unknown, ...] | Sum | Expr | NaN | Piecewise | Basic | ComplexInfinity | Float | Infinity | Integer | Lambda | Mul | NegativeInfinity | NegativeOne | Number | Rational | Integral | Literal[0] | None" is not assignable to type "Basic"
- "Literal[0]" is not assignable to "Basic" (reportArgumentType)
- .../projects/sympy/sympy/stats/tests/test_continuous_rv.py:1544:12 - error: No overloads for "simplify" match the provided arguments (reportCallIssue)
- .../projects/sympy/sympy/stats/tests/test_continuous_rv.py:1544:21 - error: Argument of type "Unknown | Any | BernoulliDistribution | Probability | Zero | One | tuple[Unknown, ...] | Sum | Expr | NaN | Piecewise | Basic | ComplexInfinity | Float | Infinity | Integer | Lambda | Mul | NegativeInfinity | NegativeOne | Number | Rational | Integral | Literal[0] | None" cannot be assigned to parameter "expr" of type "Basic" in function "simplify"
- Type "Unknown | Any | BernoulliDistribution | Probability | Zero | One | tuple[Unknown, ...] | Sum | Expr | NaN | Piecewise | Basic | ComplexInfinity | Float | Infinity | Integer | Lambda | Mul | NegativeInfinity | NegativeOne | Number | Rational | Integral | Literal[0] | None" is not assignable to type "Basic"
- "Literal[0]" is not assignable to "Basic" (reportArgumentType)
- .../projects/sympy/sympy/stats/tests/test_continuous_rv.py:1549:12 - error: No overloads for "simplify" match the provided arguments (reportCallIssue)
- .../projects/sympy/sympy/stats/tests/test_continuous_rv.py:1549:21 - error: Argument of type "Unknown | Any | BernoulliDistribution | Probability | Zero | One | tuple[Unknown, ...] | Sum | Expr | NaN | Piecewise | Basic | ComplexInfinity | Float | Infinity | Integer | Lambda | Mul | NegativeInfinity | NegativeOne | Number | Rational | Integral | Literal[0] | None" cannot be assigned to parameter "expr" of type "Basic" in function "simplify"
- Type "Unknown | Any | BernoulliDistribution | Probability | Zero | One | tuple[Unknown, ...] | Sum | Expr | NaN | Piecewise | Basic | ComplexInfinity | Float | Infinity | Integer | Lambda | Mul | NegativeInfinity | NegativeOne | Number | Rational | Integral | Literal[0] | None" is not assignable to type "Basic"
- "Literal[0]" is not assignable to "Basic" (reportArgumentType)
- .../projects/sympy/sympy/stats/tests/test_finite_rv.py:33:23 - error: Operator "/" not supported for types "Unknown | Any | BernoulliDistribution | Probability | Zero | One | tuple[Unknown, ...] | Sum | Expr | NaN | Piecewise | Basic | ComplexInfinity | Float | Infinity | Integer | Lambda | Mul | NegativeInfinity | NegativeOne | Number | Rational | Integral | Literal[0] | None" and "Unknown | Any | BernoulliDistribution | Probability | Zero | One | tuple[Unknown, ...] | Sum | Expr | NaN | Piecewise | Basic | ComplexInfinity | Float | Infinity | Integer | Lambda | Mul | NegativeInfinity | NegativeOne | Number | Rational | Integral | Literal[0] | None"
+ .../projects/sympy/sympy/stats/tests/test_finite_rv.py:33:23 - error: Operator "/" not supported for types "Unknown | Any | BernoulliDistribution | Probability | Zero | One | Expr | Float | ComplexInfinity | NaN | Rational | Infinity | NegativeInfinity | _NotImplementedType | tuple[Unknown, ...] | Sum | Piecewise | Basic | Integer | Lambda | Mul | NegativeOne | Number | Integral | Literal[0] | None" and "Unknown | Any | BernoulliDistribution | Probability | Zero | One | Expr | Float | ComplexInfinity | NaN | Rational | Infinity | NegativeInfinity | _NotImplementedType | tuple[Unknown, ...] | Sum | Piecewise | Basic | Integer | Lambda | Mul | NegativeOne | Number | Integral | Literal[0] | None"
... (truncated 1139 lines) ...
|
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.
…ets a traditional
TypeVarwith the same name as a PEP 695 TypeVar. This addresses #10900.