Fixed bug that results in confusion between two classes defined in th…#10584
Merged
Fixed bug that results in confusion between two classes defined in th…#10584
Conversation
…e same file with the same name but in different functions when they are used in protocol matching. This addresses #10418.
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: sympy (https://github.com/sympy/sympy)
- .../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 | NaN | Rational | Unknown | Zero | Expr"
- Type "ComplexInfinity | NaN | Rational | Unknown | Zero | Expr" is not assignable to type "None"
- "Expr" 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 | NaN | Unknown | Integer | ComplexInfinity | Rational"
- Type "Expr | NaN | Unknown | Integer | ComplexInfinity | Rational" is not assignable to type "None"
- "Expr" is not assignable to "None" (reportIncompatibleMethodOverride)
- .../projects/sympy/sympy/stats/drv.py:268:22 - error: Argument of type "Generator[tuple[Unknown, ...] | Unknown | Sum* | Expr | Any | Zero | NaN | Piecewise | Basic | Sum | int | None, None, None]" cannot be assigned to parameter "iterable" of type "Iterable[_SupportsSumNoDefaultT@sum]" in function "sum"
+ .../projects/sympy/sympy/stats/drv.py:268:22 - error: Argument of type "Generator[tuple[Unknown, ...] | Unknown | Sum | Expr | Zero | NaN | Piecewise | Basic | int | None, None, None]" cannot be assigned to parameter "iterable" of type "Iterable[_SupportsSumNoDefaultT@sum]" in function "sum"
- "Generator[tuple[Unknown, ...] | Unknown | Sum* | Expr | Any | Zero | NaN | Piecewise | Basic | Sum | int | None, None, None]" is not assignable to "Iterable[_SupportsSumNoDefaultT@sum]"
+ "Generator[tuple[Unknown, ...] | Unknown | Sum | Expr | Zero | NaN | Piecewise | Basic | int | None, None, None]" is not assignable to "Iterable[_SupportsSumNoDefaultT@sum]"
- Type parameter "_T_co@Iterable" is covariant, but "tuple[Unknown, ...] | Unknown | Sum* | Expr | Any | Zero | NaN | Piecewise | Basic | Sum | int | None" is not a subtype of "_SupportsSumNoDefaultT@sum"
+ Type parameter "_T_co@Iterable" is covariant, but "tuple[Unknown, ...] | Unknown | Sum | Expr | Zero | NaN | Piecewise | Basic | int | None" is not a subtype of "_SupportsSumNoDefaultT@sum"
- Type "tuple[Unknown, ...] | Unknown | Sum* | Expr | Any | Zero | NaN | Piecewise | Basic | Sum | int | None" is not assignable to type "_SupportsSumWithNoDefaultGiven"
+ Type "tuple[Unknown, ...] | Unknown | Sum | Expr | Zero | NaN | Piecewise | Basic | int | None" is not assignable to type "_SupportsSumWithNoDefaultGiven"
- Type "tuple[Unknown, ...] | Unknown | Sum* | Expr | Any | Zero | NaN | Piecewise | Basic | Sum | int | None" is not assignable to type "_SupportsSumWithNoDefaultGiven"
+ Type "tuple[Unknown, ...] | Unknown | Sum | Expr | Zero | NaN | Piecewise | Basic | int | None" is not assignable to type "_SupportsSumWithNoDefaultGiven"
- .../projects/sympy/sympy/stats/joint_rv_types.py:575:27 - error: Argument of type "Integer | NaN | ComplexInfinity | Rational | Zero | Infinity | NegativeInfinity | Float | Number | Expr" cannot be assigned to parameter "stop" of type "SupportsIndex" in function "__new__"
+ .../projects/sympy/sympy/stats/joint_rv_types.py:575: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 "Integer | NaN | ComplexInfinity | Rational | Zero | Infinity | NegativeInfinity | Float | Number | Expr" is not assignable to type "SupportsIndex"
+ Type "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr" is not assignable to type "SupportsIndex"
- .../projects/sympy/sympy/stats/rv.py:473:25 - error: Argument of type "Expr | Lambda | Zero | One | Integral | Unknown | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Probability | tuple[Unknown, ...] | Sum* | Piecewise | Basic | Sum | Any | int" cannot be assigned to parameter "args" of type "Expr | complex" in function "__new__"
- Type "Expr | Lambda | Zero | One | Integral | Unknown | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Probability | tuple[Unknown, ...] | Sum* | Piecewise | Basic | Sum | Any | int" is not assignable to type "Expr | complex"
+ .../projects/sympy/sympy/stats/rv.py:473:25 - error: Argument of type "Expr | Lambda | Zero | One | Integral | Unknown | Probability | tuple[Unknown, ...] | Sum | NaN | Piecewise | Basic | NegativeOne | Integer | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | int" cannot be assigned to parameter "args" of type "Expr | complex" in function "__new__"
+ Type "Expr | Lambda | Zero | One | Integral | Unknown | Probability | tuple[Unknown, ...] | Sum | NaN | Piecewise | Basic | NegativeOne | Integer | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | int" is not assignable to type "Expr | complex"
- .../projects/sympy/sympy/stats/stochastic_process_types.py:1839:25 - error: Argument of type "tuple[Unknown, ...] | Unknown | Sum | Expr | Any | Zero | NaN | Piecewise | Basic | Integral | int | None" cannot be assigned to parameter "args" of type "Expr | complex" in function "__new__"
+ .../projects/sympy/sympy/stats/stochastic_process_types.py:1839:25 - error: Argument of type "tuple[Unknown, ...] | Unknown | Sum | Expr | Zero | NaN | Piecewise | Basic | Integral | Any | int | None" cannot be assigned to parameter "args" of type "Expr | complex" in function "__new__"
- Type "tuple[Unknown, ...] | Unknown | Sum | Expr | Any | Zero | NaN | Piecewise | Basic | Integral | int | None" is not assignable to type "Expr | complex"
+ Type "tuple[Unknown, ...] | Unknown | Sum | Expr | Zero | NaN | Piecewise | Basic | Integral | Any | int | None" is not assignable to type "Expr | complex"
- Return type mismatch: base method returns type "Self@Basic", override returns type "Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Any | Zero | NaN | Piecewise | Integral | Self@Expectation | Literal[0] | None"
+ Return type mismatch: base method returns type "Self@Basic", override returns type "Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Integral | Any | Self@Expectation | Literal[0] | None"
- Type "Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Any | Zero | NaN | Piecewise | Integral | Expectation* | Literal[0] | None" is not assignable to type "Basic"
+ Type "Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Integral | Any | Expectation* | Literal[0] | None" is not assignable to type "Basic"
- .../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 | Sum | ComplexInfinity | Float | Infinity | Integer | Lambda | Mul | NegativeInfinity | Number | Rational | Integral | Literal[0] | None"
- Type "Unknown | Any | BernoulliDistribution | Probability | Zero | One | tuple[Unknown, ...] | Sum* | Expr | NaN | Piecewise | Basic | Sum | ComplexInfinity | Float | Infinity | Integer | Lambda | Mul | NegativeInfinity | Number | Rational | Integral | Literal[0] | None" is not assignable to type "Basic"
- "Literal[0]" is not assignable to "Basic" (reportIncompatibleMethodOverride)
- Return type mismatch: base method returns type "Basic", override returns type "Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Any | Zero | NaN | Piecewise | Integral | Literal[0] | None"
+ Return type mismatch: base method returns type "Basic", override returns type "Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Integral | Any | Literal[0] | None"
- Type "Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Any | Zero | NaN | Piecewise | Integral | Literal[0] | None" is not assignable to type "Basic"
+ Type "Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Integral | Any | Literal[0] | None" is not assignable to type "Basic"
- .../projects/sympy/sympy/stats/tests/test_continuous_rv.py:366:12 - error: Operator "-" not supported for types "RandomSymbol | Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Any | Zero | NaN | Piecewise | Integral | ExpectationMatrix | Literal[0] | None" and "RandomSymbol | Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Any | Zero | NaN | Piecewise | Integral | ExpectationMatrix | Literal[0] | None"
+ .../projects/sympy/sympy/stats/tests/test_continuous_rv.py:366:12 - error: Operator "-" not supported for types "RandomSymbol | Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Integral | Any | ExpectationMatrix | Literal[0] | None" and "RandomSymbol | Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Zero | NaN | Piecewise | Integral | Any | ExpectationMatrix | Literal[0] | None"
- .../projects/sympy/sympy/stats/tests/test_continuous_rv.py:414:21 - error: Argument of type "RandomSymbol | Basic | Expectation | Expr | tuple[Unknown, ...] | Unknown | Sum | Any | Zero | NaN | Piecewise | Integral | ExpectationMatrix | Literal[0] | None" cannot be assigned to parameter "expr" of type "Basic" in function "simplify"
... (truncated 1759 lines) ...
pip (https://github.com/pypa/pip)
+ .../projects/pip/src/pip/_vendor/typing_extensions.py:2386:16 - error: Type "_TypeFormForm" is not assignable to declared type "_TypeFormForm"
+ "pip._vendor.typing_extensions._TypeFormForm" is not assignable to "pip._vendor.typing_extensions._TypeFormForm" (reportAssignmentType)
- 1626 errors, 24 warnings, 0 informations
+ 1627 errors, 24 warnings, 0 informations
streamlit (https://github.com/streamlit/streamlit)
+ .../projects/streamlit/lib/tests/streamlit/elements/lib/options_selector_utils_test.py:366:16 - error: No overloads for "maybe_coerce_enum_sequence" match the provided arguments (reportCallIssue)
+ .../projects/streamlit/lib/tests/streamlit/elements/lib/options_selector_utils_test.py:366:56 - error: Argument of type "type[EnumA]" cannot be assigned to parameter "options" of type "OptionSequence[T@maybe_coerce_enum_sequence]" in function "maybe_coerce_enum_sequence"
+ Type "type[EnumA]" is not assignable to type "OptionSequence[EnumA]"
+ Type "type[EnumA]" is not assignable to type "EnumA"
+ "__iter__" is an incompatible type
+ Type "() -> Iterator[EnumA]" is not assignable to type "() -> Iterator[_T_co@Iterable]"
+ Function return type "Iterator[EnumA]" is incompatible with type "Iterator[_T_co@Iterable]"
+ "Iterator[EnumA]" is not assignable to "Iterator[_T_co@Iterable]"
+ "iloc" is not present
+ "to_pandas" is not present
+ ... (reportArgumentType)
+ .../projects/streamlit/lib/tests/streamlit/elements/lib/options_selector_utils_test.py:368:13 - error: No overloads for "maybe_coerce_enum_sequence" match the provided arguments (reportCallIssue)
+ .../projects/streamlit/lib/tests/streamlit/elements/lib/options_selector_utils_test.py:368:40 - error: Argument of type "RegisterWidgetResult[list[EnumA]]" cannot be assigned to parameter "register_widget_result" of type "RegisterWidgetResult[tuple[T@maybe_coerce_enum_sequence, T@maybe_coerce_enum_sequence]]" in function "maybe_coerce_enum_sequence"
+ "RegisterWidgetResult[list[EnumA]]" is not assignable to "RegisterWidgetResult[tuple[EnumA, EnumA]]"
+ Type parameter "T_co@RegisterWidgetResult" is covariant, but "list[EnumA]" is not a subtype of "tuple[EnumA, EnumA]"
+ "list[EnumA]" is not assignable to "tuple[EnumA, EnumA]" (reportArgumentType)
+ .../projects/streamlit/lib/tests/streamlit/elements/lib/options_selector_utils_test.py:372:13 - error: No overloads for "maybe_coerce_enum_sequence" match the provided arguments (reportCallIssue)
+ .../projects/streamlit/lib/tests/streamlit/elements/lib/options_selector_utils_test.py:372:40 - error: Argument of type "RegisterWidgetResult[list[EnumA]]" cannot be assigned to parameter "register_widget_result" of type "RegisterWidgetResult[tuple[T@maybe_coerce_enum_sequence, T@maybe_coerce_enum_sequence]]" in function "maybe_coerce_enum_sequence"
+ "RegisterWidgetResult[list[EnumA]]" is not assignable to "RegisterWidgetResult[tuple[EnumA, EnumA]]"
+ Type parameter "T_co@RegisterWidgetResult" is covariant, but "list[EnumA]" is not a subtype of "tuple[EnumA, EnumA]"
+ "list[EnumA]" is not assignable to "tuple[EnumA, EnumA]" (reportArgumentType)
+ .../projects/streamlit/lib/tests/streamlit/elements/lib/options_selector_utils_test.py:381:13 - error: No overloads for "maybe_coerce_enum_sequence" match the provided arguments (reportCallIssue)
+ .../projects/streamlit/lib/tests/streamlit/elements/lib/options_selector_utils_test.py:382:17 - error: Argument of type "RegisterWidgetResult[list[EnumA]]" cannot be assigned to parameter "register_widget_result" of type "RegisterWidgetResult[tuple[T@maybe_coerce_enum_sequence, T@maybe_coerce_enum_sequence]]" in function "maybe_coerce_enum_sequence"
+ "RegisterWidgetResult[list[EnumA]]" is not assignable to "RegisterWidgetResult[tuple[lib.tests.streamlit.elements.lib.options_selector_utils_test.TestEnumCoercion.EnumA, lib.tests.streamlit.elements.lib.options_selector_utils_test.TestEnumCoercion.EnumA]]"
+ Type parameter "T_co@RegisterWidgetResult" is covariant, but "list[EnumA]" is not a subtype of "tuple[lib.tests.streamlit.elements.lib.options_selector_utils_test.TestEnumCoercion.EnumA, lib.tests.streamlit.elements.lib.options_selector_utils_test.TestEnumCoercion.EnumA]"
+ "list[EnumA]" is not assignable to "tuple[lib.tests.streamlit.elements.lib.options_selector_utils_test.TestEnumCoercion.EnumA, lib.tests.streamlit.elements.lib.options_selector_utils_test.TestEnumCoercion.EnumA]" (reportArgumentType)
- 3240 errors, 48 warnings, 0 informations
+ 3248 errors, 48 warnings, 0 informations
dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ .../projects/dd-trace-py/ddtrace/contrib/internal/tornado/stack_context.py:77:50 - error: Second argument to "super" call must be object or class that derives from "type[TracerStackContext]" (reportArgumentType)
+ .../projects/dd-trace-py/ddtrace/contrib/internal/tornado/stack_context.py:104:50 - error: Second argument to "super" call must be object or class that derives from "type[TracerStackContext]" (reportArgumentType)
+ .../projects/dd-trace-py/ddtrace/contrib/internal/tornado/stack_context.py:119:43 - error: Second argument to "super" call must be object or class that derives from "type[TracerStackContext]" (reportArgumentType)
- 13226 errors, 638 warnings, 0 informations
+ 13229 errors, 638 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.
…e same file with the same name but in different functions when they are used in protocol matching. This addresses #10418.