Skip to content

[ty] Preserve bounded typevar identity during member lookup#23471

Draft
Hugo-Polloli wants to merge 1 commit intoastral-sh:mainfrom
Hugo-Polloli:bound-method-union-typevar
Draft

[ty] Preserve bounded typevar identity during member lookup#23471
Hugo-Polloli wants to merge 1 commit intoastral-sh:mainfrom
Hugo-Polloli:bound-method-union-typevar

Conversation

@Hugo-Polloli
Copy link
Copy Markdown
Contributor

@Hugo-Polloli Hugo-Polloli commented Feb 21, 2026

Summary

Shared method lookup on bounded type variables was not preserving one coherent receiver occurrence.
On main, that showed up in a few ways:

  • x.call_me() and type(x).call_me(x) could fail for T: A | B even when both bound variants define the method
  • x.call_me.__self__ lost bound-method semantics on the narrowed path
  • returns like T | None could degrade to A | B | None

Fixes astral-sh/ty#2585

This PR fixes that by resolving member lookup per viable bound arm, while preserving the original bounded typevar occurrence on the resulting method object. Bound methods now keep the exposed __self__ separately from the narrower receiver used for call binding, so attribute access still sees the original T while calls and returns stay correlated per arm. The same member-lookup handling also applies after narrowing shapes like T & ~None.

Explicit self-typed overloads still reject unsupported receivers, and methods that are missing from some bound variants still report possibly-missing-attribute.

Test Plan

  • T = TypeVar(..., bound=A | B): x.call_me() succeeds and preserves a union of per-arm return types
  • T = TypeVar(..., bound=A | B): type(x).call_me(x) succeeds
  • T = TypeVar(..., bound=A | B): x.call_me.__self__ reveals the original bounded typevar occurrence, and x.call_me.__func__ still resolves correctly
  • T = TypeVar(..., bound=A | B): return x.maybe() stays assignable to T | None when each bound arm returns its own receiver type
  • T = TypeVar(..., bound=list[Any] | None): narrowing away None makes x.append(...) resolve cleanly
  • T = TypeVar(..., bound=C | D): calling a method present on only one variant still reports possibly-missing-attribute
  • explicit self-typed overloads still report no-matching-overload for unsupported bounded and constrained receivers
  • the constrained-typevar union-call diagnostic case still reports only the real incompatible-argument error

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot bot commented Feb 21, 2026

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 87.90%. The percentage of expected errors that received a diagnostic held steady at 83.08%. The number of fully passing files held steady at 78/133.

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot bot commented Feb 21, 2026

mypy_primer results

Changes were detected when running on open source projects
pip (https://github.com/pypa/pip)
- src/pip/_vendor/rich/progress.py:294:16: error[invalid-argument-type] Argument to bound method `__enter__` is incorrect: Expected `TextIO`, found `_I@_ReadContext`
- src/pip/_vendor/rich/progress.py:294:16: error[invalid-argument-type] Argument to bound method `__enter__` is incorrect: Expected `BinaryIO`, found `_I@_ReadContext`
- Found 631 diagnostics
+ Found 629 diagnostics

spack (https://github.com/spack/spack)
- lib/spack/spack/detection/path.py:169:33: error[invalid-argument-type] Argument to function `dedupe_paths` is incorrect: Expected `list[str]`, found `Unknown | list[str | bytes | PathLike[str] | ... omitted 3 union elements]`
+ lib/spack/spack/detection/path.py:169:33: error[invalid-argument-type] Argument to function `dedupe_paths` is incorrect: Expected `list[str]`, found `Unknown | list[bytes | PathLike[str] | PathLike[bytes] | ... omitted 3 union elements]`
- lib/spack/spack/vendor/markupsafe/__init__.py:248:13: error[invalid-assignment] Invalid subscript assignment with key of type `Any` and value of type `Markup` on object of type `_ListOrDict@_escape_argspec`
- lib/spack/spack/verify_libraries.py:164:46: error[invalid-argument-type] Argument to function `candidate_matches` is incorrect: Expected `bytes`, found `bytes | Unknown | str | PathLike[str] | PathLike[bytes]`
+ lib/spack/spack/verify_libraries.py:164:46: error[invalid-argument-type] Argument to function `candidate_matches` is incorrect: Expected `bytes`, found `Unknown | bytes | str | PathLike[str] | PathLike[bytes]`
- lib/spack/spack/verify_libraries.py:165:17: error[invalid-assignment] Invalid subscript assignment with key of type `bytes | Unknown | str | PathLike[str] | PathLike[bytes]` and value of type `bytes | Unknown | str | PathLike[str] | PathLike[bytes]` on object of type `dict[bytes, bytes]`
+ lib/spack/spack/verify_libraries.py:165:17: error[invalid-assignment] Invalid subscript assignment with key of type `Unknown | bytes | str | PathLike[str] | PathLike[bytes]` and value of type `Unknown | bytes | str | PathLike[str] | PathLike[bytes]` on object of type `dict[bytes, bytes]`
- lib/spack/spack/verify_libraries.py:170:57: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `list[bytes]`, found `list[bytes | Unknown | str | PathLike[str] | PathLike[bytes]]`
+ lib/spack/spack/verify_libraries.py:170:57: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `list[bytes]`, found `list[Unknown | bytes | str | PathLike[str] | PathLike[bytes]]`
- lib/spack/spack/verify_libraries.py:170:69: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `list[bytes]`, found `list[bytes | Unknown | str | PathLike[str] | PathLike[bytes]]`
+ lib/spack/spack/verify_libraries.py:170:69: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `list[bytes]`, found `list[Unknown | bytes | str | PathLike[str] | PathLike[bytes]]`
- Found 4386 diagnostics
+ Found 4385 diagnostics

scrapy (https://github.com/scrapy/scrapy)
- scrapy/http/headers.py:45:30: error[invalid-argument-type] Argument to bound method `title` is incorrect: Expected `bytes`, found `AnyStr@normkey`
- scrapy/http/headers.py:45:30: error[no-matching-overload] No overload of bound method `title` matches arguments
- scrapy/utils/datatypes.py:76:16: error[invalid-argument-type] Argument to bound method `lower` is incorrect: Expected `bytes`, found `AnyStr@normkey`
- scrapy/utils/datatypes.py:76:16: error[invalid-return-type] Return type does not match returned value: expected `AnyStr@normkey`, found `Unknown | bytes`
+ scrapy/utils/datatypes.py:76:16: error[invalid-return-type] Return type does not match returned value: expected `AnyStr@normkey`, found `str | bytes`
- scrapy/utils/datatypes.py:76:16: error[no-matching-overload] No overload of bound method `lower` matches arguments
- scrapy/utils/datatypes.py:113:47: error[invalid-argument-type] Argument to bound method `lower` is incorrect: Expected `bytes`, found `AnyStr@__getitem__`
- scrapy/utils/datatypes.py:113:47: error[no-matching-overload] No overload of bound method `lower` matches arguments
- scrapy/utils/datatypes.py:118:36: error[invalid-argument-type] Argument to bound method `lower` is incorrect: Expected `bytes`, found `AnyStr@__setitem__`
- scrapy/utils/datatypes.py:118:36: error[no-matching-overload] No overload of bound method `lower` matches arguments
- scrapy/utils/datatypes.py:123:20: error[invalid-argument-type] Argument to bound method `lower` is incorrect: Expected `bytes`, found `AnyStr@__setitem__`
- scrapy/utils/datatypes.py:123:20: error[no-matching-overload] No overload of bound method `lower` matches arguments
- scrapy/utils/datatypes.py:127:37: error[invalid-argument-type] Argument to bound method `lower` is incorrect: Expected `bytes`, found `AnyStr@__delitem__`
- scrapy/utils/datatypes.py:127:37: error[no-matching-overload] No overload of bound method `lower` matches arguments
- scrapy/utils/datatypes.py:132:16: error[invalid-argument-type] Argument to bound method `lower` is incorrect: Expected `bytes`, found `AnyStr@__contains__`
- scrapy/utils/datatypes.py:132:16: error[no-matching-overload] No overload of bound method `lower` matches arguments
- Found 1779 diagnostics
+ Found 1765 diagnostics

pylint (https://github.com/pycqa/pylint)
- pylint/checkers/unicode.py:175:39: error[invalid-argument-type] Argument to bound method `endswith` is incorrect: Expected `str`, found `_StrLike@_map_positions_to_result`
- pylint/checkers/unicode.py:175:39: error[invalid-argument-type] Argument to bound method `endswith` is incorrect: Expected `bytes`, found `_StrLike@_map_positions_to_result`
- pylint/checkers/unicode.py:181:15: error[invalid-argument-type] Argument to bound method `find` is incorrect: Expected `str`, found `_StrLike@_map_positions_to_result`
- pylint/checkers/unicode.py:181:15: error[invalid-argument-type] Argument to bound method `find` is incorrect: Expected `bytes`, found `_StrLike@_map_positions_to_result`
- pylint/checkers/unicode.py:188:19: error[invalid-argument-type] Argument to bound method `find` is incorrect: Expected `str`, found `_StrLike@_map_positions_to_result`
- pylint/checkers/unicode.py:188:19: error[invalid-argument-type] Argument to bound method `find` is incorrect: Expected `bytes`, found `_StrLike@_map_positions_to_result`
- Found 220 diagnostics
+ Found 214 diagnostics

rich (https://github.com/Textualize/rich)
- rich/progress.py:294:16: error[invalid-argument-type] Argument to bound method `__enter__` is incorrect: Expected `TextIO`, found `_I@_ReadContext`
- rich/progress.py:294:16: error[invalid-argument-type] Argument to bound method `__enter__` is incorrect: Expected `BinaryIO`, found `_I@_ReadContext`
- Found 354 diagnostics
+ Found 352 diagnostics

porcupine (https://github.com/Akuli/porcupine)
- porcupine/pluginmanager.py:133:49: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[Never]`, found `Unknown | str`
- Found 25 diagnostics
+ Found 24 diagnostics

vision (https://github.com/pytorch/vision)
- test/test_transforms_v2.py:1551:49: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
+ test/test_transforms_v2.py:1551:49: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
- test/test_transforms_v2.py:1551:49: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
+ test/test_transforms_v2.py:1551:49: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
- test/test_transforms_v2.py:1551:49: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
+ test/test_transforms_v2.py:1551:49: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
- test/test_transforms_v2.py:1551:49: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `InterpolationMode | int`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
+ test/test_transforms_v2.py:1551:49: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `InterpolationMode | int`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
- test/test_transforms_v2.py:1551:49: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `list[int | float] | None`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
+ test/test_transforms_v2.py:1551:49: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `list[int | float] | None`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
- test/test_transforms_v2.py:1605:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
+ test/test_transforms_v2.py:1605:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
- test/test_transforms_v2.py:1605:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
+ test/test_transforms_v2.py:1605:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
- test/test_transforms_v2.py:1605:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
+ test/test_transforms_v2.py:1605:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
- test/test_transforms_v2.py:1692:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
+ test/test_transforms_v2.py:1692:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
- test/test_transforms_v2.py:1692:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
+ test/test_transforms_v2.py:1692:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
- test/test_transforms_v2.py:1692:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
+ test/test_transforms_v2.py:1692:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
- test/test_transforms_v2.py:1692:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `InterpolationMode | int`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
+ test/test_transforms_v2.py:1692:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `InterpolationMode | int`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
- test/test_transforms_v2.py:1747:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
+ test/test_transforms_v2.py:1747:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Number | Sequence[Unknown]`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
- test/test_transforms_v2.py:1747:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
+ test/test_transforms_v2.py:1747:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
- test/test_transforms_v2.py:1747:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
+ test/test_transforms_v2.py:1747:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Sequence[int | float] | None`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`
- test/test_transforms_v2.py:1747:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `InterpolationMode | int`, found `Unknown | tuple[int, int, int, int] | int | tuple[int | float, int | float]`
+ test/test_transforms_v2.py:1747:45: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `InterpolationMode | int`, found `Unknown | int | tuple[int | float, int | float] | tuple[int, int, int, int]`

Expression (https://github.com/cognitedata/Expression)
+ tests/test_compose.py:21:16: error[invalid-assignment] Object of type `(Never, /) -> Never` is not assignable to `(int, /) -> int`
- Found 204 diagnostics
+ Found 205 diagnostics

operator (https://github.com/canonical/operator)
- ops/pebble.py:567:19: error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> LiteralString, (key: SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str]) | (Overload[(key: SupportsIndex, /) -> int, (key: slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> bytes])` cannot be called with key of type `slice[Any, Any, Any]` on object of type `AnyStr@ExecError`
- Found 127 diagnostics
+ Found 126 diagnostics

koda-validate (https://github.com/keithasaurus/koda-validate)
- koda_validate/generic.py:290:16: error[invalid-argument-type] Argument to bound method `startswith` is incorrect: Expected `str`, found `StrOrBytes@StartsWith`
- koda_validate/generic.py:290:16: error[invalid-argument-type] Argument to bound method `startswith` is incorrect: Expected `bytes`, found `StrOrBytes@StartsWith`
- koda_validate/generic.py:298:16: error[invalid-argument-type] Argument to bound method `endswith` is incorrect: Expected `str`, found `StrOrBytes@EndsWith`
- koda_validate/generic.py:298:16: error[invalid-argument-type] Argument to bound method `endswith` is incorrect: Expected `bytes`, found `StrOrBytes@EndsWith`
- koda_validate/generic.py:312:20: error[invalid-argument-type] Argument to bound method `strip` is incorrect: Expected `bytes`, found `StrOrBytes@NotBlank`
- koda_validate/generic.py:312:20: error[no-matching-overload] No overload of bound method `strip` matches arguments
- koda_validate/generic.py:321:16: error[invalid-argument-type] Argument to bound method `strip` is incorrect: Expected `bytes`, found `StrOrBytes@Strip`
- koda_validate/generic.py:321:16: error[invalid-return-type] Return type does not match returned value: expected `StrOrBytes@Strip`, found `Unknown | bytes`
+ koda_validate/generic.py:321:16: error[invalid-return-type] Return type does not match returned value: expected `StrOrBytes@Strip`, found `str | bytes`
- koda_validate/generic.py:321:16: error[no-matching-overload] No overload of bound method `strip` matches arguments
- koda_validate/generic.py:330:16: error[invalid-argument-type] Argument to bound method `upper` is incorrect: Expected `bytes`, found `StrOrBytes@UpperCase`
- koda_validate/generic.py:330:16: error[invalid-return-type] Return type does not match returned value: expected `StrOrBytes@UpperCase`, found `Unknown | bytes`
+ koda_validate/generic.py:330:16: error[invalid-return-type] Return type does not match returned value: expected `StrOrBytes@UpperCase`, found `str | bytes`
- koda_validate/generic.py:330:16: error[no-matching-overload] No overload of bound method `upper` matches arguments
- koda_validate/generic.py:336:16: error[invalid-argument-type] Argument to bound method `lower` is incorrect: Expected `bytes`, found `StrOrBytes@LowerCase`
- koda_validate/generic.py:336:16: error[invalid-return-type] Return type does not match returned value: expected `StrOrBytes@LowerCase`, found `Unknown | bytes`
+ koda_validate/generic.py:336:16: error[invalid-return-type] Return type does not match returned value: expected `StrOrBytes@LowerCase`, found `str | bytes`
- koda_validate/generic.py:336:16: error[no-matching-overload] No overload of bound method `lower` matches arguments
- Found 424 diagnostics
+ Found 412 diagnostics

discord.py (https://github.com/Rapptz/discord.py)
- discord/ext/commands/core.py:921:23: error[invalid-argument-type] Argument to bound method `cog_before_invoke` is incorrect: Expected `Cog`, found `CogT@Command`
- discord/ext/commands/core.py:941:23: error[invalid-argument-type] Argument to bound method `cog_after_invoke` is incorrect: Expected `Cog`, found `CogT@Command`
- Found 538 diagnostics
+ Found 536 diagnostics

cloud-init (https://github.com/canonical/cloud-init)
- tests/unittests/distros/test_user_data_normalize.py:24:31: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[Unknown, Unknown]`, found `Unknown | bool | list[Unknown] | ... omitted 3 union elements`
+ tests/unittests/distros/test_user_data_normalize.py:24:31: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[Unknown, Unknown]`, found `Unknown | dict[Unknown | str, Unknown | str] | str | ... omitted 3 union elements`
- tests/unittests/sources/test_gce.py:71:31: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[Unknown, Unknown]`, found `Unknown | bool | list[Unknown] | ... omitted 3 union elements`
+ tests/unittests/sources/test_gce.py:71:31: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[Unknown, Unknown]`, found `Unknown | dict[Unknown | str, Unknown | str] | str | ... omitted 3 union elements`

xarray (https://github.com/pydata/xarray)
- xarray/computation/rolling.py:199:9: error[unsupported-operator] Operator `/=` is not supported between objects of type `T_Xarray@Rolling` and `Unknown`
- xarray/core/coordinates.py:1214:69: error[invalid-argument-type] Method `__getitem__` of type `(bound method T_Xarray@assert_coordinate_consistent.__getitem__(key: Any) -> T_Xarray@assert_coordinate_consistent) | (Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_Xarray@assert_coordinate_consistent])` cannot be called with key of type `Unknown` on object of type `T_Xarray@assert_coordinate_consistent`
- xarray/core/coordinates.py:1217:51: error[invalid-argument-type] Method `__getitem__` of type `(bound method T_Xarray@assert_coordinate_consistent.__getitem__(key: Any) -> T_Xarray@assert_coordinate_consistent) | (Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_Xarray@assert_coordinate_consistent])` cannot be called with key of type `Unknown` on object of type `T_Xarray@assert_coordinate_consistent`
- xarray/core/groupby.py:687:25: error[invalid-argument-type] Argument to bound method `transpose` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:687:25: error[invalid-argument-type] Argument to bound method `transpose` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/groupby.py:711:27: error[invalid-argument-type] Argument to bound method `isel` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:711:27: error[invalid-argument-type] Argument to bound method `isel` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/groupby.py:769:22: error[invalid-argument-type] Argument to bound method `_to_temp_dataset` is incorrect: Expected `DataArray`, found `T_Xarray@GroupBy`
- xarray/core/groupby.py:775:20: error[invalid-argument-type] Argument to bound method `_shuffle` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:775:20: error[invalid-argument-type] Argument to bound method `_shuffle` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/groupby.py:780:20: error[invalid-argument-type] Argument to bound method `_from_temp_dataset` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:842:16: error[invalid-argument-type] Argument to bound method `isel` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:842:16: error[invalid-argument-type] Argument to bound method `isel` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/groupby.py:870:23: error[invalid-argument-type] Argument to bound method `isel` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:870:23: error[invalid-argument-type] Argument to bound method `isel` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/groupby.py:962:24: error[invalid-argument-type] Method `__getitem__` of type `(bound method T_Xarray@GroupBy.__getitem__(key: Any) -> T_Xarray@GroupBy) | (Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_Xarray@GroupBy])` cannot be called with key of type `Unknown` on object of type `T_Xarray@GroupBy`
- xarray/core/groupby.py:963:35: error[invalid-argument-type] Method `__getitem__` of type `(bound method T_Xarray@GroupBy.__getitem__(key: Any) -> T_Xarray@GroupBy) | (Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_Xarray@GroupBy])` cannot be called with key of type `Unknown` on object of type `T_Xarray@GroupBy`
- xarray/core/groupby.py:1139:13: error[invalid-argument-type] Argument to bound method `drop_vars` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:1139:13: error[invalid-argument-type] Argument to bound method `drop_vars` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/resample.py:107:16: error[invalid-argument-type] Argument to bound method `drop_vars` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/resample.py:107:16: error[invalid-argument-type] Argument to bound method `drop_vars` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/resample.py:129:23: error[invalid-argument-type] Argument to bound method `drop_vars` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/resample.py:129:23: error[invalid-argument-type] Argument to bound method `drop_vars` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/resample.py:151:16: error[invalid-argument-type] Argument to bound method `reindex` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/resample.py:151:16: error[invalid-argument-type] Argument to bound method `reindex` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/resample.py:178:16: error[invalid-argument-type] Argument to bound method `reindex` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/resample.py:178:16: error[invalid-argument-type] Argument to bound method `reindex` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/resample.py:206:16: error[invalid-argument-type] Argument to bound method `reindex` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/resample.py:206:16: error[invalid-argument-type] Argument to bound method `reindex` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/resample.py:245:16: error[invalid-argument-type] Argument to bound method `interp` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/resample.py:245:16: error[invalid-argument-type] Argument to bound method `interp` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/plot/facetgrid.py:172:43: error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:173:43: error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:184:24: error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:185:24: error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:200:26: error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:231:26: error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:232:26: error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:236:44: error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:760:48: error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:760:62: error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:761:17: error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:861:38: error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Any` on object of type `T_DataArrayOrSet@FacetGrid`
- Found 1714 diagnostics
+ Found 1671 diagnostics

setuptools (https://github.com/pypa/setuptools)
- setuptools/_distutils/util.py:154:43: error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> LiteralString, (key: SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str]) | (Overload[(key: SupportsIndex, /) -> int, (key: slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> bytes])` cannot be called with key of type `slice[Literal[1], None, None]` on object of type `AnyStr@change_root`
- Found 1121 diagnostics
+ Found 1120 diagnostics

altair (https://github.com/vega/altair)
- altair/datasets/_reader.py:335:16: error[invalid-argument-type] Argument to bound method `lazy` is incorrect: Argument type `IntoFrameT@Reader` does not satisfy upper bound `LazyFrame[LazyFrameT@LazyFrame]` of type variable `Self`
- Found 1081 diagnostics
+ Found 1080 diagnostics

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/templating.py:216:36: error[invalid-assignment] Object of type `str | Unknown` is not assignable to `T@apply_values`
+ src/prefect/utilities/templating.py:216:36: error[invalid-assignment] Object of type `str` is not assignable to `T@apply_values`
- src/prefect/utilities/templating.py:216:36: error[no-matching-overload] No overload of bound method `replace` matches arguments
- src/prefect/utilities/templating.py:218:32: error[invalid-assignment] Object of type `str | Unknown` is not assignable to `T@apply_values`
+ src/prefect/utilities/templating.py:218:32: error[invalid-assignment] Object of type `str` is not assignable to `T@apply_values`
- src/prefect/utilities/templating.py:218:32: error[no-matching-overload] No overload of bound method `replace` matches arguments
- src/prefect/utilities/templating.py:451:36: error[invalid-assignment] Object of type `str | Unknown` is not assignable to `T@resolve_variables`
+ src/prefect/utilities/templating.py:451:36: error[invalid-assignment] Object of type `str` is not assignable to `T@resolve_variables`
- src/prefect/utilities/templating.py:451:36: error[no-matching-overload] No overload of bound method `replace` matches arguments
- src/prefect/utilities/templating.py:453:36: error[invalid-assignment] Object of type `str | Unknown` is not assignable to `T@resolve_variables`
+ src/prefect/utilities/templating.py:453:36: error[invalid-assignment] Object of type `str` is not assignable to `T@resolve_variables`
- src/prefect/utilities/templating.py:453:36: error[no-matching-overload] No overload of bound method `replace` matches arguments
- Found 5785 diagnostics
+ Found 5781 diagnostics

scikit-build-core (https://github.com/scikit-build/scikit-build-core)
- src/scikit_build_core/build/wheel.py:99:20: error[no-matching-overload] No overload of bound method `__init__` matches arguments
- Found 58 diagnostics
+ Found 57 diagnostics

pwndbg (https://github.com/pwndbg/pwndbg)
- pwndbg/aglib/heap/ptmalloc.py:1109:24: error[invalid-argument-type] Method `__getitem__` of type `(bound method TheValue@GlibcMemoryAllocator.__getitem__(idx: int | str) -> Value) | (bound method TheValue@GlibcMemoryAllocator.__getitem__(key: str) -> Value)` cannot be called with key of type `Literal["tcache_small_bins"]` on object of type `TheValue@GlibcMemoryAllocator`
- pwndbg/aglib/heap/ptmalloc.py:1111:24: error[invalid-argument-type] Method `__getitem__` of type `(bound method TheValue@GlibcMemoryAllocator.__getitem__(idx: int | str) -> Value) | (bound method TheValue@GlibcMemoryAllocator.__getitem__(key: str) -> Value)` cannot be called with key of type `Literal["tcache_bins"]` on object of type `TheValue@GlibcMemoryAllocator`
- pwndbg/aglib/heap/ptmalloc.py:1202:74: error[invalid-argument-type] Argument to bound method `keys` is incorrect: Expected `Type`, found `TheType@GlibcMemoryAllocator`
- pwndbg/aglib/heap/ptmalloc.py:1211:16: error[invalid-argument-type] Argument to bound method `keys` is incorrect: Expected `Type`, found `TheType@GlibcMemoryAllocator`
- pwndbg/aglib/heap/ptmalloc.py:1279:22: error[invalid-argument-type] Method `__getitem__` of type `(bound method TheValue@GlibcMemoryAllocator.__getitem__(idx: int | str) -> Value) | (bound method TheValue@GlibcMemoryAllocator.__getitem__(key: str) -> Value)` cannot be called with key of type `Literal["num_slots"]` on object of type `TheValue@GlibcMemoryAllocator`
- pwndbg/aglib/heap/ptmalloc.py:1281:22: error[invalid-argument-type] Method `__getitem__` of type `(bound method TheValue@GlibcMemoryAllocator.__getitem__(idx: int | str) -> Value) | (bound method TheValue@GlibcMemoryAllocator.__getitem__(key: str) -> Value)` cannot be called with key of type `Literal["counts"]` on object of type `TheValue@GlibcMemoryAllocator`
- pwndbg/aglib/heap/ptmalloc.py:1282:19: error[invalid-argument-type] Method `__getitem__` of type `(bound method TheValue@GlibcMemoryAllocator.__getitem__(idx: int | str) -> Value) | (bound method TheValue@GlibcMemoryAllocator.__getitem__(key: str) -> Value)` cannot be called with key of type `Literal["entries"]` on object of type `TheValue@GlibcMemoryAllocator`
- pwndbg/aglib/heap/ptmalloc.py:1301:48: error[invalid-argument-type] Method `__getitem__` of type `(bound method TheValue@GlibcMemoryAllocator.__getitem__(idx: int | str) -> Value) | (bound method TheValue@GlibcMemoryAllocator.__getitem__(key: str) -> Value)` cannot be called with key of type `Literal["tcache_count"]` on object of type `TheValue@GlibcMemoryAllocator`
- Found 1870 diagnostics
+ Found 1862 diagnostics

dd-trace-py (https://github.com/DataDog/dd-trace-py)
- tests/tracer/test_span.py:193:29: error[invalid-argument-type] Argument to bound method `set_metric` is incorrect: Expected `int | float`, found `Unknown | None | dict[Unknown, Unknown] | ... omitted 6 union elements`
+ tests/tracer/test_span.py:193:29: error[invalid-argument-type] Argument to bound method `set_metric` is incorrect: Expected `int | float`, found `int | Unknown | None | ... omitted 6 union elements`

aiohttp (https://github.com/aio-libs/aiohttp)
- aiohttp/client.py:1539:15: error[invalid-argument-type] Argument to bound method `__aexit__` is incorrect: Expected `ClientResponse`, found `_RetType_co@_BaseRequestContextManager`
- aiohttp/client.py:1539:15: error[invalid-argument-type] Argument to bound method `__aexit__` is incorrect: Argument type `_RetType_co@_BaseRequestContextManager` does not satisfy upper bound `ClientWebSocketResponse[_DecodeText@ClientWebSocketResponse]` of type variable `Self`
- Found 194 diagnostics
+ Found 192 diagnostics

bokeh (https://github.com/bokeh/bokeh)
- src/bokeh/layouts.py:670:16: error[invalid-return-type] Return type does not match returned value: expected `list[L@_parse_children_arg]`, found `list[L@_parse_children_arg | list[L@_parse_children_arg]]`
+ src/bokeh/layouts.py:670:21: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[L@_parse_children_arg]`, found `tuple[L@_parse_children_arg | list[L@_parse_children_arg], ...]`

ibis (https://github.com/ibis-project/ibis)
- ibis/selectors.py:333:16: error[invalid-return-type] Return type does not match returned value: expected `frozenset[str]`, found `frozenset[Unknown | str | Buffer]`
+ ibis/selectors.py:333:16: error[invalid-return-type] Return type does not match returned value: expected `frozenset[str]`, found `frozenset[str | Buffer | Unknown]`
- ibis/selectors.py:428:13: error[invalid-assignment] Object of type `frozenset[Unknown | str]` is not assignable to `tuple[str | Column, ...]`
+ ibis/selectors.py:428:13: error[invalid-assignment] Object of type `frozenset[str | Unknown]` is not assignable to `tuple[str | Column, ...]`

hydpy (https://github.com/hydpy-dev/hydpy)
- hydpy/auxs/calibtools.py:2149:13: error[invalid-argument-type] Argument to bound method `apply_value` is incorrect: Expected `Replace`, found `TypeRule1@CalibrationInterface`
- hydpy/auxs/calibtools.py:2149:13: error[invalid-argument-type] Argument to bound method `apply_value` is incorrect: Expected `Add`, found `TypeRule1@CalibrationInterface`
- hydpy/auxs/calibtools.py:2149:13: error[invalid-argument-type] Argument to bound method `apply_value` is incorrect: Expected `Multiply`, found `TypeRule1@CalibrationInterface`
- hydpy/auxs/calibtools.py:2149:13: error[invalid-argument-type] Argument to bound method `apply_value` is incorrect: Expected `ReplaceIUH`, found `TypeRule1@CalibrationInterface`
- hydpy/auxs/calibtools.py:2149:13: error[invalid-argument-type] Argument to bound method `apply_value` is incorrect: Expected `MultiplyIUH`, found `TypeRule1@CalibrationInterface`
- hydpy/auxs/calibtools.py:2163:13: error[invalid-argument-type] Argument to bound method `reset_parameters` is incorrect: Expected `RuleIUH`, found `TypeRule1@CalibrationInterface`
- Found 685 diagnostics
+ Found 679 diagnostics

sympy (https://github.com/sympy/sympy)
- sympy/algebras/tests/test_quaternion.py:76:10: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
- 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/algebras/tests/test_quaternion.py:423:33: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/codegen/tests/test_matrix_nodes.py:28:21: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/geometry/point.py:1296:25: error[unresolved-attribute] Attribute `tolist` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/geometry/point.py:1296:25: error[unresolved-attribute] Attribute `tolist` is not defined on `Expr` in union `MatrixBase | Expr`
- sympy/geometry/tests/test_util.py:129:55: error[invalid-argument-type] Argument to function `subsets` is incorrect: Expected `Sequence[Unknown]`, found `set[Point2D | Unknown]`
+ sympy/geometry/tests/test_util.py:129:55: error[invalid-argument-type] Argument to function `subsets` is incorrect: Expected `Sequence[Unknown]`, found `set[Unknown | Point2D]`
- sympy/integrals/prde.py:90:11: error[unresolved-attribute] Attribute `as_poly` is not defined on `int` in union `int | Unknown`
+ sympy/integrals/prde.py:90:11: error[unresolved-attribute] Attribute `as_poly` is not defined on `int` in union `Unknown | int`
- sympy/integrals/prde.py:90:61: error[unresolved-attribute] Attribute `as_poly` is not defined on `int` in union `int | Unknown`
+ sympy/integrals/prde.py:90:61: error[unresolved-attribute] Attribute `as_poly` is not defined on `int` in union `Unknown | int`
- sympy/integrals/prde.py:91:10: error[unresolved-attribute] Attribute `as_poly` is not defined on `int` in union `int | Unknown`
+ sympy/integrals/prde.py:91:10: error[unresolved-attribute] Attribute `as_poly` is not defined on `int` in union `Unknown | int`
- sympy/integrals/tests/test_heurisch.py:390:17: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/integrals/tests/test_heurisch.py:391:26: error[not-subscriptable] Cannot subscript object of type `Expr` with no `__getitem__` method
+ sympy/matrices/decompositions.py:1321:16: error[unresolved-attribute] Attribute `diagonalize` is not defined on `Expr` in union `MatrixBase | Expr`
+ sympy/matrices/decompositions.py:1336:16: error[unresolved-attribute] Attribute `diagonalize` is not defined on `Expr` in union `MatrixBase | Expr`
- sympy/matrices/decompositions.py:1321:16: error[unresolved-attribute] Attribute `diagonalize` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/decompositions.py:1334:13: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MatrixBase`
- sympy/matrices/decompositions.py:1336:16: error[unresolved-attribute] Attribute `diagonalize` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/decompositions.py:1348:13: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MatrixBase`
- sympy/matrices/decompositions.py:1350:12: error[invalid-return-type] Return type does not match returned value: expected `tuple[Tmat@_singular_value_decomposition, Tmat@_singular_value_decomposition, Tmat@_singular_value_decomposition]`, found `tuple[Unknown | MatrixBase, MatrixBase, MatrixBase | Unknown]`
+ sympy/matrices/decompositions.py:1350:12: error[invalid-return-type] Return type does not match returned value: expected `tuple[Tmat@_singular_value_decomposition, Tmat@_singular_value_decomposition, Tmat@_singular_value_decomposition]`, found `tuple[MatrixBase | Expr | Unknown, MatrixBase, MatrixBase | Expr | Unknown]`
+ sympy/matrices/expressions/tests/test_blockmatrix.py:236:13: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/expressions/tests/test_blockmatrix.py:236:33: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/expressions/tests/test_blockmatrix.py:236:53: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/expressions/tests/test_blockmatrix.py:460:12: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/expressions/tests/test_derivatives.py:552:26: error[unsupported-operator] Operator `+` is not supported between two objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/expressions/tests/test_derivatives.py:552:26: error[unsupported-operator] Operator `+` is not supported between two objects of type `MatrixBase | Expr`
+ sympy/matrices/expressions/tests/test_matadd.py:37:12: error[unsupported-operator] Operator `+` is not supported between objects of type `MatrixBase` and `MatrixBase | Expr`
- sympy/matrices/expressions/tests/test_matmul.py:159:68: error[unresolved-attribute] Attribute `as_explicit` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/expressions/tests/test_matmul.py:159:68: error[unresolved-attribute] Attribute `as_explicit` is not defined on `Expr` in union `MatrixBase | Expr`
- sympy/matrices/expressions/tests/test_matpow.py:124:46: error[unsupported-operator] Operator `**` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `Literal[2]`
+ sympy/matrices/expressions/tests/test_matpow.py:125:47: error[unsupported-operator] Operator `+` is not supported between two objects of type `ImmutableDenseMatrix`
- sympy/matrices/expressions/tests/test_permutation.py:28:12: error[unresolved-attribute] Attribute `as_explicit` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/expressions/tests/test_permutation.py:28:12: error[unresolved-attribute] Attribute `as_explicit` is not defined on `Expr` in union `MatrixBase | Expr`
- sympy/matrices/inverse.py:384:11: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MatrixBase`
+ sympy/matrices/inverse.py:385:11: error[unsupported-operator] Operator `-` is not supported between objects of type `MatrixBase` and `MatrixBase | Expr | Unknown`
- sympy/matrices/inverse.py:392:11: error[unsupported-operator] Unary operator `-` is not supported for object of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/inverse.py:393:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MatrixBase | Expr`
+ sympy/matrices/inverse.py:393:11: error[unsupported-operator] Operator `+` is not supported between objects of type `MatrixBase` and `MatrixBase | Expr | Unknown`
- sympy/matrices/inverse.py:393:22: error[unsupported-operator] Unary operator `-` is not supported for object of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/matrixbase.py:979:18: error[unsupported-operator] Operator `+` is not supported between two objects of type `Self@_eval_wilkinson`
- 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 objects of type `T2'return@call_highest_priority` and `Self@_eval_pow_by_cayley`
- sympy/matrices/matrixbase.py:3046:5: error[invalid-argument-type] Argument is incorrect: Expected `(T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr, T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr, /) -> T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`, found `Overload[[Self](self, other: Self) -> Self, (self, other: MatrixBase) -> MatrixBase, (self, other: Expr) -> MatrixBase]`
+ sympy/matrices/matrixbase.py:3046:5: error[invalid-argument-type] Argument is incorrect: Expected `(MatrixBase, MatrixBase | Expr, /) -> MatrixBase | Expr`, found `Overload[[Self](self, other: Self) -> Self, (self, other: MatrixBase) -> MatrixBase, (self, other: Expr) -> MatrixBase]`
+ sympy/matrices/matrixbase.py:3256:16: error[invalid-return-type] Return type does not match returned value: expected `MatrixBase`, found `T2'return@call_highest_priority | T1'return@call_highest_priority`
+ sympy/matrices/matrixbase.py:3256:29: error[invalid-argument-type] Argument is incorrect: Expected `T2'return@call_highest_priority | T1'return@call_highest_priority`, found `MatrixBase`
+ sympy/matrices/matrixbase.py:3310:16: error[unsupported-operator] Operator `+` is not supported between two objects of type `MatrixBase`
+ sympy/matrices/matrixbase.py:3314:16: error[invalid-return-type] Return type does not match returned value: expected `Tmat@__sub__`, found `MatrixBase`
- sympy/matrices/matrixbase.py:3944:39: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
- sympy/matrices/matrixbase.py:3944:39: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/matrixbase.py:4386:16: error[unsupported-operator] Operator `+` is not supported between two objects of type `Self@add`
- sympy/matrices/matrixbase.py:4640:16: error[invalid-return-type] Return type does not match returned value: expected `Self@D`, found `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/matrixbase.py:4640:16: error[invalid-return-type] Return type does not match returned value: expected `Self@D`, found `MatrixBase | Expr`
- sympy/matrices/matrixbase.py:4748:16: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
- sympy/matrices/matrixbase.py:4748:16: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
- 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:4922:13: error[unsupported-operator] Operator `*=` is not supported between objects of type `T1'return@call_highest_priority` and `Self@analytic_func`
- sympy/matrices/matrixbase.py:5073:28: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `Self@log`
- sympy/matrices/matrixbase.py:5076:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `Self@log`
+ sympy/matrices/matrixbase.py:5073:28: error[invalid-argument-type] Argument is incorrect: Expected `Self@log`, found `MatrixBase | Expr | Unknown`
+ sympy/matrices/matrixbase.py:5078:16: error[invalid-return-type] Return type does not match returned value: expected `Self@log`, found `MatrixBase | Expr | Unknown`
+ sympy/matrices/repmatrix.py:321:17: error[unsupported-operator] Operator `-` is not supported between two objects of type `Self@_eval_is_symmetric`
- sympy/matrices/solvers.py:976:16: error[unresolved-attribute] Attribute `solve` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/solvers.py:976:16: error[unresolved-attribute] Attribute `solve` is not defined on `Expr` in union `MatrixBase | Expr`
- sympy/matrices/solvers.py:976:30: error[invalid-argument-type] Argument to bound method `solve` is incorrect: Argument type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` does not satisfy upper bound `MatrixBase` of type variable `Self`
+ sympy/matrices/solvers.py:976:30: error[invalid-argument-type] Argument to bound method `solve` is incorrect: Argument type `MatrixBase | Expr` does not satisfy upper bound `MatrixBase` of type variable `Self`
- sympy/matrices/solvers.py:976:30: error[invalid-argument-type] Argument to bound method `solve` is incorrect: Expected `MatrixBase`, found `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/solvers.py:976:30: error[invalid-argument-type] Argument to bound method `solve` is incorrect: Expected `MatrixBase`, found `MatrixBase | Expr`
- sympy/matrices/sparse.py:418:16: error[unresolved-attribute] Attribute `inv` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/sparse.py:418:16: error[unresolved-attribute] Attribute `inv` is not defined on `Expr` in union `MatrixBase | Expr`
+ sympy/matrices/tests/test_commonmatrix.py:1250:31: error[unsupported-operator] Operator `+` is not supported between objects of type `MutableDenseMatrix` and `ImmutableDenseNDimArray`
- sympy/matrices/tests/test_decompositions.py:24:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:24:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `Expr` in union `MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:33:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:33:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `Expr` in union `MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:43:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:43:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `Expr` in union `MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:52:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:52:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `Expr` in union `MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:58:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:58:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `Expr` in union `MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:78:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:85:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:91:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:104:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:111:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:124:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:132:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:132:12: error[no-matching-overload] No overload of function `simplify` matches arguments
- sympy/matrices/tests/test_decompositions.py:289:10: error[unresolved-attribute] Attribute `applyfunc` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:289:10: error[unresolved-attribute] Attribute `applyfunc` is not defined on `Expr` in union `MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:394:16: error[no-matching-overload] No overload of function `simplify` matches arguments
+ sympy/matrices/tests/test_decompositions.py:395:16: error[no-matching-overload] No overload of function `simplify` matches arguments
- sympy/matrices/tests/test_decompositions.py:291:13: error[unsupported-operator] Operator `-` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:346:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:349:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:356:23: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:394:25: error[unsupported-operator] Operator `*` is not supported between objects of type `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:395:25: error[unsupported-operator] Operator `*` is not supported between objects of type `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:396:16: error[unresolved-attribute] Attribute `H

... (truncated 357 lines) ...

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot bot commented Feb 21, 2026

Memory usage report

Summary

Project Old New Diff Outcome
flake8 47.81MB 47.85MB +0.09% (42.73kB)
trio 117.33MB 117.34MB +0.01% (14.34kB)
sphinx 261.87MB 261.75MB -0.05% (127.03kB) ⬇️
prefect 707.79MB 707.10MB -0.10% (711.93kB) ⬇️

Significant changes

Click to expand detailed breakdown

flake8

Name Old New Diff Outcome
Type<'db>::try_call_dunder_get_ 367.62kB 418.23kB +13.77% (50.61kB)
Type<'db>::try_call_dunder_get_::interned_arguments 82.77kB 93.34kB +12.76% (10.56kB)
BoundMethodType 52.34kB 62.81kB +20.00% (10.47kB)
infer_expression_types_impl 1.04MB 1.04MB -0.76% (8.07kB)
infer_scope_types_impl 987.07kB 980.72kB -0.64% (6.35kB)
Type<'db>::member_lookup_with_policy_::interned_arguments 230.95kB 225.67kB -2.29% (5.28kB)
Type<'db>::member_lookup_with_policy_ 482.14kB 477.61kB -0.94% (4.54kB)
infer_definition_types 1.87MB 1.87MB -0.18% (3.40kB)
StaticClassLiteral<'db>::try_mro_ 318.75kB 318.41kB -0.11% (344.00B)
Type<'db>::class_member_with_policy_ 578.43kB 578.16kB -0.05% (280.00B)
infer_expression_type_impl 118.12kB 117.96kB -0.13% (156.00B)
StaticClassLiteral<'db>::decorators_ 13.45kB 13.35kB -0.78% (108.00B)
Type<'db>::class_member_with_policy_::interned_arguments 311.49kB 311.39kB -0.03% (104.00B)
loop_header_reachability 12.75kB 12.66kB -0.64% (84.00B)
StaticClassLiteral<'db>::try_mro_::interned_arguments 72.49kB 72.42kB -0.10% (72.00B)
... 3 more

trio

Name Old New Diff Outcome
Type<'db>::try_call_dunder_get_ 1.34MB 1.46MB +9.04% (124.02kB)
Type<'db>::class_member_with_policy_ 2.05MB 2.01MB -1.83% (38.27kB)
BoundMethodType 186.02kB 223.22kB +20.00% (37.20kB)
infer_expression_types_impl 7.03MB 7.00MB -0.46% (32.86kB)
Type<'db>::member_lookup_with_policy_::interned_arguments 925.54kB 898.02kB -2.97% (27.52kB)
Type<'db>::try_call_dunder_get_::interned_arguments 348.36kB 374.46kB +7.49% (26.10kB)
infer_definition_types 7.62MB 7.59MB -0.29% (22.65kB)
Type<'db>::member_lookup_with_policy_ 1.80MB 1.79MB -0.84% (15.50kB)
infer_scope_types_impl 4.75MB 4.74MB -0.21% (10.25kB)
Type<'db>::class_member_with_policy_::interned_arguments 1.13MB 1.12MB -0.62% (7.11kB)
infer_unpack_types 143.38kB 138.11kB -3.68% (5.27kB)
infer_expression_type_impl 1.31MB 1.30MB -0.38% (5.14kB)
ClassType<'db>::nearest_disjoint_base_ 24.75kB 22.19kB -10.37% (2.57kB)
StaticClassLiteral<'db>::implicit_attribute_inner_ 745.76kB 744.78kB -0.13% (1000.00B)
all_narrowing_constraints_for_expression 591.20kB 590.24kB -0.16% (984.00B)
... 26 more

sphinx

Name Old New Diff Outcome
Type<'db>::try_call_dunder_get_ 4.88MB 5.20MB +6.56% (327.77kB) ⬇️
Type<'db>::class_member_with_policy_ 7.64MB 7.45MB -2.41% (188.35kB) ⬇️
infer_expression_types_impl 20.91MB 20.75MB -0.74% (159.21kB) ⬇️
BoundMethodType 708.05kB 849.66kB +20.00% (141.61kB) ⬇️
Type<'db>::member_lookup_with_policy_::interned_arguments 2.67MB 2.59MB -3.14% (85.92kB) ⬇️
Type<'db>::member_lookup_with_policy_ 6.25MB 6.17MB -1.28% (81.89kB) ⬇️
Type<'db>::try_call_dunder_get_::interned_arguments 1.16MB 1.23MB +5.68% (67.64kB) ⬇️
infer_definition_types 23.76MB 23.70MB -0.25% (60.86kB) ⬇️
Type<'db>::class_member_with_policy_::interned_arguments 4.03MB 3.99MB -0.85% (35.24kB) ⬇️
infer_scope_types_impl 15.44MB 15.42MB -0.16% (25.39kB) ⬇️
infer_expression_type_impl 2.90MB 2.89MB -0.35% (10.35kB) ⬇️
ClassType<'db>::nearest_disjoint_base_ 65.68kB 62.41kB -4.98% (3.27kB) ⬇️
all_narrowing_constraints_for_expression 2.32MB 2.32MB -0.10% (2.33kB) ⬇️
loop_header_reachability 368.85kB 366.85kB -0.54% (2.00kB) ⬇️
all_negative_narrowing_constraints_for_expression 1023.89kB 1022.46kB -0.14% (1.43kB) ⬇️
... 25 more

prefect

Name Old New Diff Outcome
Type<'db>::class_member_with_policy_ 17.42MB 16.99MB -2.46% (438.79kB) ⬇️
Type<'db>::try_call_dunder_get_ 10.48MB 10.86MB +3.65% (391.80kB) ⬇️
infer_definition_types 89.78MB 89.43MB -0.40% (366.62kB) ⬇️
infer_expression_types_impl 62.00MB 61.69MB -0.51% (322.49kB) ⬇️
BoundMethodType 1.45MB 1.74MB +20.08% (298.33kB) ⬇️
is_redundant_with_impl 4.25MB 4.43MB +4.19% (182.74kB) ⬇️
Type<'db>::member_lookup_with_policy_::interned_arguments 5.89MB 5.74MB -2.55% (153.87kB) ⬇️
infer_scope_types_impl 54.19MB 54.07MB -0.22% (124.62kB) ⬇️
Type<'db>::member_lookup_with_policy_ 16.12MB 16.01MB -0.69% (113.36kB) ⬇️
Type<'db>::try_call_dunder_get_::interned_arguments 2.89MB 2.98MB +2.89% (85.72kB) ⬇️
Type<'db>::class_member_with_policy_::interned_arguments 9.68MB 9.60MB -0.75% (74.14kB) ⬇️
infer_expression_type_impl 13.15MB 13.09MB -0.49% (66.22kB) ⬇️
StaticClassLiteral<'db>::implicit_attribute_inner_ 9.93MB 9.89MB -0.42% (43.18kB) ⬇️
IntersectionType<'db>::from_two_elements_ 45.52kB 83.34kB +83.11% (37.83kB) ⬇️
Type<'db>::apply_specialization_ 3.65MB 3.68MB +0.73% (27.47kB) ⬇️
... 41 more

@Hugo-Polloli Hugo-Polloli marked this pull request as ready for review February 21, 2026 19:07
@AlexWaygood AlexWaygood added ty Multi-file analysis & type inference ecosystem-analyzer labels Feb 21, 2026
@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot bot commented Feb 21, 2026

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-argument-type 1 101 1
no-matching-overload 0 23 0
invalid-return-type 3 1 12
invalid-assignment 5 6 1
possibly-missing-attribute 1 5 4
possibly-missing-implicit-call 2 0 0
unresolved-attribute 1 0 1
not-iterable 0 1 0
unsupported-operator 0 1 0
unused-type-ignore-comment 0 1 0
Total 13 139 19
Raw diff (171 changes)
aiohttp (https://github.com/aio-libs/aiohttp)
- aiohttp/client.py:1542:15 error[invalid-argument-type] Argument to bound method `__aexit__` is incorrect: Argument type `_RetType_co@_BaseRequestContextManager` does not satisfy upper bound `ClientWebSocketResponse[_DecodeText@ClientWebSocketResponse]` of type variable `Self`
- aiohttp/client.py:1542:15 error[invalid-argument-type] Argument to bound method `__aexit__` is incorrect: Expected `ClientResponse`, found `_RetType_co@_BaseRequestContextManager`
- aiohttp/client.py:1534:22 error[invalid-argument-type] Argument to bound method `__aenter__` is incorrect: Argument type `_RetType_co@_BaseRequestContextManager` does not satisfy upper bound `ClientWebSocketResponse[_DecodeText@ClientWebSocketResponse]` of type variable `Self`
- aiohttp/client.py:1534:22 error[invalid-argument-type] Argument to bound method `__aenter__` is incorrect: Expected `ClientResponse`, found `_RetType_co@_BaseRequestContextManager`

beartype (https://github.com/beartype/beartype)
+ beartype/_util/api/standard/utilfunctools.py:308:24 error[unresolved-attribute] Object of type `BeartypeableT@beartype_functools_lru_cache & Top[(...) -> object]` has no attribute `cache_parameters`
+ beartype/_decor/_nontype/_decordescriptor.py:153:9 error[invalid-argument-type] Argument to function `beartype_func` is incorrect: Argument type `((Any, /) -> Any) | None` does not satisfy upper bound `((...) -> Any) | classmethod[Unknown, (...), Unknown] | property` of type variable `BeartypeableT`

core (https://github.com/home-assistant/core)
- homeassistant/components/asuswrt/helpers.py:44:16 error[invalid-return-type] Return type does not match returned value: expected `T@translate_to_legacy`, found `dict[Unknown, object]`
+ homeassistant/components/asuswrt/helpers.py:44:16 error[invalid-return-type] Return type does not match returned value: expected `T@translate_to_legacy`, found `dict[str, Any]`
- homeassistant/components/asuswrt/helpers.py:44:17 error[no-matching-overload] No overload of bound method `get` matches arguments
+ homeassistant/components/sonos/helpers.py:84:42 warning[possibly-missing-attribute] Attribute `soco` may be missing on object of type `_T@wrapper`

discord.py (https://github.com/Rapptz/discord.py)
- discord/ext/commands/core.py:680:52 warning[possibly-missing-attribute] Attribute `cog_command_error` may be missing on object of type `CogT@Command & ~None`
- discord/ext/commands/core.py:919:47 warning[possibly-missing-attribute] Attribute `cog_before_invoke` may be missing on object of type `CogT@Command & ~None`
- discord/ext/commands/core.py:921:23 error[invalid-argument-type] Argument to bound method `cog_before_invoke` is incorrect: Expected `Cog`, found `CogT@Command`
- discord/ext/commands/core.py:939:47 warning[possibly-missing-attribute] Attribute `cog_after_invoke` may be missing on object of type `CogT@Command & ~None`
- discord/ext/commands/core.py:941:23 error[invalid-argument-type] Argument to bound method `cog_after_invoke` is incorrect: Expected `Cog`, found `CogT@Command`
- discord/ext/commands/core.py:1312:58 warning[possibly-missing-attribute] Attribute `cog_check` may be missing on object of type `CogT@Command & ~None`

hydpy (https://github.com/hydpy-dev/hydpy)
- hydpy/auxs/calibtools.py:2145:13 error[invalid-argument-type] Argument to bound method `apply_value` is incorrect: Expected `Add`, found `TypeRule1@CalibrationInterface`
- hydpy/auxs/calibtools.py:2145:13 error[invalid-argument-type] Argument to bound method `apply_value` is incorrect: Expected `MultiplyIUH`, found `TypeRule1@CalibrationInterface`
- hydpy/auxs/calibtools.py:2145:13 error[invalid-argument-type] Argument to bound method `apply_value` is incorrect: Expected `Multiply`, found `TypeRule1@CalibrationInterface`
- hydpy/auxs/calibtools.py:2145:13 error[invalid-argument-type] Argument to bound method `apply_value` is incorrect: Expected `ReplaceIUH`, found `TypeRule1@CalibrationInterface`
- hydpy/auxs/calibtools.py:2145:13 error[invalid-argument-type] Argument to bound method `apply_value` is incorrect: Expected `Replace`, found `TypeRule1@CalibrationInterface`
- hydpy/auxs/calibtools.py:2159:13 error[invalid-argument-type] Argument to bound method `reset_parameters` is incorrect: Expected `RuleIUH`, found `TypeRule1@CalibrationInterface`
+ hydpy/auxs/iuhtools.py:520:16 error[invalid-return-type] Return type does not match returned value: expected `VectorFloatFlex@__call__`, found `ndarray[tuple[int], Unknown]`
- hydpy/auxs/iuhtools.py:516:13 error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: ndarray[tuple[Any, ...], dtype[integer[Any] | numpy.bool[builtins.bool]]] | tuple[ndarray[tuple[Any, ...], dtype[integer[Any] | numpy.bool[builtins.bool]]], ...], /) -> ndarray[tuple[Any, ...], dtype[float64]], (key: SupportsIndex | tuple[SupportsIndex, ...], /) -> Any, (key: SupportsIndex | slice[Any, Any, Any] | EllipsisType | ... omitted 5 union elements, /) -> ndarray[tuple[Any, ...], dtype[float64]], (key: str, /) -> ndarray[tuple[int] | tuple[Any, ...], dtype[Any]], (key: list[str], /) -> ndarray[tuple[int] | tuple[Any, ...], Unknown]]` cannot be called with key of type `bool` on object of type `VectorFloatFlex@__call__`
- hydpy/auxs/iuhtools.py:516:13 error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: ndarray[tuple[Any, ...], dtype[integer[Any] | numpy.bool[builtins.bool]]] | tuple[ndarray[tuple[Any, ...], dtype[integer[Any] | numpy.bool[builtins.bool]]], ...], /) -> ndarray[tuple[Any, ...], dtype[float64]], (key: SupportsIndex | tuple[SupportsIndex, ...], /) -> Any, (key: SupportsIndex | slice[Any, Any, Any] | EllipsisType | ... omitted 5 union elements, /) -> ndarray[tuple[Any, ...], dtype[float64]], (key: str, /) -> ndarray[tuple[int] | tuple[Any, ...], dtype[Any]], (key: list[str], /) -> ndarray[tuple[int] | tuple[Any, ...], Unknown]]` cannot be called with key of type `ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]]` on object of type `VectorFloatFlex@__call__`
+ hydpy/auxs/iuhtools.py:516:13 warning[possibly-missing-implicit-call] Method `__getitem__` of type `VectorFloatFlex@__call__` may be missing
+ hydpy/auxs/iuhtools.py:516:13 warning[possibly-missing-implicit-call] Method `__getitem__` of type `VectorFloatFlex@__call__` may be missing
+ hydpy/auxs/iuhtools.py:516:13 error[invalid-assignment] Object of type `Any | ndarray[tuple[Any, ...], dtype[float64]]` is not assignable to `VectorFloatFlex@__call__`

koda-validate (https://github.com/keithasaurus/koda-validate)
- koda_validate/generic.py:312:20 error[invalid-argument-type] Argument to bound method `strip` is incorrect: Expected `bytes`, found `StrOrBytes@NotBlank`
- koda_validate/generic.py:312:20 error[no-matching-overload] No overload of bound method `strip` matches arguments
- koda_validate/generic.py:290:16 error[invalid-argument-type] Argument to bound method `startswith` is incorrect: Expected `bytes`, found `StrOrBytes@StartsWith`
- koda_validate/generic.py:290:16 error[invalid-argument-type] Argument to bound method `startswith` is incorrect: Expected `str`, found `StrOrBytes@StartsWith`
- koda_validate/generic.py:298:16 error[invalid-argument-type] Argument to bound method `endswith` is incorrect: Expected `bytes`, found `StrOrBytes@EndsWith`
- koda_validate/generic.py:298:16 error[invalid-argument-type] Argument to bound method `endswith` is incorrect: Expected `str`, found `StrOrBytes@EndsWith`
- koda_validate/generic.py:321:16 error[invalid-return-type] Return type does not match returned value: expected `StrOrBytes@Strip`, found `Unknown | bytes`
+ koda_validate/generic.py:321:16 error[invalid-return-type] Return type does not match returned value: expected `StrOrBytes@Strip`, found `str | bytes`
- koda_validate/generic.py:321:16 error[invalid-argument-type] Argument to bound method `strip` is incorrect: Expected `bytes`, found `StrOrBytes@Strip`
- koda_validate/generic.py:321:16 error[no-matching-overload] No overload of bound method `strip` matches arguments
- koda_validate/generic.py:330:16 error[invalid-return-type] Return type does not match returned value: expected `StrOrBytes@UpperCase`, found `Unknown | bytes`
+ koda_validate/generic.py:330:16 error[invalid-return-type] Return type does not match returned value: expected `StrOrBytes@UpperCase`, found `str | bytes`
- koda_validate/generic.py:330:16 error[invalid-argument-type] Argument to bound method `upper` is incorrect: Expected `bytes`, found `StrOrBytes@UpperCase`
- koda_validate/generic.py:330:16 error[no-matching-overload] No overload of bound method `upper` matches arguments
- koda_validate/generic.py:336:16 error[invalid-return-type] Return type does not match returned value: expected `StrOrBytes@LowerCase`, found `Unknown | bytes`
+ koda_validate/generic.py:336:16 error[invalid-return-type] Return type does not match returned value: expected `StrOrBytes@LowerCase`, found `str | bytes`
- koda_validate/generic.py:336:16 error[invalid-argument-type] Argument to bound method `lower` is incorrect: Expected `bytes`, found `StrOrBytes@LowerCase`
- koda_validate/generic.py:336:16 error[no-matching-overload] No overload of bound method `lower` matches arguments

operator (https://github.com/canonical/operator)
- ops/pebble.py:567:19 error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> LiteralString, (key: SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str]) | (Overload[(key: SupportsIndex, /) -> int, (key: slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> bytes])` cannot be called with key of type `slice[Any, Any, Any]` on object of type `AnyStr@ExecError`

pandas (https://github.com/pandas-dev/pandas)
- pandas/core/algorithms.py:223:12 error[no-matching-overload] No overload of bound method `astype` matches arguments
- pandas/core/algorithms.py:223:12 error[no-matching-overload] No overload of bound method `astype` matches arguments
+ pandas/core/algorithms.py:223:12 error[invalid-return-type] Return type does not match returned value: expected `ArrayLikeT@_reconstruct_data`, found `ndarray[tuple[Any, ...], dtype[Any]] | ndarray[tuple[Any, ...], Unknown]`
- pandas/core/arrays/datetimes.py:3153:21 error[invalid-assignment] Object of type `Timestamp` is not assignable to `_TimestampNoneT1@_maybe_normalize_endpoints`
- pandas/core/arrays/datetimes.py:3156:19 error[invalid-assignment] Object of type `Timestamp` is not assignable to `_TimestampNoneT2@_maybe_normalize_endpoints`
- pandas/core/dtypes/cast.py:388:16 error[invalid-return-type] Return type does not match returned value: expected `NumpyIndexT@maybe_upcast_numeric_to_64bit`, found `Unknown | Index`
+ pandas/core/dtypes/cast.py:388:16 error[invalid-return-type] Return type does not match returned value: expected `NumpyIndexT@maybe_upcast_numeric_to_64bit`, found `ndarray[tuple[Any, ...], Unknown] | Index`
- pandas/core/dtypes/cast.py:388:16 error[invalid-argument-type] Argument to bound method `astype` is incorrect: Expected `Index`, found `NumpyIndexT@maybe_upcast_numeric_to_64bit`
- pandas/core/dtypes/cast.py:388:16 error[no-matching-overload] No overload of bound method `astype` matches arguments
- pandas/core/dtypes/cast.py:390:16 error[invalid-return-type] Return type does not match returned value: expected `NumpyIndexT@maybe_upcast_numeric_to_64bit`, found `Unknown | Index`
+ pandas/core/dtypes/cast.py:390:16 error[invalid-return-type] Return type does not match returned value: expected `NumpyIndexT@maybe_upcast_numeric_to_64bit`, found `ndarray[tuple[Any, ...], Unknown] | Index`
- pandas/core/dtypes/cast.py:390:16 error[invalid-argument-type] Argument to bound method `astype` is incorrect: Expected `Index`, found `NumpyIndexT@maybe_upcast_numeric_to_64bit`
- pandas/core/dtypes/cast.py:390:16 error[no-matching-overload] No overload of bound method `astype` matches arguments
- pandas/core/dtypes/cast.py:392:16 error[invalid-return-type] Return type does not match returned value: expected `NumpyIndexT@maybe_upcast_numeric_to_64bit`, found `Unknown | Index`
+ pandas/core/dtypes/cast.py:392:16 error[invalid-return-type] Return type does not match returned value: expected `NumpyIndexT@maybe_upcast_numeric_to_64bit`, found `ndarray[tuple[Any, ...], Unknown] | Index`
- pandas/core/dtypes/cast.py:392:16 error[invalid-argument-type] Argument to bound method `astype` is incorrect: Expected `Index`, found `NumpyIndexT@maybe_upcast_numeric_to_64bit`
- pandas/core/dtypes/cast.py:392:16 error[no-matching-overload] No overload of bound method `astype` matches arguments
- pandas/core/resample.py:3208:12 error[invalid-return-type] Return type does not match returned value: expected `FreqIndexT@_asfreq_compat`, found `PeriodIndex | DatetimeIndex | TimedeltaIndex`
+ pandas/core/resample.py:3208:12 error[invalid-return-type] Return type does not match returned value: expected `FreqIndexT@_asfreq_compat`, found `Unknown | DatetimeIndex | TimedeltaIndex`

pip (https://github.com/pypa/pip)
- src/pip/_vendor/rich/progress.py:294:16 error[invalid-argument-type] Argument to bound method `__enter__` is incorrect: Expected `BinaryIO`, found `_I@_ReadContext`
- src/pip/_vendor/rich/progress.py:294:16 error[invalid-argument-type] Argument to bound method `__enter__` is incorrect: Expected `TextIO`, found `_I@_ReadContext`

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/templating.py:92:47 error[invalid-argument-type] Argument to function `find_placeholders` is incorrect: Argument type `object` does not satisfy constraints (`str`, `int`, `int | float`, `bool`, `dict[Any, Any]`, `list[Any]`, `None`) of type variable `T`
- src/prefect/utilities/templating.py:224:29 error[no-matching-overload] No overload of function `apply_values` matches arguments
- src/prefect/utilities/templating.py:232:17 error[invalid-assignment] Invalid subscript assignment with key of type `object` and value of type `Unknown & ~<class 'NotSet'>` on object of type `dict[str, Any]`
- src/prefect/utilities/templating.py:234:17 error[invalid-assignment] Invalid subscript assignment with key of type `object` and value of type `object` on object of type `dict[str, Any]`
- src/prefect/utilities/templating.py:330:29 error[no-matching-overload] No overload of bound method `get` matches arguments
- src/prefect/utilities/templating.py:339:13 error[invalid-assignment] Invalid subscript assignment with key of type `object` and value of type `Unknown` on object of type `dict[str, Any]`
- src/prefect/utilities/templating.py:216:36 warning[possibly-missing-attribute] Attribute `replace` may be missing on object of type `T@apply_values | Unknown`
+ src/prefect/utilities/templating.py:216:36 warning[possibly-missing-attribute] Attribute `replace` may be missing on object of type `T@apply_values`
- src/prefect/utilities/templating.py:216:36 error[no-matching-overload] No overload of bound method `replace` matches arguments
+ src/prefect/utilities/templating.py:216:36 error[invalid-assignment] Object of type `str` is not assignable to `T@apply_values`
- src/prefect/utilities/templating.py:218:32 warning[possibly-missing-attribute] Attribute `replace` may be missing on object of type `T@apply_values | Unknown`
+ src/prefect/utilities/templating.py:218:32 warning[possibly-missing-attribute] Attribute `replace` may be missing on object of type `T@apply_values`
- src/prefect/utilities/templating.py:218:32 error[no-matching-overload] No overload of bound method `replace` matches arguments
+ src/prefect/utilities/templating.py:218:32 error[invalid-assignment] Object of type `str` is not assignable to `T@apply_values`
- src/prefect/utilities/templating.py:451:36 warning[possibly-missing-attribute] Attribute `replace` may be missing on object of type `T@resolve_variables | Unknown`
+ src/prefect/utilities/templating.py:451:36 warning[possibly-missing-attribute] Attribute `replace` may be missing on object of type `T@resolve_variables`
- src/prefect/utilities/templating.py:451:36 error[no-matching-overload] No overload of bound method `replace` matches arguments
+ src/prefect/utilities/templating.py:451:36 error[invalid-assignment] Object of type `str` is not assignable to `T@resolve_variables`
- src/prefect/utilities/templating.py:453:36 warning[possibly-missing-attribute] Attribute `replace` may be missing on object of type `T@resolve_variables | Unknown`
+ src/prefect/utilities/templating.py:453:36 warning[possibly-missing-attribute] Attribute `replace` may be missing on object of type `T@resolve_variables`
- src/prefect/utilities/templating.py:453:36 error[no-matching-overload] No overload of bound method `replace` matches arguments
+ src/prefect/utilities/templating.py:453:36 error[invalid-assignment] Object of type `str` is not assignable to `T@resolve_variables`
- src/prefect/utilities/templating.py:456:16 error[invalid-return-type] Return type does not match returned value: expected `T@resolve_variables`, found `dict[object, Unknown]`
+ src/prefect/utilities/templating.py:456:16 error[invalid-return-type] Return type does not match returned value: expected `T@resolve_variables`, found `dict[Any, Unknown]`

pwndbg (https://github.com/pwndbg/pwndbg)
- pwndbg/aglib/heap/ptmalloc.py:1202:74 error[invalid-argument-type] Argument to bound method `keys` is incorrect: Expected `Type`, found `TheType@GlibcMemoryAllocator`
- pwndbg/aglib/heap/ptmalloc.py:1279:22 error[invalid-argument-type] Method `__getitem__` of type `(bound method TheValue@GlibcMemoryAllocator.__getitem__(idx: int | str) -> Value) | (bound method TheValue@GlibcMemoryAllocator.__getitem__(key: str) -> Value)` cannot be called with key of type `Literal["num_slots"]` on object of type `TheValue@GlibcMemoryAllocator`
- pwndbg/aglib/heap/ptmalloc.py:1281:22 error[invalid-argument-type] Method `__getitem__` of type `(bound method TheValue@GlibcMemoryAllocator.__getitem__(idx: int | str) -> Value) | (bound method TheValue@GlibcMemoryAllocator.__getitem__(key: str) -> Value)` cannot be called with key of type `Literal["counts"]` on object of type `TheValue@GlibcMemoryAllocator`
- pwndbg/aglib/heap/ptmalloc.py:1282:19 error[invalid-argument-type] Method `__getitem__` of type `(bound method TheValue@GlibcMemoryAllocator.__getitem__(idx: int | str) -> Value) | (bound method TheValue@GlibcMemoryAllocator.__getitem__(key: str) -> Value)` cannot be called with key of type `Literal["entries"]` on object of type `TheValue@GlibcMemoryAllocator`
- pwndbg/aglib/heap/ptmalloc.py:1292:40 warning[possibly-missing-attribute] Attribute `address` may be missing on object of type `TheValue@GlibcMemoryAllocator`
- pwndbg/aglib/heap/ptmalloc.py:1109:24 error[invalid-argument-type] Method `__getitem__` of type `(bound method TheValue@GlibcMemoryAllocator.__getitem__(idx: int | str) -> Value) | (bound method TheValue@GlibcMemoryAllocator.__getitem__(key: str) -> Value)` cannot be called with key of type `Literal["tcache_small_bins"]` on object of type `TheValue@GlibcMemoryAllocator`
- pwndbg/aglib/heap/ptmalloc.py:1111:24 error[invalid-argument-type] Method `__getitem__` of type `(bound method TheValue@GlibcMemoryAllocator.__getitem__(idx: int | str) -> Value) | (bound method TheValue@GlibcMemoryAllocator.__getitem__(key: str) -> Value)` cannot be called with key of type `Literal["tcache_bins"]` on object of type `TheValue@GlibcMemoryAllocator`
- pwndbg/aglib/heap/ptmalloc.py:1211:16 error[invalid-argument-type] Argument to bound method `keys` is incorrect: Expected `Type`, found `TheType@GlibcMemoryAllocator`
- pwndbg/aglib/heap/ptmalloc.py:1301:48 error[invalid-argument-type] Method `__getitem__` of type `(bound method TheValue@GlibcMemoryAllocator.__getitem__(idx: int | str) -> Value) | (bound method TheValue@GlibcMemoryAllocator.__getitem__(key: str) -> Value)` cannot be called with key of type `Literal["tcache_count"]` on object of type `TheValue@GlibcMemoryAllocator`

pylint (https://github.com/pycqa/pylint)
- pylint/checkers/unicode.py:175:39 error[invalid-argument-type] Argument to bound method `endswith` is incorrect: Expected `bytes`, found `_StrLike@_map_positions_to_result`
- pylint/checkers/unicode.py:175:39 error[invalid-argument-type] Argument to bound method `endswith` is incorrect: Expected `str`, found `_StrLike@_map_positions_to_result`
- pylint/checkers/unicode.py:181:15 error[invalid-argument-type] Argument to bound method `find` is incorrect: Expected `bytes`, found `_StrLike@_map_positions_to_result`
- pylint/checkers/unicode.py:181:15 error[invalid-argument-type] Argument to bound method `find` is incorrect: Expected `str`, found `_StrLike@_map_positions_to_result`
- pylint/checkers/unicode.py:188:19 error[invalid-argument-type] Argument to bound method `find` is incorrect: Expected `bytes`, found `_StrLike@_map_positions_to_result`
- pylint/checkers/unicode.py:188:19 error[invalid-argument-type] Argument to bound method `find` is incorrect: Expected `str`, found `_StrLike@_map_positions_to_result`

rich (https://github.com/Textualize/rich)
- rich/progress.py:294:16 error[invalid-argument-type] Argument to bound method `__enter__` is incorrect: Expected `BinaryIO`, found `_I@_ReadContext`
- rich/progress.py:294:16 error[invalid-argument-type] Argument to bound method `__enter__` is incorrect: Expected `TextIO`, found `_I@_ReadContext`

rotki (https://github.com/rotki/rotki)
- rotkehlchen/chain/decoding/decoder.py:323:21 error[invalid-argument-type] Argument to bound method `get_or_query_db_id` is incorrect: Expected `EvmTransaction`, found `T_Transaction@TransactionDecoder`
- rotkehlchen/chain/decoding/decoder.py:323:21 error[invalid-argument-type] Argument to bound method `get_or_query_db_id` is incorrect: Expected `SolanaTransaction`, found `T_Transaction@TransactionDecoder`

scikit-build-core (https://github.com/scikit-build/scikit-build-core)
- src/scikit_build_core/metadata/__init__.py:89:24 error[invalid-argument-type] Argument is incorrect: Expected `str`, found `object`
+ src/scikit_build_core/metadata/__init__.py:89:35 error[invalid-argument-type] Argument is incorrect: Expected `str`, found `str | list[str] | dict[str, str]`
- src/scikit_build_core/metadata/__init__.py:89:35 error[invalid-argument-type] Argument is incorrect: Expected `str`, found `object`
- src/scikit_build_core/metadata/__init__.py:107:16 error[invalid-return-type] Return type does not match returned value: expected `T@_process_dynamic_metadata`, found `dict[object, dict[str, str]]`
+ src/scikit_build_core/metadata/__init__.py:107:16 error[invalid-return-type] Return type does not match returned value: expected `T@_process_dynamic_metadata`, found `dict[str, dict[str, str]]`
- src/scikit_build_core/metadata/__init__.py:108:51 error[unresolved-attribute] Object of type `object` has no attribute `items`
+ src/scikit_build_core/metadata/__init__.py:108:51 error[unresolved-attribute] Attribute `items` is not defined on `str`, `list[str]` in union `str | list[str] | dict[str, str]`
- src/scikit_build_core/metadata/__init__.py:117:16 error[invalid-return-type] Return type does not match returned value: expected `T@_process_dynamic_metadata`, found `dict[object, list[str]]`
+ src/scikit_build_core/metadata/__init__.py:117:16 error[invalid-return-type] Return type does not match returned value: expected `T@_process_dynamic_metadata`, found `dict[str, list[str]]`
- src/scikit_build_core/metadata/__init__.py:117:40 error[not-iterable] Object of type `object` is not iterable

scrapy (https://github.com/scrapy/scrapy)
- scrapy/http/headers.py:45:30 error[invalid-argument-type] Argument to bound method `title` is incorrect: Expected `bytes`, found `AnyStr@normkey`
- scrapy/http/headers.py:45:30 error[no-matching-overload] No overload of bound method `title` matches arguments
- scrapy/utils/datatypes.py:113:47 error[invalid-argument-type] Argument to bound method `lower` is incorrect: Expected `bytes`, found `AnyStr@__getitem__`
- scrapy/utils/datatypes.py:113:47 error[no-matching-overload] No overload of bound method `lower` matches arguments
- scrapy/utils/datatypes.py:118:36 error[invalid-argument-type] Argument to bound method `lower` is incorrect: Expected `bytes`, found `AnyStr@__setitem__`
- scrapy/utils/datatypes.py:118:36 error[no-matching-overload] No overload of bound method `lower` matches arguments
- scrapy/utils/datatypes.py:123:20 error[invalid-argument-type] Argument to bound method `lower` is incorrect: Expected `bytes`, found `AnyStr@__setitem__`
- scrapy/utils/datatypes.py:123:20 error[no-matching-overload] No overload of bound method `lower` matches arguments
- scrapy/utils/datatypes.py:127:37 error[invalid-argument-type] Argument to bound method `lower` is incorrect: Expected `bytes`, found `AnyStr@__delitem__`
- scrapy/utils/datatypes.py:127:37 error[no-matching-overload] No overload of bound method `lower` matches arguments
- scrapy/utils/datatypes.py:132:16 error[invalid-argument-type] Argument to bound method `lower` is incorrect: Expected `bytes`, found `AnyStr@__contains__`
- scrapy/utils/datatypes.py:132:16 error[no-matching-overload] No overload of bound method `lower` matches arguments
- scrapy/utils/datatypes.py:76:16 error[invalid-return-type] Return type does not match returned value: expected `AnyStr@normkey`, found `Unknown | bytes`
+ scrapy/utils/datatypes.py:76:16 error[invalid-return-type] Return type does not match returned value: expected `AnyStr@normkey`, found `str | bytes`
- scrapy/utils/datatypes.py:76:16 error[invalid-argument-type] Argument to bound method `lower` is incorrect: Expected `bytes`, found `AnyStr@normkey`
- scrapy/utils/datatypes.py:76:16 error[no-matching-overload] No overload of bound method `lower` matches arguments

setuptools (https://github.com/pypa/setuptools)
- setuptools/_distutils/util.py:154:43 error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> LiteralString, (key: SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str]) | (Overload[(key: SupportsIndex, /) -> int, (key: slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> bytes])` cannot be called with key of type `slice[Literal[1], None, None]` on object of type `AnyStr@change_root`

spack (https://github.com/spack/spack)
- lib/spack/spack/vendor/markupsafe/__init__.py:248:13 error[invalid-assignment] Invalid subscript assignment with key of type `Any` and value of type `Markup` on object of type `_ListOrDict@_escape_argspec`

static-frame (https://github.com/static-frame/static-frame)
- static_frame/core/node_values.py:128:59 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ static_frame/core/node_values.py:275:20 error[invalid-return-type] Return type does not match returned value: expected `TVContainer_co@func`, found `@Todo | IndexHierarchy | Series[Any, Any] | Index[Any]`

sympy (https://github.com/sympy/sympy)
- sympy/polys/domains/domain.py:1033:40 error[invalid-argument-type] Argument to bound method `map` is incorrect: Argument type `Iterable[int | Er@Domain]` does not satisfy upper bound `RingElement` of type variable `Er`

xarray (https://github.com/pydata/xarray)
- xarray/computation/rolling.py:199:9 error[unsupported-operator] Operator `/=` is not supported between objects of type `T_Xarray@Rolling` and `Unknown`
- xarray/computation/rolling.py:1216:20 error[invalid-return-type] Return type does not match returned value: expected `T_Xarray@Coarsen`, found `DataArray`
- xarray/core/coordinates.py:1214:69 error[invalid-argument-type] Method `__getitem__` of type `(bound method T_Xarray@assert_coordinate_consistent.__getitem__(key: Any) -> T_Xarray@assert_coordinate_consistent) | (Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_Xarray@assert_coordinate_consistent])` cannot be called with key of type `Unknown` on object of type `T_Xarray@assert_coordinate_consistent`
- xarray/core/coordinates.py:1217:51 error[invalid-argument-type] Method `__getitem__` of type `(bound method T_Xarray@assert_coordinate_consistent.__getitem__(key: Any) -> T_Xarray@assert_coordinate_consistent) | (Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_Xarray@assert_coordinate_consistent])` cannot be called with key of type `Unknown` on object of type `T_Xarray@assert_coordinate_consistent`
- xarray/core/groupby.py:688:25 error[invalid-argument-type] Argument to bound method `transpose` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:688:25 error[invalid-argument-type] Argument to bound method `transpose` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/groupby.py:712:27 error[invalid-argument-type] Argument to bound method `isel` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:712:27 error[invalid-argument-type] Argument to bound method `isel` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/groupby.py:770:22 error[invalid-argument-type] Argument to bound method `_to_temp_dataset` is incorrect: Expected `DataArray`, found `T_Xarray@GroupBy`
- xarray/core/groupby.py:776:20 error[invalid-argument-type] Argument to bound method `_shuffle` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:776:20 error[invalid-argument-type] Argument to bound method `_shuffle` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/groupby.py:781:20 error[invalid-argument-type] Argument to bound method `_from_temp_dataset` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:843:16 error[invalid-argument-type] Argument to bound method `isel` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:843:16 error[invalid-argument-type] Argument to bound method `isel` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/groupby.py:871:23 error[invalid-argument-type] Argument to bound method `isel` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:871:23 error[invalid-argument-type] Argument to bound method `isel` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/groupby.py:963:24 error[invalid-argument-type] Method `__getitem__` of type `(bound method T_Xarray@GroupBy.__getitem__(key: Any) -> T_Xarray@GroupBy) | (Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_Xarray@GroupBy])` cannot be called with key of type `Unknown` on object of type `T_Xarray@GroupBy`
- xarray/core/groupby.py:964:35 error[invalid-argument-type] Method `__getitem__` of type `(bound method T_Xarray@GroupBy.__getitem__(key: Any) -> T_Xarray@GroupBy) | (Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_Xarray@GroupBy])` cannot be called with key of type `Unknown` on object of type `T_Xarray@GroupBy`
- xarray/core/groupby.py:1148:13 error[invalid-argument-type] Argument to bound method `drop_vars` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:1148:13 error[invalid-argument-type] Argument to bound method `drop_vars` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/groupby.py:1227:15 error[invalid-argument-type] Argument to bound method `transpose` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/groupby.py:1227:15 error[invalid-argument-type] Argument to bound method `transpose` is incorrect: Argument type `T_Xarray@GroupBy` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/indexes.py:1929:23 error[invalid-assignment] Object of type `Index` is not assignable to `T_PandasOrXarrayIndex@Indexes`
+ xarray/core/indexes.py:1929:23 error[invalid-assignment] Object of type `PandasIndex | Unknown` is not assignable to `T_PandasOrXarrayIndex@Indexes`
- xarray/core/resample.py:107:16 error[invalid-argument-type] Argument to bound method `drop_vars` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/resample.py:107:16 error[invalid-argument-type] Argument to bound method `drop_vars` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/resample.py:129:23 error[invalid-argument-type] Argument to bound method `drop_vars` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/resample.py:129:23 error[invalid-argument-type] Argument to bound method `drop_vars` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/resample.py:151:16 error[invalid-argument-type] Argument to bound method `reindex` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/resample.py:151:16 error[invalid-argument-type] Argument to bound method `reindex` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/resample.py:178:16 error[invalid-argument-type] Argument to bound method `reindex` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/resample.py:178:16 error[invalid-argument-type] Argument to bound method `reindex` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/resample.py:206:16 error[invalid-argument-type] Argument to bound method `reindex` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/resample.py:206:16 error[invalid-argument-type] Argument to bound method `reindex` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/core/resample.py:245:16 error[invalid-argument-type] Argument to bound method `interp` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `DataArray` of type variable `Self`
- xarray/core/resample.py:245:16 error[invalid-argument-type] Argument to bound method `interp` is incorrect: Argument type `T_Xarray@Resample` does not satisfy upper bound `Dataset` of type variable `Self`
- xarray/plot/facetgrid.py:172:43 error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:173:43 error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:184:24 error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:185:24 error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:200:26 error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:231:26 error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:232:26 error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:236:44 error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:760:48 error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:760:62 error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:761:17 error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Hashable` on object of type `T_DataArrayOrSet@FacetGrid`
- xarray/plot/facetgrid.py:861:38 error[invalid-argument-type] Method `__getitem__` of type `(Overload[(key: Hashable) -> DataArray, (key: Iterable[Hashable]) -> T_DataArrayOrSet@FacetGrid]) | (bound method T_DataArrayOrSet@FacetGrid.__getitem__(key: Any) -> T_DataArrayOrSet@FacetGrid)` cannot be called with key of type `Any` on object of type `T_DataArrayOrSet@FacetGrid`

Full report with detailed diff (timing results)

@ibraheemdev ibraheemdev self-assigned this Feb 23, 2026
Comment on lines +4062 to +4075
// Prepending `self` as an argument can produce spurious self-bound errors for
// union-bounded or constrained typevars; bake `self` into overloads instead.
let should_bake_bound_self = match self_instance {
Type::TypeVar(bound_typevar) => {
match bound_typevar.typevar(db).bound_or_constraints(db) {
Some(TypeVarBoundOrConstraints::UpperBound(bound)) => {
matches!(bound.resolve_type_alias(db), Type::Union(_))
}
Some(TypeVarBoundOrConstraints::Constraints(_)) => true,
None => false,
}
}
_ => false,
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have the full context here, but could you please explain why we need to special-case typevars in particular? Would it be wrong to call bake_bound_type_into_overloads in all cases? If so, why?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I did initially, but it dropped this diagnostic:

class C:
    def __call__(self: int) -> int:
        return 1

c = C()
c()  # error: Expected int, found C <- dropped this

(pre-existing mdtest from crates/ty_python_semantic/resources/mdtest/call/callable_instance.md)

tbh at the time I just had Codex dig into it to explain why. Turns out baking everywhere removes self before call checking, so the checker no longer compared the receiver c (type C, i.e. C.__call__(c)) against the annotated self type int, so c() stopped producing that diagnostic.

I chose to only bake for the known-broken case (union/constrained typevars) and keep the normal path elsewhere to avoid regressions.

Ideally we could always bake for argument matching and add a separate explicit receiver compability check, but that was a bit of a broader change and I preferred to keep it small.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Do we risk dropping a similar diagnostic in a case with a union-bounded TypeVar then?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we risk dropping that diagnostic in union-bounded TypeVar atm. That's a trade-off for fixing astral-sh/ty#2585 that I found acceptable, since the case we're talking about is already pathological in its own right (typing self with int)

The pre-existing mdtest I mentioned has an old TODO about it

class C:
    # TODO this definition should also be an error; `C` must be assignable to type of `self`
    def __call__(self: int) -> int:
        return 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are non-pathological scenarios along those lines, though — you sometimes get scenarios where a method on a base class has self annotated to indicate that the method can only be called on some subclasses of that class, not on others. That's not uncommon on overloads, in fact

Copy link
Copy Markdown
Contributor Author

@Hugo-Polloli Hugo-Polloli Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yepppppp...
I've just pushed a commit with such a test case that properly raises on main, and fails to raise on my branch
I'm re-drafting this PR, back to the drawing board 😅

(If anyone has a lead on a cleaner implem I'll take it! if not, no problem I'll figure it out)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed a new fix that covers the new test case :)
Also I checked ecosystem/mypy on the new code and things seem good !

@Hugo-Polloli Hugo-Polloli marked this pull request as draft February 24, 2026 20:09
@Hugo-Polloli Hugo-Polloli force-pushed the bound-method-union-typevar branch 3 times, most recently from f390542 to 4de0787 Compare February 28, 2026 23:19
@Hugo-Polloli Hugo-Polloli marked this pull request as ready for review February 28, 2026 23:27
@Hugo-Polloli Hugo-Polloli requested a review from sharkdp March 1, 2026 08:57
@sharkdp sharkdp assigned sharkdp and unassigned ibraheemdev Mar 10, 2026
@Hugo-Polloli Hugo-Polloli force-pushed the bound-method-union-typevar branch from 4de0787 to f342898 Compare March 25, 2026 21:45
Copy link
Copy Markdown
Contributor

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the update.

Suppressing errors in a limited number of cases does not seem like the right fix to me. There is a more fundamental issue here. Consider for example this variation of the original issue, which still fails on your branch: https://play.ty.dev/47980c50-3e8a-4ad4-bb10-25107e0fb1b6

Similarly, if you call type(x).callMe(x) instead of x.callMe(), we also still emit this diagnostic.

I believe that solving this would maybe require an approach similar to what @carljm described here. When accessing an attribute on T: A | B, we may need to narrow T to a new typevar with a narrower bound, depending on which path we take in the A | B union. That is: when we access x.attr on x: T, we would create a new T1: A to stand in for the type of self when accessing the attr attribute on A. And similarly, create T2: B for accessing attr on B. Then, we union the two results (while merging T1 | T2 back into T? I haven't really thought about how that part should work).

@Hugo-Polloli Hugo-Polloli marked this pull request as draft March 30, 2026 13:38
@Hugo-Polloli Hugo-Polloli force-pushed the bound-method-union-typevar branch from f342898 to 97df46f Compare April 1, 2026 09:08
@Hugo-Polloli Hugo-Polloli changed the title [ty] Fix bound-method calls on union-bounded TypeVars [ty] Narrow bounded typevars during method lookup Apr 1, 2026
@Hugo-Polloli Hugo-Polloli force-pushed the bound-method-union-typevar branch 2 times, most recently from 6260be7 to 5222e1c Compare April 7, 2026 22:44
@Hugo-Polloli Hugo-Polloli force-pushed the bound-method-union-typevar branch from 5222e1c to ffb44ff Compare April 9, 2026 10:23
@Hugo-Polloli Hugo-Polloli force-pushed the bound-method-union-typevar branch from ffb44ff to b2efe1e Compare April 9, 2026 14:25
@Hugo-Polloli Hugo-Polloli changed the title [ty] Narrow bounded typevars during method lookup [ty] Preserve bounded typevar identity during member lookup Apr 9, 2026
@Hugo-Polloli Hugo-Polloli force-pushed the bound-method-union-typevar branch 3 times, most recently from 554fead to 266af9f Compare April 11, 2026 08:06
@Hugo-Polloli Hugo-Polloli force-pushed the bound-method-union-typevar branch from 266af9f to aba9bd5 Compare April 11, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ecosystem-analyzer ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False positive on calls to bound methods of classes when using a typevar bound to a union of those classes

4 participants