[ty] Use constraint sets as pending state in SpecializationBuilder#24540
Conversation
79a5edb to
b4b898d
Compare
Typing conformance results improved 🎉The percentage of diagnostics emitted that were expected errors increased from 89.52% to 89.70%. The percentage of expected errors that received a diagnostic held steady at 86.99%. The number of fully passing files improved from 90/134 to 91/134. SummaryHow are test cases classified?Each test case represents one expected error annotation or a group of annotations sharing a tag. Counts are per test case, not per diagnostic — multiple diagnostics on the same line count as one. Required annotations (
Test file breakdown1 file altered
False positives removed (2)2 diagnostics
|
Memory usage reportSummary
Significant changesClick to expand detailed breakdownprefect
sphinx
trio
flake8
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
unsupported-operator |
209 | 174 | 119 |
type-assertion-failure |
112 | 143 | 102 |
invalid-argument-type |
23 | 105 | 102 |
not-subscriptable |
0 | 154 | 0 |
unresolved-attribute |
23 | 82 | 39 |
no-matching-overload |
1 | 126 | 0 |
invalid-return-type |
4 | 29 | 5 |
invalid-assignment |
14 | 5 | 12 |
not-iterable |
1 | 16 | 0 |
unused-type-ignore-comment |
1 | 3 | 0 |
assert-type-unspellable-subtype |
0 | 0 | 1 |
invalid-raise |
0 | 0 | 1 |
| Total | 388 | 837 | 381 |
Large timing changes:
| Project | Old Time | New Time | Change |
|---|---|---|---|
pydantic |
0.50s | 2.80s | +458% |
hydra-zen |
0.16s | 0.70s | +327% |
apprise |
0.33s | 0.90s | +170% |
mongo-python-driver |
0.23s | 0.59s | +160% |
mitmproxy |
0.39s | 0.84s | +114% |
pip |
0.36s | 0.70s | +95% |
altair |
0.33s | 0.58s | +74% |
egglog-python |
0.31s | 0.50s | +63% |
Showing a random sample of 288 of 1606 changes. See the HTML report for the full diff.
Raw diff sample (288 of 1606 changes)
Expression (https://github.com/cognitedata/Expression)
- expression/collections/maptree.py:113:25 error[invalid-argument-type] Argument to function `mk` is incorrect: Expected `Option[MapTreeLeaf[Key@rebalance, object]]`, found `Option[MapTreeLeaf[Key@rebalance, Value@rebalance]]`
+ expression/collections/maptree.py:113:25 error[invalid-argument-type] Argument to function `mk` is incorrect: Expected `Option[MapTreeLeaf[Key@rebalance, object]]`, found `Option[MapTreeLeaf[Key@rebalance, Value@rebalance | Key@rebalance]]`
- expression/collections/maptree.py:116:25 error[invalid-argument-type] Argument to function `mk` is incorrect: Expected `Option[MapTreeLeaf[Key@rebalance, object]]`, found `Option[MapTreeLeaf[Never, object]]`
+ expression/collections/maptree.py:116:28 error[invalid-argument-type] Argument to function `mk` is incorrect: Expected `Option[MapTreeLeaf[Key@rebalance, object]]`, found `Option[MapTreeLeaf[Never, Never]]`
- expression/collections/maptree.py:141:61 error[invalid-argument-type] Argument to function `mk` is incorrect: Expected `Option[MapTreeLeaf[Key@rebalance, object]]`, found `Option[MapTreeLeaf[Key@rebalance, Value@rebalance]]`
+ expression/collections/maptree.py:141:61 error[invalid-argument-type] Argument to function `mk` is incorrect: Expected `Option[MapTreeLeaf[Key@rebalance, object]]`, found `Option[MapTreeLeaf[Key@rebalance, Value@rebalance | Key@rebalance]]`
- expression/collections/maptree.py:141:64 error[invalid-argument-type] Argument to function `mk` is incorrect: Expected `Option[MapTreeLeaf[Key@rebalance, Value@rebalance]]`, found `Option[MapTreeLeaf[Never, Never]]`
+ expression/collections/maptree.py:141:64 error[invalid-argument-type] Argument to function `mk` is incorrect: Expected `Option[MapTreeLeaf[Key@rebalance, Value@rebalance | Key@rebalance]]`, found `Option[MapTreeLeaf[Never, Never]]`
- tests/test_result.py:513:24 error[invalid-argument-type] Argument to bound method `PipeMixin.pipe` is incorrect: Expected `(Result[Literal[42], Any] | _A'return@curry_flip, /) -> _A'return@curry_flip | Result[Literal[42], Any]`, found `(_A'return@curry_flip, /) -> _A'return@curry_flip`
+ tests/test_result.py:513:24 error[invalid-argument-type] Argument to bound method `PipeMixin.pipe` is incorrect: Expected `(Result[Literal[42], Any], /) -> Result[Literal[42], Any] | _A'return@curry_flip`, found `(_A'return@curry_flip, /) -> _A'return@curry_flip`
- tests/test_seq.py:248:19 error[invalid-argument-type] Argument to function `pipe` is incorrect: Expected `(Iterable[int] | _A'return@curry_flip, /) -> _A'return@curry_flip | Iterable[int]`, found `(_A'return@curry_flip, /) -> _A'return@curry_flip`
+ tests/test_seq.py:248:19 error[invalid-argument-type] Argument to function `pipe` is incorrect: Expected `(Iterable[int], /) -> Iterable[int] | _A'return@curry_flip`, found `(_A'return@curry_flip, /) -> _A'return@curry_flip`
beartype (https://github.com/beartype/beartype)
- beartype/_util/func/arg/utilfuncargtest.py:302:12 error[invalid-return-type] Return type does not match returned value: expected `bool`, found `int`
- beartype/_util/func/arg/utilfuncargtest.py:331:12 error[invalid-return-type] Return type does not match returned value: expected `bool`, found `int`
boostedblob (https://github.com/hauntsaninja/boostedblob)
- boostedblob/boost.py:544:61 error[invalid-argument-type] Argument to function `create_task` is incorrect: Expected `Generator[Any, None, Unknown] | Coroutine[Any, Any, Unknown]`, found `Awaitable[T@EageriseBoostable]`
+ boostedblob/boost.py:544:61 error[invalid-argument-type] Argument to function `create_task` is incorrect: Expected `Generator[Any, None, T@EageriseBoostable] | Coroutine[Any, Any, T@EageriseBoostable]`, found `Awaitable[T@EageriseBoostable]`
build (https://github.com/pypa/build)
- tests/test_integration.py:149:17 error[no-matching-overload] No overload of constructor `filter.__new__` matches arguments
- tests/test_integration.py:150:17 error[no-matching-overload] No overload of constructor `filter.__new__` matches arguments
core (https://github.com/home-assistant/core)
- homeassistant/helpers/entity_registry.py:2391:9 error[invalid-argument-type] Argument to bound method `EventBus.async_listen` is incorrect: Expected `(Event[EventCategoryRegistryUpdatedData | EventLabelRegistryUpdatedData], /) -> Coroutine[Any, Any, None] | None`, found `def _handle_category_registry_update(event: EventCategoryRegistryUpdated) -> None`
dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/contrib/internal/subprocess/patch.py:364:37 error[invalid-argument-type] Argument to bound method `list.extend` is incorrect: Expected `Iterable[str]`, found `list[_T@deque | str]`
discord.py (https://github.com/Rapptz/discord.py)
- discord/ext/commands/core.py:2025:31 error[invalid-argument-type] Argument to `CheckAnyFailure.__init__` is incorrect: Expected `list[(Context[Unknown], /) -> bool]`, found `list[(ContextT@check_any, /) -> Coroutine[Any, Any, bool]]`
django-stubs (https://github.com/typeddjango/django-stubs)
+ tests/assert_type/utils/test_encoding.py:23:5 error[type-assertion-failure] Type `Unknown` does not match asserted type `int`
hydpy (https://github.com/hydpy-dev/hydpy)
- hydpy/core/parametertools.py:3926:45 error[not-subscriptable] Cannot subscript object of type `float` with no `__getitem__` method
jax (https://github.com/google/jax)
- jax/_src/scipy/sparse/linalg.py:189:14 error[invalid-argument-type] Argument to function `safe_map` is incorrect: Expected `(_SupportsShape[Never] | int | float | ... omitted 7 union elements, /) -> tuple[Any, ...] | tuple[int] | tuple[int, int] | tuple[int, int, int]`, found `Overload[(a: _SupportsShape[Never]) -> tuple[Any, ...], [_ShapeT](a: _SupportsShape[_ShapeT]) -> _ShapeT, (a: int | float | complex | bytes | str) -> tuple[()], [_PyScalarT](a: list[_PyScalarT] | tuple[_PyScalarT, ...]) -> tuple[int], [_PyScalarT](a: Sequence[list[_PyScalarT] | tuple[_PyScalarT, ...]]) -> tuple[int, int], [_PyScalarT](a: Sequence[Sequence[list[_PyScalarT] | tuple[_PyScalarT, ...]]]) -> tuple[int, int, int], (a: memoryview[int] | bytearray) -> tuple[int], (a: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | ... omitted 5 union elements) -> tuple[Any, ...]]`
- jax/_src/pmap.py:922:21 error[unresolved-attribute] Attribute `_rewrap_with_aval_and_sharding` is not defined on `ndarray[tuple[Any, ...], dtype[Unknown]]` in union `Any | ndarray[tuple[Any, ...], dtype[Unknown]]`
+ jax/_src/pmap.py:922:21 error[unresolved-attribute] Attribute `_rewrap_with_aval_and_sharding` is not defined on `ndarray[tuple[Any, ...], dtype[Unknown]]`, `ndarray[Unknown, dtype[Any]]` in union `Any | ndarray[tuple[Any, ...], dtype[Unknown]] | ndarray[Unknown, dtype[Any]]`
- jax/experimental/multihost_utils.py:292:30 error[unresolved-attribute] Attribute `_impl` is not defined on `dtype[Unknown]` in union `Unknown | dtype[Unknown]`
+ jax/experimental/multihost_utils.py:292:30 error[unresolved-attribute] Attribute `_impl` is not defined on `dtype[Unknown]`, `dtype[float64]` in union `Any | dtype[Unknown] | dtype[float64]`
- jax/experimental/multihost_utils.py:432:11 error[unresolved-attribute] Attribute `_base_array` is not defined on `ndarray[tuple[Any, ...], dtype[Unknown]]` in union `Unknown | ndarray[tuple[Any, ...], dtype[Unknown]]`
+ jax/experimental/multihost_utils.py:432:11 error[unresolved-attribute] Attribute `_base_array` is not defined on `ndarray[tuple[Any, ...], dtype[Unknown]]`, `ndarray[Unknown, dtype[float64]]` in union `(Any & <Protocol with members 'shape'>) | ndarray[tuple[Any, ...], dtype[Unknown]] | ndarray[Unknown, dtype[float64]]`
materialize (https://github.com/MaterializeInc/materialize)
- test/sql-server-cdc/mzcompose.py:126:18 error[invalid-argument-type] Argument to bound method `Composition.test_parts` is incorrect: Expected `list[str | Path]`, found `list[str]`
meson (https://github.com/mesonbuild/meson)
+ mesonbuild/dependencies/cuda.py:137:76 error[invalid-argument-type] Argument to function `version_compare_many` is incorrect: Expected `str`, found `str | None`
- mesonbuild/interpreter/type_checking.py:180:63 error[invalid-assignment] Object of type `KwargInfo[list[str | int] | None]` is not assignable to `KwargInfo[list[str | int]]`
mypy (https://github.com/python/mypy)
- mypy/build.py:5118:38 error[invalid-argument-type] Argument to function `is_sub_path_normabs` is incorrect: Expected `str`, found `PathLike[PathLike[Never] | str] | str`
- mypy/modulefinder.py:478:57 error[invalid-argument-type] Argument to function `os_path_join` is incorrect: Expected `str`, found `PathLike[PathLike[Never] | str] | str`
openlibrary (https://github.com/internetarchive/openlibrary)
- openlibrary/utils/ddc.py:172:12 error[invalid-return-type] Return type does not match returned value: expected `str`, found `Sized`
packaging (https://github.com/pypa/packaging)
- src/packaging/specifiers.py:842:13 error[invalid-assignment] Object of type `tuple[Specifier | Buffer, ...]` is not assignable to attribute `_specs` of type `tuple[Specifier, ...]`
pandas (https://github.com/pandas-dev/pandas)
- pandas/tests/scalar/interval/test_contains.py:37:16 error[unsupported-operator] Operator `in` is not supported between objects of type `Interval[int]` and `Interval[int | float]`
- pandas/tests/scalar/interval/test_contains.py:45:16 error[unsupported-operator] Operator `in` is not supported between objects of type `Interval[int | float]` and `Interval[int]`
- pandas/tests/scalar/interval/test_contains.py:46:47 error[unsupported-operator] Operator `not in` is not supported between objects of type `Interval[int | float]` and `Interval[int]`
- pandas/core/arrays/boolean.py:261:24 error[unresolved-attribute] Attribute `shape` is not defined on `None` in union `Unknown | None | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | ndarray[tuple[Any, ...], dtype[Any]]`
+ pandas/core/arrays/boolean.py:261:24 error[unresolved-attribute] Attribute `shape` is not defined on `None` in union `Unknown | ndarray[Unknown, dtype[Any]] | None | ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | ndarray[tuple[Any, ...], dtype[Any]]`
- pandas/core/arrays/interval.py:1571:50 error[invalid-argument-type] Argument to `Interval.__init__` is incorrect: Expected `int`, found `Period | Timestamp | Timedelta | NaTType | Any`
- pandas/core/internals/construction.py:259:22 error[unresolved-attribute] Attribute `reshape` is not defined on `ExtensionArray` in union `Unknown | ndarray[tuple[int, int], dtype[Any]] | ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]]`
+ pandas/core/internals/construction.py:259:22 error[unresolved-attribute] Attribute `reshape` is not defined on `ExtensionArray` in union `Unknown | ndarray[Unknown, dtype[Any]] | ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]]`
- pandas/tests/scalar/interval/test_arithmetic.py:92:13 error[unsupported-operator] Operator `/` is not supported between objects of type `Interval[int]` and `Literal["foo"]`
+ pandas/tests/scalar/interval/test_arithmetic.py:92:13 error[unsupported-operator] Operator `/` is not supported between objects of type `Interval[Unknown]` and `Literal["foo"]`
- pandas/tests/scalar/interval/test_arithmetic.py:107:13 error[unsupported-operator] Operator `//` is not supported between two objects of type `Interval[int]`
+ pandas/tests/scalar/interval/test_arithmetic.py:107:13 error[unsupported-operator] Operator `//` is not supported between two objects of type `Interval[Unknown]`
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
- tests/indexes/bool/test_add.py:24:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Index[int | float | complex]`
- tests/indexes/bool/test_add.py:24:23 error[unsupported-operator] Operator `+` is not supported between objects of type `Index[bool]` and `complex`
- tests/indexes/bool/test_add.py:29:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Index[int | float | complex]`
- tests/indexes/bool/test_add.py:39:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Index[int | float | complex]`
- tests/indexes/bool/test_add.py:23:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Index[int | float]`
+ tests/indexes/bool/test_add.py:23:11 error[type-assertion-failure] Type `Index[int | float | complex]` does not match asserted type `Index[int | float]`
- tests/indexes/bool/test_add.py:36:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Index[bool]`
+ tests/indexes/bool/test_add.py:36:11 error[type-assertion-failure] Type `Index[int]` does not match asserted type `Index[bool]`
- tests/indexes/bool/test_mul.py:49:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Index[int | float]`
- tests/indexes/bool/test_mul.py:49:23 error[unsupported-operator] Operator `*` is not supported between objects of type `float` and `Index[bool]`
- tests/indexes/bool/test_mul.py:64:23 error[unsupported-operator] Operator `*` is not supported between objects of type `Index[bool]` and `list[int | float]`
- tests/indexes/bool/test_mul.py:71:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Index[int]`
- tests/indexes/bool/test_truediv.py:33:11 error[type-assertion-failure] Type `Index[int | float]` does not match asserted type `Index[int | float | complex]`
- tests/indexes/bool/test_truediv.py:40:11 error[type-assertion-failure] Type `Index[int | float]` does not match asserted type `Index[int | float | complex]`
+ tests/indexes/float/test_add.py:24:11 error[type-assertion-failure] Type `Index[int | float | complex]` does not match asserted type `Index[int | float]`
- tests/indexes/float/test_add.py:27:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Index[int | float]`
+ tests/indexes/float/test_add.py:27:11 error[type-assertion-failure] Type `Index[int | float | complex]` does not match asserted type `Index[int | float]`
- tests/indexes/float/test_add.py:27:23 error[unsupported-operator] Operator `+` is not supported between objects of type `Literal[True]` and `Index[int | float]`
- tests/indexes/float/test_mul.py:43:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Index[int | float | complex]`
+ tests/indexes/float/test_truediv.py:34:11 error[type-assertion-failure] Type `Index[int | float | complex]` does not match asserted type `Index[int | float]`
+ tests/indexes/int/test_add.py:28:11 error[type-assertion-failure] Type `Index[int | float | complex]` does not match asserted type `Index[int]`
- tests/indexes/int/test_mul.py:50:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Index[int | float]`
- tests/indexes/int/test_mul.py:51:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Index[int | float | complex]`
- tests/indexes/int/test_truediv.py:37:11 error[type-assertion-failure] Type `Index[int | float]` does not match asserted type `Index[int | float | complex]`
- tests/indexes/str/test_add.py:31:14 error[unsupported-operator] Operator `+` is not supported between objects of type `Index[str]` and `Literal[4]`
- tests/scalars/test_scalars.py:1678:23 error[unsupported-operator] Operator `+` is not supported between objects of type `Period` and `Series[Timedelta]`
- tests/series/bool/test_add.py:24:23 error[unsupported-operator] Operator `+` is not supported between objects of type `Series[bool]` and `complex`
- tests/series/bool/test_add.py:34:23 error[no-matching-overload] No overload of bound method `Series.add` matches arguments
- tests/series/bool/test_add.py:51:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float | complex]`
- tests/series/bool/test_add.py:61:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float | complex]`
- tests/series/bool/test_add.py:67:9 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float | complex]`
- tests/series/bool/test_add.py:21:23 error[unsupported-operator] Operator `+` is not supported between objects of type `Series[bool]` and `Literal[True]`
- tests/series/bool/test_add.py:23:23 error[unsupported-operator] Operator `+` is not supported between objects of type `Series[bool]` and `float`
- tests/series/bool/test_add.py:27:23 error[unsupported-operator] Operator `+` is not supported between objects of type `Literal[1]` and `Series[bool]`
- tests/series/bool/test_add.py:28:23 error[unsupported-operator] Operator `+` is not supported between objects of type `float` and `Series[bool]`
- tests/series/bool/test_add.py:33:23 error[no-matching-overload] No overload of bound method `Series.add` matches arguments
- tests/series/bool/test_add.py:36:23 error[no-matching-overload] No overload of bound method `Series.radd` matches arguments
- tests/series/bool/test_add.py:37:23 error[no-matching-overload] No overload of bound method `Series.radd` matches arguments
- tests/series/bool/test_add.py:59:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int]`
+ tests/series/bool/test_add.py:59:11 error[type-assertion-failure] Type `Series[int | float | complex]` does not match asserted type `Series[int]`
- tests/series/bool/test_add.py:60:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float]`
+ tests/series/bool/test_add.py:60:11 error[type-assertion-failure] Type `Series[int | float | complex]` does not match asserted type `Series[int | float]`
- tests/series/bool/test_add.py:65:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float]`
+ tests/series/bool/test_add.py:65:11 error[type-assertion-failure] Type `Series[int | float | complex]` does not match asserted type `Series[int | float]`
- tests/series/bool/test_mul.py:42:23 error[unsupported-operator] Operator `*` is not supported between objects of type `Series[bool]` and `float`
- tests/series/bool/test_mul.py:43:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float | complex]`
- tests/series/bool/test_mul.py:58:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float]`
- tests/series/bool/test_mul.py:59:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float | complex]`
- tests/series/bool/test_mul.py:66:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float]`
- tests/series/bool/test_mul.py:83:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float]`
- tests/series/bool/test_mul.py:90:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int]`
- tests/series/bool/test_mul.py:90:23 error[unsupported-operator] Operator `*` is not supported between objects of type `list[int]` and `Series[bool]`
- tests/series/bool/test_mul.py:99:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float]`
- tests/series/bool/test_mul.py:106:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int]`
- tests/series/bool/test_mul.py:48:23 error[unsupported-operator] Operator `*` is not supported between objects of type `Literal[True]` and `Series[bool]`
+ tests/series/bool/test_truediv.py:40:11 error[type-assertion-failure] Type `Series[int | float | complex]` does not match asserted type `Series[int | float]`
+ tests/series/bool/test_truediv.py:58:11 error[type-assertion-failure] Type `Series[int | float | complex]` does not match asserted type `Series[int | float]`
- tests/series/complex/test_add.py:21:23 error[unsupported-operator] Operator `+` is not supported between objects of type `Series[int | float | complex]` and `Literal[True]`
- tests/series/complex/test_add.py:37:9 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float | complex]`
- tests/series/complex/test_add.py:40:9 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float | complex]`
- tests/series/complex/test_add.py:43:9 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float | complex]`
- tests/series/complex/test_add.py:43:21 error[no-matching-overload] No overload of bound method `Series.radd` matches arguments
- tests/series/complex/test_add.py:57:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float | complex]`
- tests/series/complex/test_add.py:62:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float | complex]`
- tests/series/complex/test_add.py:65:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float | complex]`
- tests/series/complex/test_add.py:76:9 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float | complex]`
- tests/series/float/test_add.py:29:23 error[unsupported-operator] Operator `+` is not supported between objects of type `complex` and `Series[int | float]`
- tests/series/float/test_add.py:34:23 error[no-matching-overload] No overload of bound method `Series.add` matches arguments
- tests/series/float/test_add.py:51:23 error[unsupported-operator] Operator `+` is not supported between objects of type `Series[int | float]` and `list[int | float | complex]`
- tests/series/float/test_add.py:61:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float | complex]`
+ tests/series/float/test_add.py:28:11 error[type-assertion-failure] Type `Series[int | float | complex]` does not match asserted type `Series[int | float]`
+ tests/series/float/test_add.py:38:11 error[type-assertion-failure] Type `Series[int | float | complex]` does not match asserted type `Series[int | float]`
- tests/series/float/test_add.py:22:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float]`
+ tests/series/float/test_add.py:22:11 error[type-assertion-failure] Type `Series[int | float | complex]` does not match asserted type `Series[int | float]`
- tests/series/float/test_add.py:55:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float]`
+ tests/series/float/test_add.py:55:11 error[type-assertion-failure] Type `Series[int | float | complex]` does not match asserted type `Series[int | float]`
- tests/series/float/test_add.py:64:23 error[no-matching-overload] No overload of bound method `Series.radd` matches arguments
- tests/series/float/test_add.py:65:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float]`
+ tests/series/float/test_add.py:65:11 error[type-assertion-failure] Type `Series[int | float | complex]` does not match asserted type `Series[int | float]`
- tests/series/float/test_add.py:65:23 error[no-matching-overload] No overload of bound method `Series.radd` matches arguments
+ tests/series/float/test_truediv.py:36:11 error[type-assertion-failure] Type `Series[int | float | complex]` does not match asserted type `Series[int | float]`
+ tests/series/float/test_truediv.py:43:11 error[type-assertion-failure] Type `Series[int | float | complex]` does not match asserted type `Series[int | float]`
+ tests/series/float/test_truediv.py:45:11 error[type-assertion-failure] Type `Series[int | float | complex]` does not match asserted type `Series[int | float]`
- tests/series/int/test_add.py:34:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float | complex]`
+ tests/series/int/test_add.py:21:11 error[type-assertion-failure] Type `Series[int | float | complex]` does not match asserted type `Series[int]`
+ tests/series/int/test_add.py:26:11 error[type-assertion-failure] Type `Series[int | float | complex]` does not match asserted type `Series[int]`
+ tests/series/int/test_add.py:27:11 error[type-assertion-failure] Type `Series[int | float | complex]` does not match asserted type `Series[int]`
- tests/series/int/test_mul.py:58:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float]`
- tests/series/int/test_mul.py:66:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float]`
+ tests/series/int/test_truediv.py:43:11 error[type-assertion-failure] Type `Series[int | float | complex]` does not match asserted type `Series[int | float]`
- tests/series/str/test_add.py:70:9 error[no-matching-overload] No overload of bound method `Series.add` matches arguments
- tests/series/str/test_add.py:84:9 error[no-matching-overload] No overload of bound method `Series.radd` matches arguments
+ tests/series/test_series.py:885:9 error[type-assertion-failure] Type `Series[int | float | complex]` does not match asserted type `Series[int | float]`
- tests/series/timedelta/test_floordiv.py:71:9 error[no-matching-overload] No overload of bound method `Series.rfloordiv` matches arguments
- tests/series/timedelta/test_floordiv.py:72:9 error[no-matching-overload] No overload of bound method `Series.rfloordiv` matches arguments
- tests/series/timedelta/test_truediv.py:75:9 error[no-matching-overload] No overload of bound method `Series.rtruediv` matches arguments
- tests/series/timedelta/test_truediv.py:76:9 error[no-matching-overload] No overload of bound method `Series.rtruediv` matches arguments
+ tests/series/timedelta/test_truediv.py:55:9 error[type-assertion-failure] Type `Series[int | float | complex]` does not match asserted type `Series[Timedelta]`
- tests/test_natype.py:105:13 error[no-matching-overload] No overload of function `divmod` matches arguments
pip (https://github.com/pypa/pip)
- src/pip/_vendor/packaging/specifiers.py:1410:13 error[invalid-assignment] Object of type `tuple[Specifier | Buffer, ...]` is not assignable to attribute `_specs` of type `tuple[Specifier, ...]`
+ src/pip/_vendor/resolvelib/structs.py:206:12 error[invalid-return-type] Return type does not match returned value: expected `Iterable[CT@build_iter_view]`, found `_SequenceIterableView[RT@_SequenceIterableView]`
prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/cli/flow_run.py:269:20 error[unresolved-attribute] Attribute `is_scheduled` is not defined on `None` in union `State[Any] | None | UnspecializedTypeVar`
+ src/prefect/cli/flow_run.py:269:20 error[unresolved-attribute] Attribute `is_scheduled` is not defined on `None` in union `State[Any] | None`
- src/prefect/tasks.py:1214:16 error[no-matching-overload] No overload of function `run_task` matches arguments
pwndbg (https://github.com/pwndbg/pwndbg)
- pwndbg/enhance.py:174:16 error[invalid-return-type] Return type does not match returned value: expected `str`, found `UnspecializedTypeVar | str | None`
+ pwndbg/enhance.py:174:16 error[invalid-return-type] Return type does not match returned value: expected `str`, found `Unknown | str | None`
scikit-learn (https://github.com/scikit-learn/scikit-learn)
+ sklearn/manifold/_locally_linear.py:441:34 error[unresolved-attribute] Attribute `tocsr` is not defined on `ndarray[Unknown, Unknown]` in union `Unknown | lil_array[Any] | ndarray[Unknown, Unknown]`
- sklearn/tree/tests/test_tree.py:778:35 error[unresolved-attribute] Attribute `tocsr` is not defined on `ndarray[tuple[Any, ...], Unknown]`, `ndarray[tuple[int, int], Unknown]` in union `Unknown | ndarray[tuple[Any, ...], Unknown] | ndarray[tuple[int, int], Unknown]`
+ sklearn/tree/tests/test_tree.py:778:35 error[unresolved-attribute] Attribute `tocsr` is not defined on `ndarray[tuple[Any, ...], Unknown]`, `ndarray[Unknown, Unknown]` in union `Unknown | ndarray[tuple[Any, ...], Unknown] | ndarray[Unknown, Unknown]`
scipy (https://github.com/scipy/scipy)
- scipy/optimize/_nonlin.py:1356:19 error[unresolved-attribute] Attribute `conj` is not defined on `None` in union `None | Unknown`
+ scipy/optimize/_nonlin.py:1356:19 error[unresolved-attribute] Attribute `conj` is not defined on `None` in union `None | ndarray[Unknown, Unknown]`
- scipy/optimize/_nonlin.py:1359:19 error[unresolved-attribute] Attribute `conj` is not defined on `None` in union `None | Unknown`
+ scipy/optimize/_nonlin.py:1359:19 error[unresolved-attribute] Attribute `conj` is not defined on `None` in union `None | ndarray[Unknown, Unknown]`
- scipy/sparse/tests/test_base.py:2474:35 error[unresolved-attribute] Object of type `ndarray[tuple[int, int], dtype[float64]]` has no attribute `toarray`
+ scipy/sparse/tests/test_base.py:2474:35 error[unresolved-attribute] Object of type `ndarray[Unknown, dtype[float64]]` has no attribute `toarray`
scipy-stubs (https://github.com/scipy/scipy-stubs)
- tests/interpolate/test_polyint.pyi:33:1 error[type-assertion-failure] Type `KroghInterpolator[float64, Any]` does not match asserted type `KroghInterpolator[float64, signedinteger[_32Bit]]`
+ tests/interpolate/test_polyint.pyi:33:1 error[type-assertion-failure] Type `KroghInterpolator[float64, Never]` does not match asserted type `KroghInterpolator[float64, signedinteger[_32Bit]]`
- tests/sparse/test_csr.pyi:58:1 error[type-assertion-failure] Type `csr_array[Any, tuple[int, int]]` does not match asserted type `csr_array[float64, tuple[int]]`
+ tests/sparse/test_csr.pyi:58:1 error[type-assertion-failure] Type `csr_array[Never, tuple[int, int]]` does not match asserted type `csr_array[float64, tuple[int]]`
- tests/sparse/test_csr.pyi:76:1 error[type-assertion-failure] Type `csr_array[Any, tuple[int, int]]` does not match asserted type `csr_array[signedinteger[_64Bit], tuple[int, int]]`
+ tests/sparse/test_csr.pyi:76:1 error[type-assertion-failure] Type `csr_array[Never, tuple[int, int]]` does not match asserted type `csr_array[signedinteger[_64Bit], tuple[int, int]]`
- tests/sparse/test_csr.pyi:87:1 error[type-assertion-failure] Type `csr_array[Any, tuple[int, int]]` does not match asserted type `csr_array[floating[_32Bit], tuple[int, int]]`
+ tests/sparse/test_csr.pyi:87:1 error[type-assertion-failure] Type `csr_array[Never, tuple[int, int]]` does not match asserted type `csr_array[floating[_32Bit], tuple[int, int]]`
- tests/sparse/test_csr.pyi:91:1 error[type-assertion-failure] Type `csr_array[Any, tuple[int, int]]` does not match asserted type `csr_array[float64, tuple[int, int]]`
+ tests/sparse/test_csr.pyi:91:1 error[type-assertion-failure] Type `csr_array[Never, tuple[int, int]]` does not match asserted type `csr_array[float64, tuple[int, int]]`
setuptools (https://github.com/pypa/setuptools)
- setuptools/_distutils/command/sdist.py:292:34 error[invalid-argument-type] Argument to bound method `FileList.extend` is incorrect: Expected `Iterable[str]`, found `filter[int | str | bytes | PathLike[str] | PathLike[bytes]]`
- setuptools/discovery.py:557:16 error[invalid-assignment] Object of type `list[Sized]` is not assignable to `list[str]`
- setuptools/msvc.py:1463:16 error[invalid-return-type] Return type does not match returned value: expected `str | None`, found `int | str | bytes | ... omitted 3 union elements`
spack (https://github.com/spack/spack)
- lib/spack/spack/verify_libraries.py:170:69 error[invalid-argument-type] Argument to `Problem.__init__` is incorrect: Expected `list[bytes]`, found `list[bytes | Unknown | str | PathLike[str] | PathLike[bytes]]`
+ lib/spack/spack/test/util/log_parser.py:118:35 error[invalid-argument-type] Argument to function `make_log_context` is incorrect: Expected `list[LogEvent]`, found `list[BuildError | BuildWarning]`
- lib/spack/spack/detection/common.py:378:20 error[no-matching-overload] No overload of constructor `filter.__new__` matches arguments
- lib/spack/spack/llnl/util/filesystem.py:1789:24 error[no-matching-overload] No overload of function `basename` matches arguments
- lib/spack/spack/llnl/util/filesystem.py:1791:25 error[invalid-argument-type] Argument to function `move` is incorrect: Expected `str | PathLike[str]`, found `Sized`
- lib/spack/spack/util/elf.py:615:29 error[invalid-argument-type] Argument to bound method `bytes.join` is incorrect: Expected `Iterable[Buffer]`, found `list[Sized]`
- var/spack/test_repos/spack_repo/builtin_mock/build_systems/compiler.py:148:16 error[invalid-return-type] Return type does not match returned value: expected `dict[str, str | Path]`, found `dict[Sized, str | Path]`
sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/ext/autosummary/generate.py:664:57 error[unresolved-attribute] Attribute `name` is not defined on `Buffer` in union `AutosummaryEntry | Buffer`
- sphinx/ext/autosummary/generate.py:692:13 error[unresolved-attribute] Attribute `template` is not defined on `Buffer` in union `AutosummaryEntry | Buffer`
static-frame (https://github.com/static-frame/static-frame)
- static_frame/core/store_sqlite.py:85:34 error[invalid-argument-type] Argument to function `register_adapter` is incorrect: Expected `type[SupportsInt | str | Buffer | SupportsIndex | SupportsTrunc]`, found `<class 'signedinteger[_32Bit]'>`
- static_frame/core/store_sqlite.py:86:34 error[invalid-argument-type] Argument to function `register_adapter` is incorrect: Expected `type[SupportsInt | str | Buffer | SupportsIndex | SupportsTrunc]`, found `<class 'signedinteger[_16Bit]'>`
sympy (https://github.com/sympy/sympy)
- sympy/simplify/cse_main.py:306:16 error[unsupported-operator] Operator `in` is not supported between objects of type `Unknown` and `Unknown | Sized`
- sympy/solvers/polysys.py:837:28 error[not-iterable] Object of type `Sized` is not iterable
- sympy/solvers/polysys.py:851:28 error[not-iterable] Object of type `Sized` is not iterable
- sympy/algebras/tests/test_quaternion.py:76:10 error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
+ sympy/codegen/tests/test_matrix_nodes.py:27:37 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
- sympy/core/mul.py:572:13 error[no-matching-overload] No overload of bound method `MutableMapping.setdefault` matches arguments
- sympy/functions/combinatorial/factorials.py:968:29 error[unresolved-attribute] Attribute `is_nonnegative` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/functions/combinatorial/factorials.py:969:12 error[unresolved-attribute] Attribute `is_zero` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/functions/combinatorial/factorials.py:967:13 error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/functions/combinatorial/factorials.py:967:13 error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | Unknown`
- sympy/functions/combinatorial/factorials.py:986:53 error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/functions/combinatorial/factorials.py:986:53 error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | Unknown`
- sympy/geometry/polygon.py:1510:40 error[unresolved-attribute] Attribute `is_number` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
+ sympy/geometry/polygon.py:1510:40 error[unresolved-attribute] Attribute `is_number` is not defined on `int` in union `Basic | Unknown | int`
- sympy/matrices/expressions/hadamard.py:82:22 error[invalid-argument-type] Argument to function `validate_matadd_integer` is incorrect: Expected `MatrixExpr`, found `Basic | int | float | complex | Any`
+ sympy/matrices/expressions/hadamard.py:82:22 error[invalid-argument-type] Argument to function `validate_matadd_integer` is incorrect: Expected `MatrixExpr`, found `Basic | Unknown`
- sympy/matrices/expressions/kronecker.py:111:33 error[unresolved-attribute] Attribute `rows` is not defined on `Basic`, `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
+ sympy/matrices/expressions/kronecker.py:111:33 error[unresolved-attribute] Attribute `rows` is not defined on `Basic` in union `Basic | Unknown`
- sympy/matrices/expressions/matadd.py:61:22 error[invalid-argument-type] Argument to function `validate_matadd_integer` is incorrect: Expected `MatrixExpr`, found `Unknown | Basic | int | float | complex`
+ sympy/matrices/expressions/matadd.py:61:22 error[invalid-argument-type] Argument to function `validate_matadd_integer` is incorrect: Expected `MatrixExpr`, found `Unknown | Basic`
- sympy/matrices/inverse.py:393:19 error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MatrixBase | Expr`
+ sympy/matrices/inverse.py:383:13 error[unsupported-operator] Operator `*` is not supported between two objects of type `MatrixBase`
+ sympy/matrices/inverse.py:391:10 error[unsupported-operator] Operator `*` is not supported between two objects of type `MatrixBase`
- sympy/matrices/matrixbase.py:2955:13 error[unsupported-operator] Operator `*=` is not supported between objects of type `T1'return@call_highest_priority` and `Self@_eval_pow_by_cayley`
+ sympy/matrices/matrixbase.py:2955:13 error[unsupported-operator] Operator `*=` is not supported between two objects of type `Self@_eval_pow_by_cayley`
- sympy/matrices/matrixbase.py:2955:13 error[unsupported-operator] Operator `*=` is not supported between objects of type `T2'return@call_highest_priority` and `Self@_eval_pow_by_cayley`
- sympy/matrices/matrixbase.py:3942:30 error[invalid-argument-type] Argument to bound method `list.append` is incorrect: Expected `Self@berkowitz`, found `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/matrixbase.py:3954:26 error[unsupported-operator] Operator `*` is not supported between objects of type `int | MatrixBase` and `MatrixBase`
- sympy/matrices/matrixbase.py:4640:16 error[invalid-return-type] Return type does not match returned value: expected `Self@D`, found `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/matrixbase.py:4922:13 error[unsupported-operator] Operator `*=` is not supported between objects of type `T2'return@call_highest_priority` and `Self@analytic_func`
- sympy/matrices/matrixbase.py:5076:19 error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `Self@log`
+ sympy/matrices/matrixbase.py:5076:19 error[unsupported-operator] Operator `*` is not supported between two objects of type `Self@log`
- sympy/matrices/solvers.py:637:27 error[invalid-argument-type] Argument to bound method `MatrixBase.vstack` is incorrect: Argument type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Unknown` does not satisfy upper bound `MatrixBase` of type variable `Self`
- sympy/matrices/solvers.py:637:27 error[invalid-argument-type] Argument to bound method `MatrixBase.vstack` is incorrect: Expected `Tmat@_gauss_jordan_solve`, found `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Unknown`
- sympy/matrices/solvers.py:976:16 error[unresolved-attribute] Attribute `solve` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/solvers.py:976:16 error[invalid-return-type] Return type does not match returned value: expected `Tmat@_solve_least_squares`, found `MatrixBase`
- sympy/matrices/tests/test_decompositions.py:394:25 error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:395:25 error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:112:12 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:113:12 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:154:12 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:176:17 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:201:17 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:215:17 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:259:17 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:263:12 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:271:17 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:404:12 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:426:12 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:58:12 error[unresolved-attribute] Attribute `permute_rows` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:131:12 error[no-matching-overload] No overload of function `simplify` matches arguments
- sympy/matrices/tests/test_decompositions.py:356:23 error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:356:23 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:437:21 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:449:21 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:450:21 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:462:12 error[no-matching-overload] No overload of function `simplify` matches arguments
- sympy/matrices/tests/test_eigen.py:393:15 error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `ImmutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:443:26 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_eigen.py:320:14 error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:320:14 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_eigen.py:378:14 error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:378:14 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:202:12 error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
- sympy/matrices/tests/test_matrices.py:203:12 error[not-subscriptable] Cannot subscript object of type `Expr` with no `__getitem__` method
- sympy/matrices/tests/test_matrices.py:214:16 error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
- sympy/matrices/tests/test_matrices.py:215:16 error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
- sympy/matrices/tests/test_matrices.py:216:16 error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
- sympy/matrices/tests/test_matrices.py:217:16 error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
- sympy/matrices/tests/test_matrices.py:218:16 error[not-subscriptable] Cannot subscript object of type `Expr` with no `__getitem__` method
- sympy/matrices/tests/test_matrices.py:219:16 error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
- sympy/matrices/tests/test_matrices.py:2682:25 error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:3478:12 error[unresolved-attribute] Attribute `rank` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Unknown`
+ sympy/matrices/tests/test_matrices.py:985:12 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:1017:12 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:2555:21 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:2728:15 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:3034:12 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:1740:21 error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:1740:21 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:968:12 error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
- sympy/matrices/tests/test_matrixbase.py:969:12 error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
- sympy/matrices/tests/test_matrixbase.py:3386:25 error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:3388:16 error[unresolved-attribute] Attribute `H` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_matrixbase.py:3433:16 error[unresolved-attribute] Attribute `H` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_matrixbase.py:963:9 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrixbase.py:1746:12 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrixbase.py:1778:12 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:1149:16 error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrixbase.py:1149:16 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:2358:12 error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrixbase.py:2358:12 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:2366:12 error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrixbase.py:2366:12 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:2375:12 error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrixbase.py:2375:12 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_solvers.py:130:12 error[not-subscriptable] Cannot subscript object of type `Expr` with no `__getitem__` method
- sympy/matrices/tests/test_solvers.py:130:12 error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
- sympy/matrices/tests/test_solvers.py:130:12 error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
- sympy/matrices/tests/test_solvers.py:133:12 error[not-subscriptable] Cannot subscript object of type `Expr` with no `__getitem__` method
- sympy/matrices/tests/test_solvers.py:133:12 error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
- sympy/matrices/tests/test_solvers.py:342:25 error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_solvers.py:343:25 error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_solvers.py:90:9 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_solvers.py:117:9 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_solvers.py:189:9 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_solvers.py:201:12 error[no-matching-overload] No overload of function `simplify` matches arguments
- sympy/matrices/tests/test_solvers.py:315:12 error[unsupported-operator] Operator `*` is not supported between objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_solvers.py:315:12 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_sparse.py:92:12 error[not-subscriptable] Cannot subscript object of type `Expr` with no `__getitem__` method
- sympy/matrices/tests/test_sparse.py:93:12 error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
- sympy/matrices/tests/test_sparse.py:105:16 error[not-subscriptable] Cannot subscript object of type `Expr` with no `__getitem__` method
- sympy/matrices/tests/test_sparse.py:108:16 error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_sparse.py:381:12 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableSparseMatrix`
- sympy/matrices/tests/test_sparse.py:337:12 error[unresolved-attribute] Attribute `permute_rows` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_subspaces.py:48:35 error[not-iterable] Object of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr` is not iterable
+ sympy/matrices/tests/test_subspaces.py:48:35 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
- sympy/physics/mechanics/tests/test_kane.py:444:38 error[not-subscriptable] Cannot subscript object of type `Expr` with no `__getitem__` method
- sympy/physics/optics/gaussopt.py:137:26 error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
- sympy/physics/optics/gaussopt.py:757:25 error[unresolved-attribute] Attribute `is_infinite` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:758:21 error[unresolved-attribute] Attribute `is_infinite` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:760:21 error[unsupported-operator] Operator `+` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:760:21 error[unsupported-operator] Operator `+` is not supported between two objects of type `Basic | Unknown`
- sympy/physics/optics/gaussopt.py:838:41 error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:838:41 error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | Unknown`
- sympy/physics/optics/gaussopt.py:888:9 error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:888:9 error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | Unknown`
- sympy/physics/optics/tests/test_gaussopt.py:43:21 error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
- sympy/physics/quantum/cg.py:259:34 error[invalid-argument-type] Argument to constructor `Expr.__new__` is incorrect: Expected `Basic`, found `Basic | int | float | complex | Any`
+ sympy/physics/quantum/tests/test_represent.py:84:26 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/physics/quantum/tests/test_represent.py:94:40 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
- sympy/physics/vector/functions.py:381:21 error[invalid-argument-type] Argument to `list.__init__` is incorrect: Expected `Iterable[Unknown]`, found `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Unknown`
+ sympy/physics/vector/functions.py:381:21 error[invalid-argument-type] Argument to `list.__init__` is incorrect: Expected `Iterable[Unknown]`, found `MatrixBase`
- sympy/series/order.py:154:20 error[unresolved-attribute] Attribute `is_symbol` is not defined on `int`, `float`, `complex` in union `Unknown | Basic | int | float | complex`
- sympy/series/order.py:289:48 error[unsupported-operator] Operator `**` is not supported between objects of type `Basic | int | float | complex | Any` and `Basic`
+ sympy/series/order.py:289:48 error[unsupported-operator] Operator `**` is not supported between objects of type `Basic | Unknown` and `Basic`
- sympy/simplify/hyperexpand.py:1217:19 error[invalid-argument-type] Argument to `list.__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic | int | float | complex | Any`
+ sympy/simplify/hyperexpand.py:1217:19 error[invalid-argument-type] Argument to `list.__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic | Unknown`
- sympy/simplify/hyperexpand.py:1316:19 error[invalid-argument-type] Argument to `list.__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic | int | float | complex | Any`
+ sympy/simplify/hyperexpand.py:1316:19 error[invalid-argument-type] Argument to `list.__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic | Unknown`
- sympy/solvers/recurr.py:437:24 error[unresolved-attribute] Attribute `subs` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
+ sympy/solvers/tests/test_solvers.py:721:21 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/solvers/tests/test_solvers.py:729:27 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
- sympy/solvers/tests/test_solvers.py:723:19 error[unsupported-operator] Operator `-` is not supported between two objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/solvers/tests/test_solvers.py:723:19 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
- sympy/solvers/tests/test_solvers.py:725:19 error[unsupported-operator] Operator `-` is not supported between two objects of type `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
+ sympy/solvers/tests/test_solvers.py:725:19 error[unsupported-operator] Operator `*` is not supported between two objects of type `MutableDenseMatrix`
- sympy/stats/stochastic_process_types.py:1613:15 error[unresolved-attribute] Attribute `tolist` is not defined on `T2'return@call_highest_priority`, `T1'return@call_highest_priority`, `Expr` in union `T2'return@call_highest_priority | T1'return@call_highest_priority | MatrixBase | Expr`
- sympy/stats/symbolic_probability.py:533:55 error[unresolved-attribute] Attribute `expand` is not defined on `Basic` in union `Basic | Unknown`
+ sympy/stats/symbolic_probability.py:533:55 error[unresolved-attribute] Object of type `Basic` has no attribute `expand`
- sympy/utilities/codegen.py:974:32 error[not-iterable] Object of type `Buffer` is not iterable
- sympy/utilities/codegen.py:1476:27 error[not-iterable] Object of type `Buffer` is not iterable
- sympy/vector/tests/test_vector.py:108:12 error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
- sympy/vector/tests/test_vector.py:109:23 error[not-subscriptable] Cannot subscript object of type `Expr` with no `__getitem__` method
vision (https://github.com/pytorch/vision)
- test/datasets_utils.py:1045:18 error[invalid-assignment] Object of type `str` is not assignable to `tuple[str, ...]`
+ test/datasets_utils.py:1045:18 error[invalid-assignment] Object of type `LiteralString` is not assignable to `tuple[str, ...]`
werkzeug (https://github.com/pallets/werkzeug)
- src/werkzeug/_reloader.py:149:22 error[not-iterable] Object of type `Sized` is not iterable
- src/werkzeug/utils.py:506:43 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
xarray (https://github.com/pydata/xarray)
+ xarray/tests/test_plot.py:1637:20 error[unresolved-attribute] Object of type `_ScalarT@__init__` has no attribute `has_data`
+ xarray/tests/test_plot.py:1639:31 error[unresolved-attribute] Object of type `_ScalarT@__init__` has no attribute `get_ylabel`
+ xarray/tests/test_plot.py:1651:20 error[unresolved-attribute] Object of type `_ScalarT@__init__` has no attribute `has_data`
+ xarray/tests/test_plot.py:1653:31 error[unresolved-attribute] Object of type `_ScalarT@__init__` has no attribute `get_ylabel`
Merging this PR will degrade performance by 36%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| 👁 | Simulation | ty_check_file[cold] |
150.8 ms | 164 ms | -8.04% |
| 👁 | Simulation | ty_check_file[incremental] |
8 ms | 8.8 ms | -8.66% |
| 👁 | Simulation | DateType |
220.9 ms | 232.6 ms | -5.05% |
| 👁 | Simulation | attrs |
511.1 ms | 600.1 ms | -14.84% |
| 👁 | Simulation | hydra-zen |
1.1 s | 3.5 s | -68.1% |
| 👁 | Simulation | anyio |
1.2 s | 1.4 s | -12.85% |
| 👁 | WallTime | multithreaded |
1.1 s | 2.3 s | -52.46% |
| 👁 | WallTime | freqtrade |
8.2 s | 11.3 s | -28.08% |
| 👁 | WallTime | altair |
4.8 s | 7.5 s | -36.64% |
| 👁 | WallTime | pydantic |
7.9 s | 35.1 s | -77.51% |
| 👁 | Simulation | ty_micro[typevar_mapping_accumulation] |
319.5 ms | 1,217.1 ms | -73.75% |
| 👁 | Simulation | ty_micro[typevar_mapping_small_accumulations] |
181.9 ms | 211.6 ms | -14.04% |
| 🆕 | Simulation | ty_micro[pydantic_core_schema_dict] |
N/A | 420.3 ms | N/A |
| 👁 | Memory | ty_micro[typevar_mapping_accumulation] |
32.4 MB | 106 MB | -69.4% |
| 👁 | Memory | ty_micro[typevar_mapping_small_accumulations] |
15.3 MB | 16.4 MB | -6.77% |
| 🆕 | Memory | ty_micro[pydantic_core_schema_dict] |
N/A | 20.8 MB | N/A |
| 👁 | WallTime | tanjun |
3 s | 3.6 s | -17.78% |
| 👁 | WallTime | pandas |
64.3 s | 82.6 s | -22.08% |
| 👁 | WallTime | sympy |
74.3 s | 92.4 s | -19.64% |
| 👁 | WallTime | colour_science |
43.1 s | 52.2 s | -17.5% |
| ... | ... | ... | ... | ... | ... |
ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.
Comparing dcreager/spec-builder-constraint-set (486f853) with main (3856288)
b4b898d to
4f1d1df
Compare
I discovered this while looking into ecosystem timeouts on #24540. @AlexWaygood also found this while trying to bump our vendored typeshed. When solving a constraint set that contains multiple typevars, we sometimes try to substitute a nested typevar in a constraint multiple times, leading to an endless expansion. In #24540, we saw this with `streamlit`. Given constraints ``` Iterable[V_co] & int ≤ _T@list ArrowStreamExportable & str ≤ _T@list V_co = _T@list ``` Note that `V_co` is covariant, and `V_co = _T@list`, so we can substitute any lower bound of `_T@list` into `Iterable` in the first constraint. In particular, we can substitute `V_co = ArrowStreamExportable & str`, giving ``` Iterable[ArrowStreamExportable & str] & int ≤ _T@list ``` That gives us another lower bound for `_T@list`, which we can substitute again ``` Iterable[Iterable[ArrowStreamExportable & str] & int] & int ≤ _T@list ``` and on and on! To catch this, we now keep track of when a new derived constraint comes from a substitution. When walking paths in a constraint set, we do _not_ add a derived constraint if we already have some other constraint on the path that came from the same substitution. In the `streamlit` example, that means we will only substitute for `V_co` in the first constraint at most once per BDD path.
4f1d1df to
f677d97
Compare
f677d97 to
86a8963
Compare
8f9af08 to
b4eaa43
Compare
86a8963 to
a2c1bd0
Compare
I discovered this while looking into ecosystem timeouts on astral-sh/ruff#24540. @AlexWaygood also found this while trying to bump our vendored typeshed. When solving a constraint set that contains multiple typevars, we sometimes try to substitute a nested typevar in a constraint multiple times, leading to an endless expansion. In astral-sh/ruff#24540, we saw this with `streamlit`. Given constraints ``` Iterable[V_co] & int ≤ _T@list ArrowStreamExportable & str ≤ _T@list V_co = _T@list ``` Note that `V_co` is covariant, and `V_co = _T@list`, so we can substitute any lower bound of `_T@list` into `Iterable` in the first constraint. In particular, we can substitute `V_co = ArrowStreamExportable & str`, giving ``` Iterable[ArrowStreamExportable & str] & int ≤ _T@list ``` That gives us another lower bound for `_T@list`, which we can substitute again ``` Iterable[Iterable[ArrowStreamExportable & str] & int] & int ≤ _T@list ``` and on and on! To catch this, we now keep track of when a new derived constraint comes from a substitution. When walking paths in a constraint set, we do _not_ add a derived constraint if we already have some other constraint on the path that came from the same substitution. In the `streamlit` example, that means we will only substitute for `V_co` in the first constraint at most once per BDD path.
a472de9 to
94469c6
Compare
|
I'm going ahead and marking this as ready for review.
|
|
|
||
| reveal_type(flatten("abc", (1, 2, 3))) # revealed: list[str | int] | ||
| # TODO: we could have `Literal["a", "b", "c"]` instead of `str` here | ||
| reveal_type(flatten_covariant("abc", (1, 2, 3))) # revealed: tuple[str | Literal[1, 2, 3], ...] | ||
| reveal_type(flatten("abc", (1, 2, 3))) # revealed: list[LiteralString | int] | ||
| reveal_type(flatten_covariant("abc", (1, 2, 3))) # revealed: tuple[LiteralString | Literal[1, 2, 3], ...] | ||
|
|
||
| def literal_string_case(literal_string: LiteralString): | ||
| reveal_type(flatten(literal_string, (1, 2, 3))) # revealed: list[str | int] | ||
| reveal_type(flatten(literal_string, (1, 2, 3))) # revealed: list[LiteralString | int] |
There was a problem hiding this comment.
I think I understand why does the type gets updated to LiteralString here shouldn't we still keep inferring list[str | int] in the following example:
def _(s: str) -> None:
# this reveals `list[LiteralString | int]` on this branch
reveal_type(flatten(s, (1, 2, 3)))There was a problem hiding this comment.
Ooh nice. I tracked this down to the overloads of str.__iter__, which includes:
@overload
def __iter__(self: LiteralString) -> Iterator[LiteralString]:This adds LiteralString ≤ FlatT to the constraint set that we construct for this example. We should see that self is str, which is not assignable to LiteralString, and not consider this overload selectable when building up the constraint set. I've added this as a TODO to tackle in follow-on work.
There was a problem hiding this comment.
This is related to @charliermarsh 's PR #24707 -- though I'm not sure without looking more closely whether that PR alone will fix this, or we will need to do this separately in the generics solver.
There was a problem hiding this comment.
I left a fix in here, though unsure if it belongs there: https://github.com/astral-sh/ruff/pull/24707/changes#r3309837520
| let db = self.db; | ||
| let constraints = self.constraints; | ||
| let combined = actual_callable | ||
| .signatures(db) | ||
| .overloads | ||
| .iter() | ||
| .filter_map(|actual_signature| { | ||
| let when = actual_signature.when_constraint_set_assignable_to_signatures( | ||
| db, | ||
| formal_signature, | ||
| constraints, | ||
| ); | ||
| self.add_type_mappings_from_constraint_set(when) | ||
| .ok() | ||
| .map(|()| when) | ||
| }) | ||
| .reduce(|lhs, rhs| lhs.or(db, constraints, || rhs)); |
There was a problem hiding this comment.
Is this the thing that we talked about earlier where the overloads themselves would be ord with each other which will in turn help pick the correct overload when ParamSpec are involved?
Aside, I think the comment at the start of this else branch might require updating now.
There was a problem hiding this comment.
Yes, though there's still a bit of transitional logic here. We were doing an or in spirit before, by returning Err if none of the overloads were individually satisfiable — where individual satisfiability was determined by whether we added any bindings via the old solver.
We now combine all of the per-overload constraint sets using or, which is what we will want in the end. But to stay close to the current behavior for now, we're still filter the overloads to remove ones that aren't individually satisfiable according to the old solver. Down the line, as part of removing the old solver's types field, we'll update this to check individual satisfiability by making sure that each per-overload constraint set is not never.
| for (identity, variable) in generic_context.variables_inner(self.db) { | ||
| if types.contains_key(identity) { | ||
| continue; | ||
| } | ||
|
|
||
| if let Some(mapped_ty) = self.types.get(identity).copied() | ||
| && (mapped_ty.is_never() | ||
| || (mapped_ty == Type::object() | ||
| && variable.variance(self.db).is_contravariant())) | ||
| { | ||
| types.insert(*identity, mapped_ty); | ||
| } | ||
| } |
There was a problem hiding this comment.
Is this some kind of special casing during the transition phase? I'm not able to follow in what scenario will there be no solution for these typevars if it's mapped to Never or object.
There was a problem hiding this comment.
This is related to #22400. In a constraint set, we are currently storing each individual constraint as lower ≤ T ≤ upper. That is, every constraint must have both a lower and an upper bound. If you really only want to create an upper bound, we use Never as the lower bound. But that means that we can't distinguish between "no lower bound" and "a lower bound of Never". That doesn't affect the set of solutions you'd get from the constraint set, but does affect the heuristics we want to use to choose one of those solutions. (In the first case, we want to ignore the Never, and in the second case, we probably want to use it.)
So for now, we assume that "ignore it" is the more likely thing we want to do.
There was a problem hiding this comment.
Ah I see, thanks for explaining. It might be useful to add a note / TODO comment.
| // TODO: This is a solution-level projection. A more principled version would live in the | ||
| // constraint-set solution extraction layer, taking an explicit domain of typevars to solve | ||
| // for and existentially quantifying away the other typevars in that domain. | ||
| if self.can_remove_inferable_typevar_artifacts(generic_context) { |
There was a problem hiding this comment.
This is for the "Generic callable chains" example in call/function.md, right?
There was a problem hiding this comment.
Yes that's right. I added a comment pointing at the test
baa79f1 to
d69a1b8
Compare
d69a1b8 to
84ef6bc
Compare
84ef6bc to
4e0e8dc
Compare
4e0e8dc to
a773c61
Compare
|
The microbenchmark timeout was largely due to me having reverted the |
a773c61 to
486f853
Compare
In the interests of getting this landed, I plan on merging this if CI is still green after the latest review updates. If others want to review further, I can tackle any additional suggestions as follow-on work. |
…stral-sh#24540) This PR implements the bulk of the logic needed for astral-sh/ty#2799, by building up a `ConstraintSet` in `SpecializationBuilder`. This constraint set holds the "pending state" of the specialization being inferred. It will eventually _replace_ the `types` hash map, which stores a simple mapping from typevars to inferred types, and which is always updated by unioning together types when we find multiple solutions for a typevar. For now, we are building up both pending state representations, and solving from the constraint set where we can. There are two main cases where we must fall back on the old solver: - Any specialization that involves a `ParamSpec` - If the constraint set returns `Unsatisfiable` or `Unconstrained` Follow-on PRs will address these remaining cases that use the old solver; once they are all migrated over to the constraint set solver, we will remove the `types` field. Closes astral-sh/ty#2572 Closes astral-sh/ty#2959 Closes astral-sh/ty#3037 Closes astral-sh/ty#3203 Closes astral-sh/ty#3228 Closes astral-sh/ty#3428 Closes astral-sh/ty#3483
This PR implements the bulk of the logic needed for astral-sh/ty#2799, by building up a
ConstraintSetinSpecializationBuilder. This constraint set holds the "pending state" of the specialization being inferred. It will eventually replace thetypeshash map, which stores a simple mapping from typevars to inferred types, and which is always updated by unioning together types when we find multiple solutions for a typevar.For now, we are building up both pending state representations, and solving from the constraint set where we can. There are two main cases where we must fall back on the old solver:
ParamSpecUnsatisfiableorUnconstrainedFollow-on PRs will address these remaining cases that use the old solver; once they are all migrated over to the constraint set solver, we will remove the
typesfield.Closes astral-sh/ty#2572
Closes astral-sh/ty#2959
Closes astral-sh/ty#3037
Closes astral-sh/ty#3203
Closes astral-sh/ty#3228
Closes astral-sh/ty#3428
Closes astral-sh/ty#3483