-
Notifications
You must be signed in to change notification settings - Fork 102
based overload consistency checks #1527
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
base: main
Are you sure you want to change the base?
Conversation
d8b3cbb to
25a5809
Compare
This comment has been minimized.
This comment has been minimized.
4e0df91 to
a9257dd
Compare
This comment has been minimized.
This comment has been minimized.
a9257dd to
bd8b2b3
Compare
|
Diff from mypy_primer, showing the effect of this PR on open source code: ibis (https://github.com/ibis-project/ibis)
+ Function return type "((func: Unknown) -> _Wrapped[..., Unknown, ..., Deferred | Unknown]) | _Wrapped[..., Unknown, ..., Deferred | Unknown]" is incompatible with type "(F@deferrable) -> F@deferrable" (reportInconsistentOverload)
- Function return type "(F@deferrable) -> F@deferrable" is incompatible with type "((func: Unknown) -> _Wrapped[..., Unknown, ..., Deferred | Unknown]) | _Wrapped[..., Unknown, ..., Deferred | Unknown]"
- Type "(F@deferrable) -> F@deferrable" is not assignable to type "((func: Unknown) -> _Wrapped[..., Unknown, ..., Deferred | Unknown]) | _Wrapped[..., Unknown, ..., Deferred | Unknown]"
- Type "(F@deferrable) -> F@deferrable" is not assignable to type "(func: Unknown) -> _Wrapped[..., Unknown, ..., Deferred | Unknown]"
- Missing keyword parameter "func"
- Position-only parameter mismatch; parameter "func" is not position-only
- Position-only parameter mismatch; expected 1 but received 0
- Function return type "F@deferrable" is incompatible with type "_Wrapped[..., Unknown, ..., Deferred | Unknown]"
- "FunctionType" is not assignable to "_Wrapped[..., Unknown, ..., Deferred | Unknown]" (reportInconsistentOverload)
+ .../projects/ibis/ibis/expr/api.py:818:5 - error: Implementation return type is too wide
+ Type "Any | Unknown | Scalar" is not assignable to type "TimestampValue"
+ "Scalar" is not assignable to "TimestampValue" (reportInconsistentOverload)
+ .../projects/ibis/ibis/expr/api.py:920:5 - error: Implementation return type is too wide
+ Type "Any | Unknown | Scalar" is not assignable to type "DateValue"
+ "Scalar" is not assignable to "DateValue" (reportInconsistentOverload)
+ .../projects/ibis/ibis/expr/api.py:993:5 - error: Implementation return type is too wide
+ Type "Any | Unknown | Scalar" is not assignable to type "TimeValue"
+ "Scalar" is not assignable to "TimeValue" (reportInconsistentOverload)
+ .../projects/ibis/ibis/expr/types/generic.py:190:9 - error: Implementation return type is too wide
+ Type "Value" is not assignable to type "StringValue | IntegerValue | FloatingValue | BooleanValue | DateValue | TimestampValue | TimeValue | UUIDValue"
+ "Value" is not assignable to "StringValue"
+ "Value" is not assignable to "IntegerValue"
+ "Value" is not assignable to "FloatingValue"
+ "Value" is not assignable to "BooleanValue"
+ "Value" is not assignable to "DateValue"
+ "Value" is not assignable to "TimestampValue"
+ "Value" is not assignable to "TimeValue"
+ ... (reportInconsistentOverload)
- 8387 errors, 109992 warnings, 0 notes
+ 8391 errors, 109992 warnings, 0 notes
pandas (https://github.com/pandas-dev/pandas)
+ .../projects/pandas/pandas/core/algorithms.py
+ .../projects/pandas/pandas/core/algorithms.py:328:5 - error: Implementation return type is too wide
+ Type "ArrayLike | Unknown | <subclass of ndarray[_AnyShape, dtype[Any]] and Index> | <subclass of ExtensionArray and Index> | tuple[ndarray[_AnyShape, dtype[Any]], ndarray[_AnyShape, dtype[Any]]]" is not assignable to type "T@unique | ndarray[_AnyShape, dtype[Any]]"
+ Type "<subclass of ExtensionArray and Index> | <subclass of ndarray[_AnyShape, dtype[Any]] and Index> | ExtensionArray | tuple[ndarray[_AnyShape, dtype[Any]], ndarray[_AnyShape, dtype[Any]]] | Unknown" is not assignable to type "Index | Categorical | ExtensionArray"
+ Type "<subclass of ExtensionArray and Index> | <subclass of ndarray[_AnyShape, dtype[Any]] and Index> | ExtensionArray | tuple[ndarray[_AnyShape, dtype[Any]], ndarray[_AnyShape, dtype[Any]]] | Unknown" is not assignable to type "Index | Categorical | ExtensionArray"
+ Type "tuple[ndarray[_AnyShape, dtype[Any]], ndarray[_AnyShape, dtype[Any]]]" is not assignable to type "Index | Categorical | ExtensionArray"
+ "tuple[ndarray[_AnyShape, dtype[Any]], ndarray[_AnyShape, dtype[Any]]]" is not assignable to "Index"
+ "tuple[ndarray[_AnyShape, dtype[Any]], ndarray[_AnyShape, dtype[Any]]]" is not assignable to "Categorical"
+ "tuple[ndarray[_AnyShape, dtype[Any]], ndarray[_AnyShape, dtype[Any]]]" is not assignable to "ExtensionArray"
+ Type "tuple[ndarray[_AnyShape, dtype[Any]], ndarray[_AnyShape, dtype[Any]]]" is not assignable to type "T@unique | ndarray[_AnyShape, dtype[Any]]"
+ ... (reportInconsistentOverload)
+ .../projects/pandas/pandas/core/arrays/sparse/array.py:1960:5 - error: Implementation return type is too wide
+ Type "SparseIndex" is not assignable to type "BlockIndex | IntIndex"
+ "SparseIndex" is not assignable to "BlockIndex"
+ "SparseIndex" is not assignable to "IntIndex" (reportInconsistentOverload)
+ .../projects/pandas/pandas/core/common.py
+ .../projects/pandas/pandas/core/common.py:431:5 - error: Implementation return type is too wide
+ Type "RandomState | Generator | Module("numpy.random")" is not assignable to type "Generator | RandomState"
+ Type "Module("numpy.random")" is not assignable to type "Generator | RandomState"
+ Type "Module("numpy.random")" is not assignable to type "Generator"
+ Type "Module("numpy.random")" is not assignable to type "RandomState" (reportInconsistentOverload)
+ .../projects/pandas/pandas/core/tools/datetimes.py
+ .../projects/pandas/pandas/core/tools/datetimes.py:671:5 - error: Implementation return type is too wide
+ Type "DatetimeScalar | DatetimeIndex | Series | NaTType" is not assignable to type "Timestamp | Series | DatetimeIndex"
+ Type "NaTType" is not assignable to type "Timestamp | Series | DatetimeIndex"
+ "NaTType" is not assignable to "Timestamp"
+ "NaTType" is not assignable to "Series"
+ "NaTType" is not assignable to "DatetimeIndex" (reportInconsistentOverload)
+ .../projects/pandas/pandas/core/tools/timedeltas.py
+ .../projects/pandas/pandas/core/tools/timedeltas.py:78:5 - error: Implementation return type is too wide
+ Type "Timedelta | TimedeltaIndex | Series | NaTType | Any" is not assignable to type "Timedelta | Series | TimedeltaIndex"
+ Type "NaTType" is not assignable to type "Timedelta | Series | TimedeltaIndex"
+ "NaTType" is not assignable to "Timedelta"
+ "NaTType" is not assignable to "Series"
+ "NaTType" is not assignable to "TimedeltaIndex" (reportInconsistentOverload)
- 190 errors, 3 warnings, 0 notes
+ 195 errors, 3 warnings, 0 notes
sympy (https://github.com/sympy/sympy)
- .../projects/sympy/sympy/core/numbers.py:1764:9 - error: Overloaded implementation is not consistent with signature of overload 1
- Function return type "tuple[Rational, Expr]" is incompatible with type "tuple[Self@Rational, One]"
- "tuple[Rational, Expr]" is not assignable to "tuple[Self@Rational, One]"
- Type "Rational" is not assignable to type "Self@Rational" (reportInconsistentOverload)
- .../projects/sympy/sympy/core/numbers.py:1764:9 - error: Overloaded implementation is not consistent with signature of overload 2
- Function return type "tuple[Number, Expr]" is incompatible with type "tuple[Self@Rational, One]"
- "tuple[Number, Expr]" is not assignable to "tuple[Self@Rational, One]"
- Type "Number" is not assignable to type "Self@Rational" (reportInconsistentOverload)
+ .../projects/sympy/sympy/core/operations.py:453:9 - error: Implementation return type is too wide
+ Type "tuple[Basic, ...]" is not assignable to type "tuple[Expr, ...] | tuple[Boolean, ...]"
+ "tuple[Basic, ...]" is not assignable to "tuple[Expr, ...]"
+ Tuple entry 1 is incorrect type
+ "Basic" is not assignable to "Expr"
+ "tuple[Basic, ...]" is not assignable to "tuple[Boolean, ...]"
+ Tuple entry 1 is incorrect type
+ "Basic" is not assignable to "Boolean" (reportInconsistentOverload)
+ .../projects/sympy/sympy/functions/elementary/complexes.py:888:13 - error: Implementation return type is too wide
+ Type "Basic" is not assignable to type "Quaternion | Expr"
+ "Basic" is not assignable to "Quaternion"
+ "Basic" is not assignable to "Expr" (reportInconsistentOverload)
+ .../projects/sympy/sympy/matrices/matrixbase.py:5694:5 - error: Implementation return type is too wide
+ Type "tuple[MatrixBase, MatrixBase | Expr, str]" is not assignable to type "tuple[Tmat@_unify_with_other, Tmat@_unify_with_other, Literal['is_matrix']] | tuple[Tmat@_unify_with_other, Expr, Literal['possible_scalar']]"
+ "tuple[MatrixBase, MatrixBase | Expr, str]" is not assignable to "tuple[Tmat@_unify_with_other, Tmat@_unify_with_other, Literal['is_matrix']]"
+ Tuple entry 2 is incorrect type
+ Type "MatrixBase | Expr" is not assignable to type "MatrixBase"
+ Type "MatrixBase | Expr" is not assignable to type "MatrixBase"
+ "tuple[MatrixBase, MatrixBase | Expr, str]" is not assignable to "tuple[Tmat@_unify_with_other, Expr, Literal['possible_scalar']]"
+ Tuple entry 2 is incorrect type
+ Type "MatrixBase | Expr" is not assignable to type "Expr"
+ ... (reportInconsistentOverload)
- Type of "cg" is "Zero | ZeroArray | Unknown | Basic | ArrayContraction | PermuteDims | ArrayTensorProduct" (reportUnknownVariableType)
+ Type of "cg" is "PermuteDims | Basic | Unknown | Zero | ZeroArray | ArrayTensorProduct | ArrayContraction" (reportUnknownVariableType)
- Type of "cg" is "Unknown | PermuteDims | Zero | ZeroArray | Basic | ArrayDiagonal" (reportUnknownVariableType)
+ Type of "cg" is "Unknown | PermuteDims | ArrayDiagonal | Zero | ZeroArray" (reportUnknownVariableType)
- Type of "cg" is "Zero | ZeroArray | Unknown | Basic | ArrayContraction | PermuteDims | ArrayTensorProduct" (reportUnknownVariableType)
+ Type of "cg" is "PermuteDims | Basic | Unknown | Zero | ZeroArray | ArrayTensorProduct | ArrayContraction" (reportUnknownVariableType)
- Type of "cg" is "Unknown | PermuteDims | Zero | ZeroArray | Basic | ArrayDiagonal" (reportUnknownVariableType)
+ Type of "cg" is "Unknown | PermuteDims | ArrayDiagonal | Zero | ZeroArray" (reportUnknownVariableType)
- Type of "limit_seq" is "(expr: Unknown, n: Unknown | None = None, trials: int = 5) -> (Unknown | Expr | Zero | None)" (reportUnknownVariableType)
+ Type of "limit_seq" is "(expr: Unknown, n: Unknown | None = None, trials: int = 5) -> Unknown" (reportUnknownVariableType)
- .../projects/sympy/sympy/series/formal.py:799:16 - warning: Return type, "tuple[Unknown | SeqPer | SeqFormula, Basic | Unknown, Unknown]", is partially unknown (reportUnknownVariableType)
+ .../projects/sympy/sympy/series/formal.py:799:16 - warning: Return type, "tuple[Unknown, Unknown, Unknown]", is partially unknown (reportUnknownVariableType)
- .../projects/sympy/sympy/series/fourier.py:97:5 - warning: Return type, "tuple[Literal[False], Unknown] | tuple[Literal[True], Unknown | Expr]", is partially unknown (reportUnknownParameterType)
+ .../projects/sympy/sympy/series/fourier.py:97:5 - warning: Return type, "tuple[Literal[False], Unknown] | tuple[Literal[True], Unknown | Expr | Add | Basic | Dict]", is partially unknown (reportUnknownParameterType)
- Type of "sincos_to_sum" is "(expr: Unknown) -> Unknown" (reportUnknownVariableType)
+ Type of "sincos_to_sum" is "(expr: Unknown) -> (Unknown | Expr | Add | Basic | Dict)" (reportUnknownVariableType)
- Type of "_expr" is "Unknown | Expr" (reportUnknownVariableType)
+ Type of "_expr" is "Unknown | Expr | Add | Basic | Dict" (reportUnknownVariableType)
- Type of "add_coeff" is "tuple[Expr, tuple[Expr, ...]] | Unknown" (reportUnknownVariableType)
+ Type of "add_coeff" is "tuple[Unknown | Add, tuple[Unknown, ...]] | tuple[Expr, tuple[Expr, ...]] | tuple[Zero, tuple[Expr, ...]] | Unknown" (reportUnknownVariableType)
- Type of "as_coeff_add" is "Unknown | ((*deps: Unknown) -> tuple[Expr, tuple[Expr, ...]])" (reportUnknownMemberType)
+ Type of "as_coeff_add" is "Unknown | ((*deps: Unknown) -> tuple[Expr, tuple[Expr, ...]]) | ((*deps: Unknown) -> (tuple[Unknown | Add, tuple[Unknown, ...]] | tuple[Expr, tuple[Expr, ...]] | tuple[Zero, tuple[Expr, ...]]))" (reportUnknownMemberType)
+ .../projects/sympy/sympy/series/fourier.py:113:23 - error: Cannot access attribute "as_coeff_add" for class "Basic"
+ Attribute "as_coeff_add" is unknown (reportAttributeAccessIssue)
+ .../projects/sympy/sympy/series/fourier.py:113:23 - error: Cannot access attribute "as_coeff_add" for class "Dict"
+ Attribute "as_coeff_add" is unknown (reportAttributeAccessIssue)
- Type of "s" is "Expr | Unknown" (reportUnknownVariableType)
+ Type of "s" is "Unknown | Expr" (reportUnknownVariableType)
- Type of "as_coeff_mul" is "((...) -> tuple[Expr, tuple[Expr, ...]]) | Unknown" (reportUnknownMemberType)
+ Type of "as_coeff_mul" is "Unknown | ((...) -> tuple[Expr, tuple[Expr, ...]])" (reportUnknownMemberType)
- .../projects/sympy/sympy/series/fourier.py:124:12 - warning: Return type, "tuple[Literal[True], Unknown | Expr]", is partially unknown (reportUnknownVariableType)
+ .../projects/sympy/sympy/series/fourier.py:124:12 - warning: Return type, "tuple[Literal[True], Unknown | Expr | Add | Basic | Dict]", is partially unknown (reportUnknownVariableType)
- Type of "res_f" is "Unknown | Expr" (reportUnknownVariableType)
+ Type of "res_f" is "Unknown | Expr | Add | Basic | Dict" (reportUnknownVariableType)
+ .../projects/sympy/sympy/series/gruntz.py:146:5 - warning: Type of "c" is partially unknown
+ Type of "c" is "Unknown | Zero | Expr | Any" (reportUnknownVariableType)
+ .../projects/sympy/sympy/series/gruntz.py:149:10 - warning: Type of "is_infinite" is partially unknown
+ Type of "is_infinite" is "Unknown | bool | Any | None" (reportUnknownMemberType)
- .../projects/sympy/sympy/series/gruntz.py:467:16 - warning: Return type, "Unknown | Zero | Expr | Any", is partially unknown (reportUnknownVariableType)
+ .../projects/sympy/sympy/series/gruntz.py:467:16 - warning: Return type is unknown (reportUnknownVariableType)
- .../projects/sympy/sympy/series/limits.py:93:25 - warning: Type of "m" is partially unknown
+ .../projects/sympy/sympy/series/limits.py:93:25 - warning: Type of "m" is unknown (reportUnknownVariableType)
- Type of "m" is "Unknown" (reportUnknownVariableType)
- .../projects/sympy/sympy/series/limitseq.py:103:13 - warning: Type of "e" is partially unknown
+ .../projects/sympy/sympy/series/limitseq.py:103:13 - warning: Type of "e" is unknown (reportUnknownVariableType)
- Type of "e" is "Unknown" (reportUnknownVariableType)
+ .../projects/sympy/sympy/series/limitseq.py:104:9 - warning: Type of "l" is unknown (reportUnknownVariableType)
+ .../projects/sympy/sympy/series/limitseq.py:107:14 - warning: Type of "is_zero" is unknown (reportUnknownMemberType)
- .../projects/sympy/sympy/series/limitseq.py:133:9 - warning: Type of "num" is partially unknown
- Type of "num" is "Expr | Any | Unknown" (reportUnknownVariableType)
- .../projects/sympy/sympy/series/limitseq.py:133:14 - warning: Type of "den" is partially unknown
- Type of "den" is "Expr | Any | Unknown" (reportUnknownVariableType)
- .../projects/sympy/sympy/series/limitseq.py:133:20 - warning: Type of "as_numer_denom" is partially unknown
- Type of "as_numer_denom" is "Unknown | (() -> tuple[Expr, Expr]) | Any" (reportUnknownMemberType)
- .../projects/sympy/sympy/series/limitseq.py:134:16 - warning: Type of "has" is partially unknown
- Type of "has" is "((*patterns: Unknown) -> bool) | Any | Unknown" (reportUnknownMemberType)
- .../projects/sympy/sympy/series/limitseq.py:134:34 - warning: Type of "has" is partially unknown
- Type of "has" is "((*patterns: Unknown) -> bool) | Any | Unknown" (reportUnknownMemberType)
- .../projects/sympy/sympy/series/limitseq.py:135:13 - warning: Type of "result" is partially unknown
- Type of "result" is "Unknown | None" (reportUnknownVariableType)
- .../projects/sympy/sympy/series/limitseq.py:135:33 - warning: Type of "doit" is partially unknown
- Type of "doit" is "Unknown | ((**hints: Unknown) -> Expr) | Any" (reportUnknownMemberType)
- .../projects/sympy/sympy/series/limitseq.py:135:46 - warning: Argument type is unknown
- Argument corresponds to parameter "n" in function "_limit_inf" (reportUnknownArgumentType)
... (truncated 6390 lines) ...
bokeh (https://github.com/bokeh/bokeh)
+ .../projects/bokeh/src/bokeh/protocol/__init__.py:122:9 - error: Implementation return type is too wide
+ Type "Message[Any]" is not assignable to type "ack | error | ok | patch_doc | pull_doc_reply | pull_doc_req | push_doc | server_info_reply | server_info_req"
+ "Message[Any]" is not assignable to "ack"
+ "Message[Any]" is not assignable to "error"
+ "Message[Any]" is not assignable to "ok"
+ "Message[Any]" is not assignable to "patch_doc"
+ "Message[Any]" is not assignable to "pull_doc_reply"
+ "Message[Any]" is not assignable to "pull_doc_req"
+ "Message[Any]" is not assignable to "push_doc"
+ ... (reportInconsistentOverload)
- 1402 errors, 14815 warnings, 0 notes
+ 1403 errors, 14815 warnings, 0 notes
trio (https://github.com/python-trio/trio)
+ Function return type "TypeGuard[BaseExceptionGroup[BaseExcT_co@RaisesGroup]]" is incompatible with type "TypeGuard[ExceptionGroup[ExcT_1@matches]]" (reportInconsistentOverload)
- Function return type "TypeGuard[ExceptionGroup[ExcT_1@matches]]" is incompatible with type "TypeGuard[BaseExceptionGroup[BaseExcT_co@RaisesGroup]]"
- "TypeGuard[ExceptionGroup[ExcT_1@matches]]" is not assignable to "TypeGuard[BaseExceptionGroup[BaseExcT_co@RaisesGroup]]"
- Type parameter "T@TypeGuard" is covariant, but "ExceptionGroup[ExcT_1@matches]" is not a subtype of "BaseExceptionGroup[BaseExcT_co@RaisesGroup]"
- "ExceptionGroup[ExcT_1@matches]" is not assignable to "BaseExceptionGroup[BaseExcT_co@RaisesGroup]"
- Type parameter "_BaseExceptionT_co@BaseExceptionGroup" is covariant, but "ExcT_1@matches" is not a subtype of "BaseExcT_co@RaisesGroup" (reportInconsistentOverload)
- Function return type "TypeGuard[BaseExceptionGroup[BaseExcT_1@matches]]" is incompatible with type "TypeGuard[BaseExceptionGroup[BaseExcT_co@RaisesGroup]]"
+ Function return type "TypeGuard[BaseExceptionGroup[BaseExcT_co@RaisesGroup]]" is incompatible with type "TypeGuard[BaseExceptionGroup[BaseExcT_1@matches]]" (reportInconsistentOverload)
- "TypeGuard[BaseExceptionGroup[BaseExcT_1@matches]]" is not assignable to "TypeGuard[BaseExceptionGroup[BaseExcT_co@RaisesGroup]]"
- Type parameter "T@TypeGuard" is covariant, but "BaseExceptionGroup[BaseExcT_1@matches]" is not a subtype of "BaseExceptionGroup[BaseExcT_co@RaisesGroup]"
- "BaseExceptionGroup[BaseExcT_1@matches]" is not assignable to "BaseExceptionGroup[BaseExcT_co@RaisesGroup]"
- Type parameter "_BaseExceptionT_co@BaseExceptionGroup" is covariant, but "BaseExcT_1@matches" is not a subtype of "BaseExcT_co@RaisesGroup" (reportInconsistentOverload)
+ Function return type "TypeGuard[BaseExceptionGroup[BaseExcT_co@RaisesGroup]]" is incompatible with type "TypeGuard[ExceptionGroup[ExcT_1@_check_exceptions]]" (reportInconsistentOverload)
- Function return type "TypeGuard[ExceptionGroup[ExcT_1@_check_exceptions]]" is incompatible with type "TypeGuard[BaseExceptionGroup[BaseExcT_co@RaisesGroup]]"
- "TypeGuard[ExceptionGroup[ExcT_1@_check_exceptions]]" is not assignable to "TypeGuard[BaseExceptionGroup[BaseExcT_co@RaisesGroup]]"
- Type parameter "T@TypeGuard" is covariant, but "ExceptionGroup[ExcT_1@_check_exceptions]" is not a subtype of "BaseExceptionGroup[BaseExcT_co@RaisesGroup]"
- "ExceptionGroup[ExcT_1@_check_exceptions]" is not assignable to "BaseExceptionGroup[BaseExcT_co@RaisesGroup]"
- Type parameter "_BaseExceptionT_co@BaseExceptionGroup" is covariant, but "ExcT_1@_check_exceptions" is not a subtype of "BaseExcT_co@RaisesGroup" (reportInconsistentOverload)
- Function return type "TypeGuard[BaseExceptionGroup[BaseExcT_1@_check_exceptions]]" is incompatible with type "TypeGuard[BaseExceptionGroup[BaseExcT_co@RaisesGroup]]"
+ Function return type "TypeGuard[BaseExceptionGroup[BaseExcT_co@RaisesGroup]]" is incompatible with type "TypeGuard[BaseExceptionGroup[BaseExcT_1@_check_exceptions]]" (reportInconsistentOverload)
- "TypeGuard[BaseExceptionGroup[BaseExcT_1@_check_exceptions]]" is not assignable to "TypeGuard[BaseExceptionGroup[BaseExcT_co@RaisesGroup]]"
- Type parameter "T@TypeGuard" is covariant, but "BaseExceptionGroup[BaseExcT_1@_check_exceptions]" is not a subtype of "BaseExceptionGroup[BaseExcT_co@RaisesGroup]"
- "BaseExceptionGroup[BaseExcT_1@_check_exceptions]" is not assignable to "BaseExceptionGroup[BaseExcT_co@RaisesGroup]"
- Type parameter "_BaseExceptionT_co@BaseExceptionGroup" is covariant, but "BaseExcT_1@_check_exceptions" is not a subtype of "BaseExcT_co@RaisesGroup" (reportInconsistentOverload)
scikit-learn (https://github.com/scikit-learn/scikit-learn)
+ .../projects/scikit-learn/sklearn/externals/array_api_compat/dask/array/_info.py:255:9 - error: Implementation return type is too wide
+ Type "DTypesAny" is not assignable to type "DTypesAll | DTypesBool | DTypesSigned | DTypesUnsigned | DTypesIntegral | DTypesReal | DTypesComplex | DTypesNumeric"
+ "Mapping[str, DType]" is not assignable to "DTypesAll"
+ "Mapping[str, DType]" is not assignable to "DTypesBool"
+ "Mapping[str, DType]" is not assignable to "DTypesSigned"
+ "Mapping[str, DType]" is not assignable to "DTypesUnsigned"
+ "Mapping[str, DType]" is not assignable to "DTypesIntegral"
+ "Mapping[str, DType]" is not assignable to "DTypesReal"
+ "Mapping[str, DType]" is not assignable to "DTypesComplex"
+ ... (reportInconsistentOverload)
- 20046 errors, 170387 warnings, 0 notes
+ 20047 errors, 170387 warnings, 0 notes
pytest-robotframework (https://github.com/detachhead/pytest-robotframework)
+ .../projects/pytest-robotframework/pytest_robotframework/__init__.py:472:5 - error: Implementation return type is too wide
+ Type "_KeywordDecorator | (() -> Unknown)" is not assignable to type "_WrappedContextManagerKeywordDecorator | _NonWrappedContextManagerKeywordDecorator | _FunctionKeywordDecorator | (() -> Never) | (() -> Unknown)"
+ Type "_KeywordDecorator" is not assignable to type "_WrappedContextManagerKeywordDecorator | _NonWrappedContextManagerKeywordDecorator | _FunctionKeywordDecorator | (() -> Never) | (() -> Unknown)"
+ "_KeywordDecorator" is not assignable to "_WrappedContextManagerKeywordDecorator"
+ "_KeywordDecorator" is not assignable to "_NonWrappedContextManagerKeywordDecorator"
+ "_KeywordDecorator" is not assignable to "_FunctionKeywordDecorator"
+ Type "_KeywordDecorator" is not assignable to type "() -> Never"
+ Type "_KeywordDecorator" is not assignable to type "() -> Unknown" (reportInconsistentOverload)
- 339 errors, 2002 warnings, 0 notes
+ 340 errors, 2002 warnings, 0 notes
strawberry (https://github.com/strawberry-graphql/strawberry)
- .../projects/strawberry/strawberry/federation/object_type.py:145:5 - error: Overloaded implementation is not consistent with signature of overload 2
- Function return type "(T@type) -> T@type" is incompatible with type "T@type"
- Type "(T@type) -> T@type" is not assignable to type "type"
- "FunctionType" is not assignable to "type" (reportInconsistentOverload)
- .../projects/strawberry/strawberry/federation/object_type.py:211:5 - error: Overloaded implementation is not consistent with signature of overload 2
- Function return type "(T@input) -> T@input" is incompatible with type "T@input"
- Type "(T@input) -> T@input" is not assignable to type "type"
- "FunctionType" is not assignable to "type" (reportInconsistentOverload)
- .../projects/strawberry/strawberry/federation/object_type.py:274:5 - error: Overloaded implementation is not consistent with signature of overload 2
- Function return type "(T@interface) -> T@interface" is incompatible with type "T@interface"
- Type "(T@interface) -> T@interface" is not assignable to type "type"
- "FunctionType" is not assignable to "type" (reportInconsistentOverload)
- .../projects/strawberry/strawberry/federation/object_type.py:343:5 - error: Overloaded implementation is not consistent with signature of overload 2
- Function return type "(T@interface_object) -> T@interface_object" is incompatible with type "T@interface_object"
- Type "(T@interface_object) -> T@interface_object" is not assignable to type "type"
- "FunctionType" is not assignable to "type" (reportInconsistentOverload)
- 846 errors, 6502 warnings, 0 notes
+ 842 errors, 6502 warnings, 0 notes
setuptools (https://github.com/pypa/setuptools)
+ .../projects/setuptools/setuptools/glob.py:129:5 - error: Implementation return type is too wide
+ Type "Iterator[str | bytes]" is not assignable to type "Iterator[str] | Iterator[bytes]"
+ "Iterator[str | bytes]" is not assignable to "Iterator[str]"
+ Type parameter "_T_co@Iterator" is covariant, but "str | bytes" is not a subtype of "str"
+ Type "str | bytes" is not assignable to type "str"
+ "bytes" is not assignable to "str"
+ "Iterator[str | bytes]" is not assignable to "Iterator[bytes]"
+ Type parameter "_T_co@Iterator" is covariant, but "str | bytes" is not a subtype of "bytes"
+ Type "str | bytes" is not assignable to type "bytes"
+ ... (reportInconsistentOverload)
+ .../projects/setuptools/setuptools/glob.py:140:5 - error: Implementation return type is too wide
+ Type "Iterator[str | bytes]" is not assignable to type "Iterator[str] | Iterator[bytes]"
+ "Iterator[str | bytes]" is not assignable to "Iterator[str]"
+ Type parameter "_T_co@Iterator" is covariant, but "str | bytes" is not a subtype of "str"
+ Type "str | bytes" is not assignable to type "str"
+ "bytes" is not assignable to "str"
+ "Iterator[str | bytes]" is not assignable to "Iterator[bytes]"
+ Type parameter "_T_co@Iterator" is covariant, but "str | bytes" is not a subtype of "bytes"
+ Type "str | bytes" is not assignable to type "bytes"
+ ... (reportInconsistentOverload)
+ .../projects/setuptools/setuptools/monkey.py:44:5 - error: Overloaded implementation is not consistent with signature of overload 1
+ Function return type "type | FunctionType | None" is incompatible with type "_UnpatchT@get_unpatched" (reportInconsistentOverload)
- 0 errors, 427 warnings, 0 notes
+ 3 errors, 427 warnings, 0 notes
jinja (https://github.com/pallets/jinja)
- Function return type "Iterable[Any]" is incompatible with type "AsyncIterable[Any]"
+ Function return type "AsyncIterable[Any]" is incompatible with type "Iterable[Any]" (reportInconsistentOverload)
- "Iterable[Any]" is incompatible with protocol "AsyncIterable[Any]"
- "__aiter__" is not present (reportInconsistentOverload)
- Function return type "Iterable[Any]" is incompatible with type "AsyncIterable[Any]"
+ Function return type "AsyncIterable[Any]" is incompatible with type "Iterable[Any]" (reportInconsistentOverload)
+ .../projects/jinja/src/jinja2/filters.py:1521:11 - error: Implementation return type is too wide
- "Iterable[Any]" is incompatible with protocol "AsyncIterable[Any]"
+ "AsyncIterable[Any]" is incompatible with protocol "Iterable[Any]"
- "__aiter__" is not present (reportInconsistentOverload)
+ "__iter__" is not present (reportInconsistentOverload)
- 46 errors, 15 warnings, 0 notes
+ 47 errors, 15 warnings, 0 notes
prefect (https://github.com/PrefectHQ/prefect)
- Function return type "PrefectFutureList[PrefectDaskFuture[R@map]]" is incompatible with type "PrefectFutureList[PrefectConcurrentFuture[Any]]"
+ Function return type "PrefectFutureList[PrefectConcurrentFuture[Any]]" is incompatible with type "PrefectFutureList[PrefectDaskFuture[R@map]]" (reportInconsistentOverload)
- "PrefectFutureList[PrefectDaskFuture[R@map]]" is not assignable to "PrefectFutureList[PrefectConcurrentFuture[Any]]"
- Type parameter "R@PrefectFutureList" is invariant, but "PrefectDaskFuture[R@map]" is not the same as "PrefectConcurrentFuture[Any]" (reportInconsistentOverload)
- Function return type "PrefectFutureList[PrefectDaskFuture[R@map]]" is incompatible with type "PrefectFutureList[PrefectConcurrentFuture[Any]]"
+ Function return type "PrefectFutureList[PrefectConcurrentFuture[Any]]" is incompatible with type "PrefectFutureList[PrefectDaskFuture[R@map]]" (reportInconsistentOverload)
+ .../projects/prefect/src/integrations/prefect-dask/prefect_dask/task_runners.py:468:9 - error: Implementation return type is too wide
+ Type "PrefectFutureList[PrefectConcurrentFuture[Any]]" is not assignable to type "PrefectFutureList[PrefectDaskFuture[R@map]]"
- "PrefectFutureList[PrefectDaskFuture[R@map]]" is not assignable to "PrefectFutureList[PrefectConcurrentFuture[Any]]"
+ "PrefectFutureList[PrefectConcurrentFuture[Any]]" is not assignable to "PrefectFutureList[PrefectDaskFuture[R@map]]"
+ Type parameter "R@PrefectFutureList" is invariant, but "PrefectConcurrentFuture[Any]" is not the same as "PrefectDaskFuture[R@map]"
+ "PrefectFutureList[PrefectConcurrentFuture[Any]]" is not assignable to "PrefectFutureList[PrefectDaskFuture[R@map]]"
... (truncated 678 lines) ...``` |
| // Overrides the default timeout for file enumeration operations. | ||
| fileEnumerationTimeoutInSec?: number; | ||
|
|
||
| strictOverloadConsistency = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to document this new rule (both in config-files.md and in the benefits over pyright section (maybe a new file?)
| // Overrides the default timeout for file enumeration operations. | ||
| fileEnumerationTimeoutInSec?: number; | ||
|
|
||
| strictOverloadConsistency = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, actually i think it probably should be a new diagnostic rule. this makes it much easier for users updating it to instantly know what the new setting to disable is if they don't agree with it
| __func: Optional[Callable[..., None]] = None, *, savepoint: bool = True | ||
| ) -> Union[Callable[[], None], Callable[[F], F]]: ... | ||
| __func: F | None = None, *, savepoint: bool = True | ||
| ) -> Union[F, Callable[[F], F]]: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this now an error? i couldn't reproduce it
| def deco2( | ||
| x: Callable[[], T | None] = lambda: None, | ||
| ) -> Callable[[Callable[P, T]], Callable[P, T | None]]: ... | ||
| ) -> Callable[[Callable[P, T]], Callable[P, T]] | Callable[[Callable[P, T]], Callable[P, T | None]]: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
|
|
||
|
|
||
| def overloaded1(x: A | B) -> str | B: ... | ||
| def overloaded1[T: B](x: A | T) -> str | T: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
|
|
||
|
|
||
| def func1(*iterables: Iterable[_T1 | _T2]) -> Tuple[_T1 | _T2, ...] | float: ... | ||
| def func1(*iterables: Iterable[_T1 | _T2]) -> Tuple[_T1 | _T2, ...] | float: ... # pyright: ignore the too wide error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we ignoring the error here instead of fixing it? also should add the error code to the ignore comment
|
|
||
|
|
||
| def func20(choices: AllStr) -> AllStr: ... | ||
| def func20(choices: AnyStr | AllStr) -> AnyStr | AllStr: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems sus, the error message was "Overloaded implementation is not consistent with signature of overload 1" but that's not the error message you added. did we accidentally effect logic for other cases?
| test('OverloadImpl1', () => { | ||
| const analysisResults = TestUtils.typeAnalyzeSampleFiles(['overloadImpl1.py']); | ||
| TestUtils.validateResults(analysisResults, 6); | ||
| TestUtils.validateResults(analysisResults, 7); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment in overloadImpl1.py where the new error should be
fixes: #291
fixes: #1503