Skip to content

[ty] Only perform literal promotion for implicitly inferred literals#23107

Merged
ibraheemdev merged 4 commits intomainfrom
ibraheem/literal-origins
Feb 19, 2026
Merged

[ty] Only perform literal promotion for implicitly inferred literals#23107
ibraheemdev merged 4 commits intomainfrom
ibraheem/literal-origins

Conversation

@ibraheemdev
Copy link
Member

@ibraheemdev ibraheemdev commented Feb 5, 2026

Updates our literal promotion heuristics to only promote implicitly inferred literal values, i.e., literal values inferred without an explicit literal annotation. This requires us to track promotability on the literal value type itself, and so a lot of the changes here are churn from having to split the literal value variants of Type into a separate LiteralValue type.

Another consequence of this change is that the same literal value does not compare equal in its promotable and unpromotable form, so there are a few cases where we relied on type equality (or hashing) that need to be changed.

Resolves astral-sh/ty#2664, astral-sh/ty#1815, and supersedes #22322.

@ibraheemdev ibraheemdev added the ty Multi-file analysis & type inference label Feb 5, 2026
@ibraheemdev ibraheemdev marked this pull request as draft February 5, 2026 21:49

// For a given type variable, we keep track of the variance of any assignments to
// that type variable in the type context.
let mut variance_in_arguments: FxHashMap<BoundTypeVarIdentity<'_>, TypeVarVariance> =
Copy link
Member Author

Choose a reason for hiding this comment

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

In theory, we still have to avoid promoting literals assigned to a type variable that are is invariant position in any parameter type to avoid assignability errors. However, because we perform literal promotion for all invariant type variables in a generic constructor, the only way you can get a literal type in invariant position is through an explicit literal annotation, in which case we will not attempt promotion anyways.

As per @dcreager, the new constraint solver should give us the necessary information to determine whether or not literal promotion is possible (via the lower and upper bounds of the type assignment), so any edge cases in this area (if there are any) should be fixed then anyways.

@ibraheemdev ibraheemdev force-pushed the ibraheem/literal-origins branch from 5919567 to fb64628 Compare February 5, 2026 21:56
@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 5, 2026

Typing conformance results

No changes detected ✅

diagnostic_builder.into_diagnostic(format_args!("Unsupported `{}` operation", error.op));

if left_ty == right_ty {
if left_ty.is_equivalent_to(db, right_ty) {
Copy link
Member Author

@ibraheemdev ibraheemdev Feb 5, 2026

Choose a reason for hiding this comment

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

This doesn't seem exactly correct, this diagnostic might really want type equality, not equivalence. However, the promotable and unpromotable form of the same literal value are not equal by salsa ID equality, so this can lead to odd diagnostics (e.g., "values are of types Literal[1] and Literal[1]"). Maybe we need another semantic equality operation for cases like this?

Copy link
Member

@AlexWaygood AlexWaygood Feb 6, 2026

Choose a reason for hiding this comment

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

From what I can tell, this change seems to lead to a lot of diagnostics improving their error message on e.g. pandas TBH (where there are two operands with differently ordered, but equivalent, unions, the error message is much improved as a result of this change IMO). It could even be worth pulling it out as a standalone change to reduce the ecosystem diff on this PR

@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 5, 2026

mypy_primer results

Changes were detected when running on open source projects
spack (https://github.com/spack/spack)
- lib/spack/spack/llnl/util/filesystem.py:1668:35: error[invalid-argument-type] Argument to function `exists` is incorrect: Expected `int | str | bytes | PathLike[str] | PathLike[bytes]`, found `Unknown | Sized`
+ lib/spack/spack/llnl/util/filesystem.py:1668:35: error[invalid-argument-type] Argument to function `exists` is incorrect: Expected `int | str | bytes | PathLike[str] | PathLike[bytes]`, found `Sized | Unknown`
- lib/spack/spack/llnl/util/filesystem.py:1674:25: error[invalid-argument-type] Argument to function `move` is incorrect: Expected `str | PathLike[str]`, found `Unknown | Sized`
+ lib/spack/spack/llnl/util/filesystem.py:1674:25: error[invalid-argument-type] Argument to function `move` is incorrect: Expected `str | PathLike[str]`, found `Sized | Unknown`
- 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: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: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: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: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: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:69: 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]]`

aiortc (https://github.com/aiortc/aiortc)
- src/aiortc/sdp.py:446:52: error[invalid-argument-type] Argument is incorrect: Expected `str`, found `None | str | Unknown`
+ src/aiortc/sdp.py:446:52: error[invalid-argument-type] Argument is incorrect: Expected `str`, found `None | Unknown | str`

kopf (https://github.com/nolar/kopf)
- kopf/on.py:924:22: error[invalid-assignment] Object of type `frozenset[Unknown | str]` is not assignable to `Collection[Literal["CREATE", "UPDATE", "DELETE", "CONNECT"]] | None`
- Found 295 diagnostics
+ Found 294 diagnostics

rich (https://github.com/Textualize/rich)
- tests/test_tools.py:17:17: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Iterable[tuple[bool, Unknown | str]]`
+ tests/test_tools.py:17:17: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Iterable[tuple[bool, str | Unknown]]`
- tests/test_tools.py:18:17: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Iterable[tuple[bool, Unknown | str]]`
+ tests/test_tools.py:18:17: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Iterable[tuple[bool, str | Unknown]]`
- tests/test_tools.py:19:17: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Iterable[tuple[bool, Unknown | str]]`
+ tests/test_tools.py:19:17: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Iterable[tuple[bool, str | Unknown]]`
- tests/test_tools.py:20:17: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Iterable[tuple[bool, Unknown | str]]`
+ tests/test_tools.py:20:17: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Iterable[tuple[bool, str | Unknown]]`

sockeye (https://github.com/awslabs/sockeye)
- sockeye/output_handler.py:254:80: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[Unknown | list[str]]`, found `list[list[str]] | None`
+ sockeye/output_handler.py:254:80: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[list[str] | Unknown]`, found `list[list[str]] | None`

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

apprise (https://github.com/caronc/apprise)
- apprise/plugins/fortysixelks.py:161:23: error[invalid-assignment] Object of type `list[(str & ~Literal[""]) | None]` is not assignable to `Iterable[str] | None`
+ apprise/plugins/fortysixelks.py:161:23: error[invalid-assignment] Object of type `list[(LiteralString & ~Literal[""]) | None]` is not assignable to `Iterable[str] | None`

meson (https://github.com/mesonbuild/meson)
- mesonbuild/backend/ninjabackend.py:1159:65: error[invalid-argument-type] Argument is incorrect: Expected `list[tuple[str, Literal["cpp", "fortran"]]]`, found `list[tuple[str, str]]`
- mesonbuild/build.py:1052:29: error[invalid-assignment] Invalid subscript assignment with key of type `(Unknown & ~Literal["rust"]) | (str & ~Literal["rust"])` and value of type `Unknown | Compiler` on object of type `dict[Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals], Compiler]`
- mesonbuild/build.py:1052:56: error[invalid-argument-type] Method `__getitem__` of type `bound method dict[Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals], Compiler].__getitem__(key: Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals], /) -> Compiler` cannot be called with key of type `str` on object of type `dict[Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals], Compiler]`
- mesonbuild/build.py:1054:29: error[invalid-assignment] Invalid subscript assignment with key of type `(Unknown & ~Literal["rust"]) | (str & ~Literal["rust"])` and value of type `Unknown | Compiler` on object of type `dict[Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals], Compiler]`
- mesonbuild/build.py:1054:52: error[invalid-argument-type] Method `__getitem__` of type `bound method dict[Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals], Compiler].__getitem__(key: Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals], /) -> Compiler` cannot be called with key of type `str` on object of type `dict[Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals], Compiler]`
- mesonbuild/build.py:1617:34: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals]`, found `Unknown | str`
- mesonbuild/build.py:1695:36: error[invalid-argument-type] Method `__getitem__` of type `bound method dict[Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals], Compiler].__getitem__(key: Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals], /) -> Compiler` cannot be called with key of type `str` on object of type `dict[Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals], Compiler]`
- mesonbuild/build.py:3121:58: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals], Compiler]`, found `dict[Unknown | str, Unknown | Compiler]`
- mesonbuild/build.py:3121:69: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `BuildTargetKeywordArguments`, found `dict[Unknown | str, Unknown | bool | dict[Unknown | str, Unknown | list[str]] | list[IncludeDirs] | list[Dependency]]`
+ mesonbuild/build.py:3121:69: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `BuildTargetKeywordArguments`, found `dict[Unknown | str, Unknown | bool | dict[Unknown | Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals], Unknown | list[str]] | list[IncludeDirs] | list[Dependency]]`
- mesonbuild/compilers/compilers.py:1287:78: error[invalid-argument-type] Argument to bound method `get` is incorrect: Expected `Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals]`, found `str`
- mesonbuild/dependencies/cuda.py:86:16: error[invalid-return-type] Return type does not match returned value: expected `Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals]`, found `str`
- mesonbuild/dependencies/cuda.py:137:76: error[invalid-argument-type] Argument to function `version_compare_many` is incorrect: Expected `str`, found `str | None | Unknown`
+ mesonbuild/dependencies/cuda.py:137:76: error[invalid-argument-type] Argument to function `version_compare_many` is incorrect: Expected `str`, found `Unknown | str | None`
- mesonbuild/interpreter/compiler.py:563:32: error[invalid-argument-type] Method `__getitem__` of type `bound method dict[Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals], Compiler].__getitem__(key: Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals], /) -> Compiler` cannot be called with key of type `str` on object of type `dict[Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals], Compiler]`
- Found 2217 diagnostics
+ Found 2206 diagnostics

pyodide (https://github.com/pyodide/pyodide)
- pyodide-build/pyodide_build/recipe/skeleton.py:273:47: error[invalid-argument-type] Argument to function `_find_dist` is incorrect: Expected `list[Literal["wheel", "sdist"]]`, found `list[Unknown | str]`
+ pyodide-build/pyodide_build/recipe/skeleton.py:273:47: error[invalid-argument-type] Argument to function `_find_dist` is incorrect: Expected `list[Literal["wheel", "sdist"]]`, found `list[Unknown | Literal["wheel", "sdist"]] | list[Unknown | str]`
- pyodide-build/pyodide_build/recipe/skeleton.py:418:47: error[invalid-argument-type] Argument to function `_find_dist` is incorrect: Expected `list[Literal["wheel", "sdist"]]`, found `list[Unknown | str]`
- Found 941 diagnostics
+ Found 940 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`
- tests/unittests/test_ds_identify.py:468:19: error[unresolved-attribute] Attribute `split` is not defined on `list[Unknown | dict[Unknown | str, Unknown | str | int]]`, `dict[Unknown | str, Unknown | str]`, `list[Unknown | str]` in union `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str | int]] | dict[Unknown | str, Unknown | str] | list[Unknown | str]`
+ tests/unittests/test_ds_identify.py:468:19: error[unresolved-attribute] Attribute `split` is not defined on `list[Unknown | dict[Unknown | str, Unknown | str | int]]`, `dict[Unknown | str, Unknown | str]`, `list[Unknown | str]`, `dict[Unknown | LiteralString, Unknown | str]` in union `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str | int]] | ... omitted 3 union elements`
- tests/unittests/test_ds_identify.py:987:9: error[unresolved-attribute] Attribute `append` is not defined on `str`, `dict[Unknown | str, Unknown | str]` in union `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str | int]] | dict[Unknown | str, Unknown | str] | list[Unknown | str]`
+ tests/unittests/test_ds_identify.py:987:9: error[unresolved-attribute] Attribute `append` is not defined on `str`, `dict[Unknown | str, Unknown | str]`, `dict[Unknown | LiteralString, Unknown | str]` in union `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str | int]] | ... omitted 3 union elements`
+ tests/unittests/test_ds_identify.py:1028:9: error[no-matching-overload] No overload of bound method `update` matches arguments
- tests/unittests/test_ds_identify.py:1028:9: error[unresolved-attribute] Attribute `update` is not defined on `str`, `list[Unknown | dict[Unknown | str, Unknown | str | int]]`, `list[Unknown | str]` in union `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str | int]] | dict[Unknown | str, Unknown | str] | list[Unknown | str]`
+ tests/unittests/test_ds_identify.py:1028:9: error[unresolved-attribute] Attribute `update` is not defined on `str`, `list[Unknown | dict[Unknown | str, Unknown | str | int]]`, `list[Unknown | str]` in union `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str | int]] | ... omitted 3 union elements`
+ tests/unittests/test_ds_identify.py:1044:9: error[no-matching-overload] No overload of bound method `update` matches arguments
- tests/unittests/test_ds_identify.py:1044:9: error[unresolved-attribute] Attribute `update` is not defined on `str`, `list[Unknown | dict[Unknown | str, Unknown | str | int]]`, `list[Unknown | str]` in union `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str | int]] | dict[Unknown | str, Unknown | str] | list[Unknown | str]`
+ tests/unittests/test_ds_identify.py:1044:9: error[unresolved-attribute] Attribute `update` is not defined on `str`, `list[Unknown | dict[Unknown | str, Unknown | str | int]]`, `list[Unknown | str]` in union `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str | int]] | ... omitted 3 union elements`
- tests/unittests/test_ds_identify.py:1449:9: error[unresolved-attribute] Attribute `append` is not defined on `str`, `dict[Unknown | str, Unknown | str]` in union `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str | int]] | dict[Unknown | str, Unknown | str] | list[Unknown | str]`
- tests/unittests/test_ds_identify.py:1456:9: error[unresolved-attribute] Attribute `append` is not defined on `str`, `dict[Unknown | str, Unknown | str]` in union `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str | int]] | dict[Unknown | str, Unknown | str] | list[Unknown | str]`
- tests/unittests/test_ds_identify.py:1465:9: error[unresolved-attribute] Attribute `append` is not defined on `str`, `dict[Unknown | str, Unknown | str]` in union `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str | int]] | dict[Unknown | str, Unknown | str] | list[Unknown | str]`
- tests/unittests/test_ds_identify.py:1478:9: error[unresolved-attribute] Attribute `append` is not defined on `str`, `dict[Unknown | str, Unknown | str]` in union `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str | int]] | dict[Unknown | str, Unknown | str] | list[Unknown | str]`
+ tests/unittests/test_ds_identify.py:1449:9: error[unresolved-attribute] Attribute `append` is not defined on `str`, `dict[Unknown | str, Unknown | str]`, `dict[Unknown | LiteralString, Unknown | str]` in union `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str | int]] | ... omitted 3 union elements`
+ tests/unittests/test_ds_identify.py:1456:9: error[unresolved-attribute] Attribute `append` is not defined on `str`, `dict[Unknown | str, Unknown | str]`, `dict[Unknown | LiteralString, Unknown | str]` in union `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str | int]] | ... omitted 3 union elements`
+ tests/unittests/test_ds_identify.py:1465:9: error[unresolved-attribute] Attribute `append` is not defined on `str`, `dict[Unknown | str, Unknown | str]`, `dict[Unknown | LiteralString, Unknown | str]` in union `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str | int]] | ... omitted 3 union elements`
+ tests/unittests/test_ds_identify.py:1478:9: error[unresolved-attribute] Attribute `append` is not defined on `str`, `dict[Unknown | str, Unknown | str]`, `dict[Unknown | LiteralString, Unknown | str]` in union `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str | int]] | ... omitted 3 union elements`
- tests/unittests/test_ds_identify.py:1499:9: error[unresolved-attribute] Attribute `append` is not defined on `str`, `dict[Unknown | str, Unknown | str]` in union `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str | int]] | dict[Unknown | str, Unknown | str] | list[Unknown | str]`
- tests/unittests/test_ds_identify.py:1517:9: error[unresolved-attribute] Attribute `append` is not defined on `str`, `dict[Unknown | str, Unknown | str]` in union `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str | int]] | dict[Unknown | str, Unknown | str] | list[Unknown | str]`
+ tests/unittests/test_ds_identify.py:1499:9: error[unresolved-attribute] Attribute `append` is not defined on `str`, `dict[Unknown | str, Unknown | str]`, `dict[Unknown | LiteralString, Unknown | str]` in union `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str | int]] | ... omitted 3 union elements`
+ tests/unittests/test_ds_identify.py:1517:9: error[unresolved-attribute] Attribute `append` is not defined on `str`, `dict[Unknown | str, Unknown | str]`, `dict[Unknown | LiteralString, Unknown | str]` in union `Unknown | str | list[Unknown | dict[Unknown | str, Unknown | str | int]] | ... omitted 3 union elements`
- Found 1150 diagnostics
+ Found 1152 diagnostics

manticore (https://github.com/trailofbits/manticore)
- manticore/core/smtlib/solver.py:559:22: error[unsupported-operator] Operator `+` is not supported between objects of type `int | bytes | Unknown` and `Unknown | int | bytes`
+ manticore/core/smtlib/solver.py:559:22: error[unsupported-operator] Operator `+` is not supported between two objects of type `int | bytes | Unknown`

xarray (https://github.com/pydata/xarray)
- xarray/backends/writers.py:207:20: error[invalid-return-type] Return type does not match returned value: expected `Literal["netcdf4", "h5netcdf", "scipy"]`, found `str`
- Found 1713 diagnostics
+ Found 1712 diagnostics

altair (https://github.com/vega/altair)
- altair/vegalite/v6/api.py:4172:47: error[invalid-argument-type] Argument to bound method `to_dict` is incorrect: Expected `bool`, found `bool | str | list[str] | ... omitted 3 union elements`
+ altair/vegalite/v6/api.py:4172:47: error[invalid-argument-type] Argument to bound method `to_dict` is incorrect: Expected `bool`, found `bool | Literal["vega-lite", "vega"] | list[str] | ... omitted 3 union elements`
- altair/vegalite/v6/api.py:4172:47: error[invalid-argument-type] Argument to bound method `to_dict` is incorrect: Expected `Literal["vega-lite", "vega"]`, found `bool | str | list[str] | ... omitted 3 union elements`
+ altair/vegalite/v6/api.py:4172:47: error[invalid-argument-type] Argument to bound method `to_dict` is incorrect: Expected `Literal["vega-lite", "vega"]`, found `bool | Literal["vega-lite", "vega"] | list[str] | ... omitted 3 union elements`
- altair/vegalite/v6/api.py:4172:47: error[invalid-argument-type] Argument to bound method `to_dict` is incorrect: Expected `list[str] | None`, found `bool | str | list[str] | ... omitted 3 union elements`
+ altair/vegalite/v6/api.py:4172:47: error[invalid-argument-type] Argument to bound method `to_dict` is incorrect: Expected `list[str] | None`, found `bool | Literal["vega-lite", "vega"] | list[str] | ... omitted 3 union elements`
- altair/vegalite/v6/api.py:4172:47: error[invalid-argument-type] Argument to bound method `to_dict` is incorrect: Expected `dict[str, Any] | None`, found `bool | str | list[str] | ... omitted 3 union elements`
+ altair/vegalite/v6/api.py:4172:47: error[invalid-argument-type] Argument to bound method `to_dict` is incorrect: Expected `dict[str, Any] | None`, found `bool | Literal["vega-lite", "vega"] | list[str] | ... omitted 3 union elements`
- altair/vegalite/v6/api.py:4173:32: error[invalid-argument-type] Argument to bound method `to_dict` is incorrect: Expected `bool`, found `bool | str | list[str] | ... omitted 3 union elements`
+ altair/vegalite/v6/api.py:4173:32: error[invalid-argument-type] Argument to bound method `to_dict` is incorrect: Expected `bool`, found `bool | Literal["vega-lite", "vega"] | list[str] | ... omitted 3 union elements`
- altair/vegalite/v6/api.py:4173:32: error[invalid-argument-type] Argument to bound method `to_dict` is incorrect: Expected `Literal["vega-lite", "vega"]`, found `bool | str | list[str] | ... omitted 3 union elements`
+ altair/vegalite/v6/api.py:4173:32: error[invalid-argument-type] Argument to bound method `to_dict` is incorrect: Expected `Literal["vega-lite", "vega"]`, found `bool | Literal["vega-lite", "vega"] | list[str] | ... omitted 3 union elements`
- altair/vegalite/v6/api.py:4173:32: error[invalid-argument-type] Argument to bound method `to_dict` is incorrect: Expected `list[str] | None`, found `bool | str | list[str] | ... omitted 3 union elements`
+ altair/vegalite/v6/api.py:4173:32: error[invalid-argument-type] Argument to bound method `to_dict` is incorrect: Expected `list[str] | None`, found `bool | Literal["vega-lite", "vega"] | list[str] | ... omitted 3 union elements`
- altair/vegalite/v6/api.py:4173:32: error[invalid-argument-type] Argument to bound method `to_dict` is incorrect: Expected `dict[str, Any] | None`, found `bool | str | list[str] | ... omitted 3 union elements`
+ altair/vegalite/v6/api.py:4173:32: error[invalid-argument-type] Argument to bound method `to_dict` is incorrect: Expected `dict[str, Any] | None`, found `bool | Literal["vega-lite", "vega"] | list[str] | ... omitted 3 union elements`

dd-trace-py (https://github.com/DataDog/dd-trace-py)
- ddtrace/appsec/_exploit_prevention/stack_traces.py:65:25: error[unsupported-operator] Operator `*` is not supported between objects of type `Unknown | EnvVariable[int]` and `Unknown | EnvVariable[float | int]`
+ ddtrace/appsec/_exploit_prevention/stack_traces.py:65:25: error[unsupported-operator] Operator `*` is not supported between objects of type `Unknown | EnvVariable[int]` and `Unknown | EnvVariable[int | float]`
- ddtrace/appsec/_handlers.py:410:13: error[invalid-argument-type] Argument to bound method `add_configurations` is incorrect: Expected `list[tuple[str, str, str]]`, found `list[Unknown | tuple[str, int, Unknown]]`
+ ddtrace/appsec/_handlers.py:410:13: error[invalid-argument-type] Argument to bound method `add_configurations` is incorrect: Expected `list[tuple[str, str, str]]`, found `list[Unknown | tuple[Literal["DD_APPSEC_ENABLED"], int, Unknown]]`
- tests/tracer/test_span.py:193:29: error[invalid-argument-type] Argument to bound method `set_metric` is incorrect: Expected `int | float`, found `int | float | complex | ... 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`

AutoSplit (https://github.com/Toufool/AutoSplit)
- src/user_profile.py:145:44: error[invalid-assignment] Invalid assignment to key "screenshot_on" with declared type `list[Literal["split", "start", "pause", "reset", "skip", "undo"]]` on TypedDict `UserProfileDict`: value of type `list[str]`
- Found 32 diagnostics
+ Found 31 diagnostics

bokeh (https://github.com/bokeh/bokeh)
- src/bokeh/embed/bundle.py:184:37: error[invalid-argument-type] Argument to bound method `clone` is incorrect: Expected `list[Literal["bokeh", "bokeh-gl", "bokeh-widgets", "bokeh-tables", "bokeh-mathjax", "bokeh-api"]] | None`, found `list[str]`
- src/bokeh/plotting/_figure.py:213:55: error[invalid-argument-type] Argument to function `process_axis_and_grid` is incorrect: Expected `Literal["above", "below", "left", "right"] | None`, found `Unknown | Nullable[Any | Literal["below"]]`
+ src/bokeh/plotting/_figure.py:213:55: error[invalid-argument-type] Argument to function `process_axis_and_grid` is incorrect: Expected `Literal["above", "below", "left", "right"] | None`, found `Unknown | Nullable[Any | str]`
- src/bokeh/plotting/_figure.py:214:55: error[invalid-argument-type] Argument to function `process_axis_and_grid` is incorrect: Expected `Literal["above", "below", "left", "right"] | None`, found `Unknown | Nullable[Any | Literal["left"]]`
+ src/bokeh/plotting/_figure.py:214:55: error[invalid-argument-type] Argument to function `process_axis_and_grid` is incorrect: Expected `Literal["above", "below", "left", "right"] | None`, found `Unknown | Nullable[Any | str]`
- src/bokeh/plotting/_figure.py:221:13: error[invalid-argument-type] Argument to function `process_active_tools` is incorrect: Expected `Drag | str | None`, found `Unknown | Nullable[Any | Literal["auto"]]`
+ src/bokeh/plotting/_figure.py:221:13: error[invalid-argument-type] Argument to function `process_active_tools` is incorrect: Expected `Drag | str | None`, found `Unknown | Nullable[Any | str]`
- src/bokeh/plotting/_figure.py:222:13: error[invalid-argument-type] Argument to function `process_active_tools` is incorrect: Expected `list[InspectTool] | InspectTool | str | None`, found `Unknown | Nullable[Any | Literal["auto"]]`
+ src/bokeh/plotting/_figure.py:222:13: error[invalid-argument-type] Argument to function `process_active_tools` is incorrect: Expected `list[InspectTool] | InspectTool | str | None`, found `Unknown | Nullable[Any | str]`
- src/bokeh/plotting/_figure.py:223:13: error[invalid-argument-type] Argument to function `process_active_tools` is incorrect: Expected `Scroll | str | None`, found `Unknown | Nullable[Any | Literal["auto"]]`
+ src/bokeh/plotting/_figure.py:223:13: error[invalid-argument-type] Argument to function `process_active_tools` is incorrect: Expected `Scroll | str | None`, found `Unknown | Nullable[Any | str]`
- src/bokeh/plotting/_figure.py:224:13: error[invalid-argument-type] Argument to function `process_active_tools` is incorrect: Expected `Tap | str | None`, found `Unknown | Nullable[Any | Literal["auto"]]`
+ src/bokeh/plotting/_figure.py:224:13: error[invalid-argument-type] Argument to function `process_active_tools` is incorrect: Expected `Tap | str | None`, found `Unknown | Nullable[Any | str]`
- src/bokeh/plotting/_figure.py:225:13: error[invalid-argument-type] Argument to function `process_active_tools` is incorrect: Expected `GestureTool | str | None`, found `Unknown | Nullable[Any | Literal["auto"]]`
+ src/bokeh/plotting/_figure.py:225:13: error[invalid-argument-type] Argument to function `process_active_tools` is incorrect: Expected `GestureTool | str | None`, found `Unknown | Nullable[Any | str]`
- src/bokeh/settings.py:747:46: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `((str | int | None, /) -> Literal["none", "debug"] | int | None) | None`, found `def convert_logging(value: str | int) -> int | None`
+ src/bokeh/settings.py:747:46: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `((str | int | None, /) -> str | int | None) | None`, found `def convert_logging(value: str | int) -> int | None`
- Found 852 diagnostics
+ Found 851 diagnostics

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[str | Buffer | Unknown]`
+ 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:428:13: error[invalid-assignment] Object of type `frozenset[str | Unknown]` is not assignable to `tuple[str | Column, ...]`
+ ibis/selectors.py:428:13: error[invalid-assignment] Object of type `frozenset[Unknown | str]` is not assignable to `tuple[str | Column, ...]`
- ibis/tests/expr/test_table.py:2010:9: error[invalid-argument-type] Argument to bound method `pivot_longer` is incorrect: Expected `((str, /) -> Value) | Mapping[str, (str, /) -> Value] | None`, found `dict[str, Overload[(self: LiteralString) -> str, (self) -> str] | <class 'int'>]`
+ ibis/tests/expr/test_table.py:2010:9: error[invalid-argument-type] Argument to bound method `pivot_longer` is incorrect: Expected `((str, /) -> Value) | Mapping[str, (str, /) -> Value] | None`, found `dict[str, Overload[(self: LiteralString) -> LiteralString, (self) -> str] | <class 'int'>]`
- ibis/tests/expr/test_table.py:2033:13: error[invalid-argument-type] Argument to bound method `pivot_longer` is incorrect: Expected `((str, /) -> Value) | Mapping[str, (str, /) -> Value] | None`, found `dict[str, Overload[(self: LiteralString) -> str, (self) -> str] | <class 'int'>]`
+ ibis/tests/expr/test_table.py:2033:13: error[invalid-argument-type] Argument to bound method `pivot_longer` is incorrect: Expected `((str, /) -> Value) | Mapping[str, (str, /) -> Value] | None`, found `dict[str, Overload[(self: LiteralString) -> LiteralString, (self) -> str] | <class 'int'>]`

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/arrays/arrow/array.py:2119:70: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- pandas/core/arrays/interval.py:979:73: error[invalid-argument-type] Argument to bound method `_ensure_simple_new_inputs` is incorrect: Expected `Literal["left", "right", "both", "neither"] | None`, found `Unknown | str`
+ pandas/core/arrays/string_.py:1040:39: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- pandas/io/json/_json.py:1069:38: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `ExtensionDtype | str | dtype[Any] | ... omitted 3 union elements`, found `Unknown | bool | None | str | _NoDefault`
+ pandas/io/json/_json.py:1069:38: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `ExtensionDtype | str | dtype[Any] | ... omitted 3 union elements`, found `Unknown | bool | None | Literal["pyarrow", "numpy_nullable"] | _NoDefault`
- pandas/io/json/_json.py:1069:38: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | bool | None | str | _NoDefault`
+ pandas/io/json/_json.py:1069:38: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | bool | None | Literal["pyarrow", "numpy_nullable"] | _NoDefault`
- pandas/io/json/_json.py:1069:38: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool | list[str]`, found `Unknown | bool | None | str | _NoDefault`
+ pandas/io/json/_json.py:1069:38: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool | list[str]`, found `Unknown | bool | None | Literal["pyarrow", "numpy_nullable"] | _NoDefault`
- pandas/io/json/_json.py:1069:38: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | bool | None | str | _NoDefault`
+ pandas/io/json/_json.py:1069:38: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | bool | None | Literal["pyarrow", "numpy_nullable"] | _NoDefault`
- pandas/io/json/_json.py:1069:38: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | bool | None | str | _NoDefault`
+ pandas/io/json/_json.py:1069:38: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | bool | None | Literal["pyarrow", "numpy_nullable"] | _NoDefault`
- pandas/io/json/_json.py:1069:38: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Literal["pyarrow", "numpy_nullable"] | _NoDefault`, found `Unknown | bool | None | str | _NoDefault`
+ pandas/io/json/_json.py:1069:38: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Literal["pyarrow", "numpy_nullable"] | _NoDefault`, found `Unknown | bool | None | Literal["pyarrow", "numpy_nullable"] | _NoDefault`
- pandas/io/json/_json.py:1073:39: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `ExtensionDtype | str | dtype[Any] | ... omitted 3 union elements`, found `Unknown | bool | None | str | _NoDefault`
+ pandas/io/json/_json.py:1073:39: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `ExtensionDtype | str | dtype[Any] | ... omitted 3 union elements`, found `Unknown | bool | None | Literal["pyarrow", "numpy_nullable"] | _NoDefault`
- pandas/io/json/_json.py:1073:39: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | bool | None | str | _NoDefault`
+ pandas/io/json/_json.py:1073:39: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | bool | None | Literal["pyarrow", "numpy_nullable"] | _NoDefault`
- pandas/io/json/_json.py:1073:39: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool | list[str]`, found `Unknown | bool | None | str | _NoDefault`
+ pandas/io/json/_json.py:1073:39: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool | list[str]`, found `Unknown | bool | None | Literal["pyarrow", "numpy_nullable"] | _NoDefault`
- pandas/io/json/_json.py:1073:39: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | bool | None | str | _NoDefault`
+ pandas/io/json/_json.py:1073:39: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | bool | None | Literal["pyarrow", "numpy_nullable"] | _NoDefault`
- pandas/io/json/_json.py:1073:39: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | bool | None | str | _NoDefault`
+ pandas/io/json/_json.py:1073:39: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | bool | None | Literal["pyarrow", "numpy_nullable"] | _NoDefault`
- pandas/io/json/_json.py:1073:39: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Literal["pyarrow", "numpy_nullable"] | _NoDefault`, found `Unknown | bool | None | str | _NoDefault`
+ pandas/io/json/_json.py:1073:39: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Literal["pyarrow", "numpy_nullable"] | _NoDefault`, found `Unknown | bool | None | Literal["pyarrow", "numpy_nullable"] | _NoDefault`
- pandas/tests/scalar/period/test_arithmetic.py:452:17: error[unsupported-operator] Operator `>` is not supported between objects of type `Unknown | Period | int` and `Unknown | int | Period`
+ pandas/tests/scalar/period/test_arithmetic.py:452:17: error[unsupported-operator] Operator `>` is not supported between two objects of type `Unknown | Period | int`
- pandas/tests/scalar/period/test_arithmetic.py:454:17: error[unsupported-operator] Operator `>=` is not supported between objects of type `Unknown | Period | int` and `Unknown | int | Period`
+ pandas/tests/scalar/period/test_arithmetic.py:454:17: error[unsupported-operator] Operator `>=` is not supported between two objects of type `Unknown | Period | int`
- pandas/tests/scalar/period/test_arithmetic.py:456:17: error[unsupported-operator] Operator `<` is not supported between objects of type `Unknown | Period | int` and `Unknown | int | Period`
+ pandas/tests/scalar/period/test_arithmetic.py:456:17: error[unsupported-operator] Operator `<` is not supported between two objects of type `Unknown | Period | int`
- pandas/tests/scalar/period/test_arithmetic.py:458:17: error[unsupported-operator] Operator `<=` is not supported between objects of type `Unknown | Period | int` and `Unknown | int | Period`
+ pandas/tests/scalar/period/test_arithmetic.py:458:17: error[unsupported-operator] Operator `<=` is not supported between two objects of type `Unknown | Period | int`
- pandas/tests/scalar/period/test_arithmetic.py:471:24: error[unsupported-operator] Operator `<` is not supported between objects of type `Unknown | NaTType | Period | Timestamp` and `Unknown | Period | NaTType | Timestamp`
+ pandas/tests/scalar/period/test_arithmetic.py:471:24: error[unsupported-operator] Operator `<` is not supported between two objects of type `Unknown | NaTType | Period | Timestamp`
- pandas/tests/scalar/period/test_arithmetic.py:472:24: error[unsupported-operator] Operator `>` is not supported between objects of type `Unknown | NaTType | Period | Timestamp` and `Unknown | Period | NaTType | Timestamp`
+ pandas/tests/scalar/period/test_arithmetic.py:472:24: error[unsupported-operator] Operator `>` is not supported between two objects of type `Unknown | NaTType | Period | Timestamp`
- pandas/tests/scalar/period/test_arithmetic.py:475:24: error[unsupported-operator] Operator `<=` is not supported between objects of type `Unknown | NaTType | Period | Timestamp` and `Unknown | Period | NaTType | Timestamp`
+ pandas/tests/scalar/period/test_arithmetic.py:475:24: error[unsupported-operator] Operator `<=` is not supported between two objects of type `Unknown | NaTType | Period | Timestamp`
- pandas/tests/scalar/period/test_arithmetic.py:476:24: error[unsupported-operator] Operator `>=` is not supported between objects of type `Unknown | NaTType | Period | Timestamp` and `Unknown | Period | NaTType | Timestamp`
+ pandas/tests/scalar/period/test_arithmetic.py:476:24: error[unsupported-operator] Operator `>=` is not supported between two objects of type `Unknown | NaTType | Period | Timestamp`
- pandas/tests/scalar/timedelta/test_arithmetic.py:1201:13: error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | Timedelta | str` and `Unknown | str | Timedelta`
+ pandas/tests/scalar/timedelta/test_arithmetic.py:1201:13: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | Timedelta | str`
- pandas/tests/scalar/timedelta/test_arithmetic.py:1205:13: error[unsupported-operator] Operator `>` is not supported between objects of type `Unknown | Timedelta | str` and `Unknown | str | Timedelta`
+ pandas/tests/scalar/timedelta/test_arithmetic.py:1205:13: error[unsupported-operator] Operator `>` is not supported between two objects of type `Unknown | Timedelta | str`
- pandas/tests/series/test_cumulative.py:48:20: error[invalid-argument-type] Argument to bound method `accumulate` is incorrect: Argument type `_UFunc_Nin2_Nout1[str, int, None]` does not satisfy upper bound `_UFunc_Nin2_Nout1[_NameType@_UFunc_Nin2_Nout1, _NTypes@_UFunc_Nin2_Nout1, _IDType@_UFunc_Nin2_Nout1]` of type variable `Self`
- pandas/tests/series/test_cumulative.py:54:20: error[invalid-argument-type] Argument to bound method `accumulate` is incorrect: Argument type `_UFunc_Nin2_Nout1[str, int, None]` does not satisfy upper bound `_UFunc_Nin2_Nout1[_NameType@_UFunc_Nin2_Nout1, _NTypes@_UFunc_Nin2_Nout1, _IDType@_UFunc_Nin2_Nout1]` of type variable `Self`
- pandas/tests/series/test_cumulative.py:154:20: error[invalid-argument-type] Argument to bound method `accumulate` is incorrect: Argument type `_UFunc_Nin2_Nout1[str, int, None]` does not satisfy upper bound `_UFunc_Nin2_Nout1[_NameType@_UFunc_Nin2_Nout1, _NTypes@_UFunc_Nin2_Nout1, _IDType@_UFunc_Nin2_Nout1]` of type variable `Self`
- Found 4453 diagnostics
+ Found 4451 diagnostics

sympy (https://github.com/sympy/sympy)
- sympy/algebras/tests/test_quaternion.py:422:33: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/codegen/tests/test_matrix_nodes.py:27:21: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/geometry/tests/test_util.py:128:55: error[invalid-argument-type] Argument to function `subsets` is incorrect: Expected `Sequence[Unknown]`, found `set[Point2D | Unknown]`
+ sympy/geometry/tests/test_util.py:128:55: error[invalid-argument-type] Argument to function `subsets` is incorrect: Expected `Sequence[Unknown]`, found `set[Unknown | Point2D]`
- sympy/matrices/eigen.py:1202:37: error[unresolved-attribute] Object of type `T2'return@call_highest_priority | T1'return@call_highest_priority` has no attribute `pow`
- sympy/matrices/expressions/tests/test_blockmatrix.py:235:13: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/expressions/tests/test_blockmatrix.py:235:33: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/expressions/tests/test_blockmatrix.py:235:53: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/expressions/tests/test_blockmatrix.py:459:12: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/expressions/tests/test_derivatives.py:551:26: error[unsupported-operator] Operator `+` is not supported between two objects of type `MatrixBase | Expr`
- sympy/matrices/expressions/tests/test_matadd.py:36:12: error[unsupported-operator] Operator `+` is not supported between objects of type `MatrixBase` and `MatrixBase | Expr`
- sympy/matrices/expressions/tests/test_matpow.py:124:47: error[unsupported-operator] Operator `+` is not supported between two objects of type `ImmutableDenseMatrix`
- 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:393:11: error[unsupported-operator] Operator `+` is not supported between objects of type `MatrixBase` and `MatrixBase | Expr | Unknown`
- 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:2957:16: error[invalid-return-type] Return type does not match returned value: expected `Self@_eval_pow_by_cayley`, found `Self@_eval_pow_by_cayley | T2'return@call_highest_priority | T1'return@call_highest_priority | Unknown`
- 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:4386:16: error[unsupported-operator] Operator `+` is not supported between two objects of type `Self@add`
- sympy/matrices/matrixbase.py:4923:16: error[invalid-return-type] Return type does not match returned value: expected `Self@analytic_func`, found `Self@analytic_func | T2'return@call_highest_priority | T1'return@call_highest_priority | 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:741:12: error[invalid-return-type] Return type does not match returned value: expected `Tmat@_pinv_solve`, found `T2'return@call_highest_priority | T1'return@call_highest_priority`
- sympy/matrices/tests/test_commonmatrix.py:1249:31: error[unsupported-operator] Operator `+` is not supported between objects of type `MutableDenseMatrix` and `ImmutableDenseNDimArray`
- sympy/matrices/tests/test_eigen.py:406:20: error[invalid-argument-type] Argument to function `max` is incorrect: Expected `Iterable[Unknown]`, found `MatrixBase | Unknown`
- sympy/matrices/tests/test_immutable.py:105:23: error[unsupported-operator] Operator `+` is not supported between two objects of type `ImmutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:121:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:123:32: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:141:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2179:22: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2207:26: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2908:21: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2921:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2936:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2937:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2948:14: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:3471:21: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:3478:12: error[unresolved-attribute] Attribute `rank` is not defined on `MatrixExpr` in union `MatrixBase | MatrixExpr | Unknown`
- sympy/matrices/tests/test_matrices.py:3479:12: error[unresolved-attribute] Attribute `rank` is not defined on `MatrixExpr` in union `MatrixBase | MatrixExpr | Unknown`
- sympy/matrices/tests/test_matrixbase.py:491:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:493:32: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:544:12: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:823:31: error[unsupported-operator] Operator `+` is not supported between objects of type `MutableDenseMatrix` and `ImmutableDenseNDimArray`
- sympy/matrices/tests/test_matrixbase.py:876:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:878:32: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:900:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:2931:22: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:2959:26: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:3610:21: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:3624:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:3639:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:3640:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:3652:14: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_reductions.py:377:21: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_reductions.py:384:12: error[unresolved-attribute] Attribute `rank` is not defined on `MatrixExpr` in union `MatrixBase | MatrixExpr | Unknown`
- sympy/matrices/tests/test_reductions.py:385:12: error[unresolved-attribute] Attribute `rank` is not defined on `MatrixExpr` in union `MatrixBase | MatrixExpr | Unknown`
- sympy/matrices/tests/test_solvers.py:68:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_sparse.py:573:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableSparseMatrix`
- sympy/matrices/tests/test_sparse.py:577:52: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableSparseMatrix`
- sympy/matrices/tests/test_sparse.py:593:17: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableSparseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:13:6: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:16:38: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:16:84: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:16:131: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:21:44: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:21:90: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:21:137: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:25:37: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:25:83: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:25:130: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/physics/biomechanics/curve.py:248:31: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic | Unknown` and `Unknown | Basic`
+ sympy/physics/biomechanics/curve.py:248:31: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | Unknown`
- sympy/physics/biomechanics/curve.py:250:42: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic | Unknown` and `Unknown | Basic`
+ sympy/physics/biomechanics/curve.py:250:42: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | Unknown`
- sympy/physics/biomechanics/curve.py:467:25: error[unsupported-operator] Operator `+` is not supported between objects of type `Basic | Unknown` and `Unknown | Basic`
+ sympy/physics/biomechanics/curve.py:467:25: error[unsupported-operator] Operator `+` is not supported between two objects of type `Basic | Unknown`
- sympy/physics/biomechanics/curve.py:469:37: error[unsupported-operator] Operator `+` is not supported between objects of type `Basic | Unknown` and `Unknown | Basic`
+ sympy/physics/biomechanics/curve.py:469:37: error[unsupported-operator] Operator `+` is not supported between two objects of type `Basic | Unknown`
- sympy/physics/biomechanics/curve.py:1463:27: error[unsupported-operator] Operator `*` is not supported between objects of type `Unknown | Basic` and `Basic | Unknown`
+ sympy/physics/biomechanics/curve.py:1463:27: error[unsupported-operator] Operator `*` is not supported between two objects of type `Unknown | Basic`
- sympy/physics/biomechanics/curve.py:1463:53: error[unsupported-operator] Operator `*` is not supported between objects of type `Unknown | Basic` and `Basic | Unknown`
+ sympy/physics/biomechanics/curve.py:1463:53: error[unsupported-operator] Operator `*` is not supported between two objects of type `Unknown | Basic`
- sympy/physics/biomechanics/curve.py:1465:23: error[unsupported-operator] Operator `*` is not supported between objects of type `Unknown | Basic` and `Basic | Unknown`
+ sympy/physics/biomechanics/curve.py:1465:23: error[unsupported-operator] Operator `*` is not supported between two objects of type `Unknown | Basic`
- sympy/physics/biomechanics/curve.py:1465:64: error[unsupported-operator] Operator `*` is not supported between objects of type `Unknown | Basic` and `Basic | Unknown`
+ sympy/physics/biomechanics/curve.py:1465:64: error[unsupported-operator] Operator `*` is not supported between two objects of type `Unknown | Basic`
- sympy/physics/biomechanics/curve.py:1687:27: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic | Unknown` and `Unknown | Basic`
+ sympy/physics/biomechanics/curve.py:1687:27: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | Unknown`
- sympy/physics/biomechanics/curve.py:1689:38: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic | Unknown` and `Unknown | Basic`
+ sympy/physics/biomechanics/curve.py:1689:38: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | Unknown`
- sympy/physics/control/tests/test_lti.py:3777:31: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/physics/control/tests/test_lti.py:3777:38: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/physics/mechanics/lagrange.py:222:23: error[unsupported-operator] Operator `-` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/physics/mechanics/lagrange.py:346:17: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/physics/mechanics/linearize.py:217:28: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/physics/mechanics/linearize.py:229:29: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/physics/mechanics/linearize.py:241:29: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/physics/mechanics/tests/test_jointsmethod.py:247:17: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/physics/mechanics/tests/test_jointsmethod.py:249:17: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/physics/quantum/tests/test_represent.py:89:17: error[unsupported-operator] Operator `+` is not supported between objects of type `MatrixBase | Expr` and `MatrixBase`
- sympy/physics/quantum/tests/test_represent.py:91:24: error[unsupported-operator] Operator `-` is not supported between two objects of type `MatrixBase | Expr`
- sympy/physics/quantum/tests/test_represent.py:93:28: error[unsupported-operator] Operator `+` is not supported between two objects of type `MatrixBase | Expr`
- sympy/physics/vector/functions.py:380:21: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `MatrixBase | Unknown`
- sympy/simplify/cse_main.py:299:23: error[not-iterable] Object of type `Unknown | Sized` may not be iterable
+ sympy/simplify/cse_main.py:299:23: error[not-iterable] Object of type `Sized | Unknown` may not be iterable
- sympy/simplify/cse_main.py:305:16: error[unsupported-operator] Operator `in` is not supported between objects of type `Unknown` and `Unknown | Sized`
+ sympy/simplify/cse_main.py:305:16: error[unsupported-operator] Operator `in` is not supported between objects of type `Unknown` and `Sized | Unknown`
- sympy/solvers/tests/test_numeric.py:137:11: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/solvers/tests/test_solvers.py:722:19: error[unsupported-operator] Operator `-` is not supported between two objects of type `MatrixBase | Expr`
- sympy/solvers/tests/test_solvers.py:723:19: error[unsupported-operator] Operator `-` is not supported between two objects of type `MatrixBase | Expr`
- sympy/solvers/tests/test_solvers.py:724:19: error[unsupported-operator] Operator `-` is not supported between two objects of type `MatrixBase | Expr`
- sympy/solvers/tests/test_solvers.py:724:30: error[unsupported-operator] Operator `-` is not supported between two objects of type `MatrixBase | Expr`
- sympy/stats/symbolic_probability.py:531:55: error[unresolved-attribute] Attribute `expand` is not defined on `Basic` in union `Unknown | Basic`
+ sympy/stats/symbolic_probability.py:531:55: error[unresolved-attribute] Attribute `expand` is not defined on `Basic` in union `Basic | Unknown`
- sympy/stats/symbolic_probability.py:532:55: error[unresolved-attribute] Attribute `expand` is not defined on `Basic` in union `Unknown | Basic`
+ sympy/stats/symbolic_probability.py:532:55: error[unresolved-attribute] Attribute `expand` is not defined on `Basic` in union `Basic | Unknown`
- sympy/stats/tests/test_symbolic_multivariate.py:84:36: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/stats/tests/test_symbolic_multivariate.py:84:84: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/stats/tests/test_symbolic_multivariate.py:85:36: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/tensor/tests/test_tensor.py:1693:19: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/tensor/tests/test_tensor.py:1694:23: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- Found 16085 diagnostics
+ Found 15993 diagnostics

jax (https://github.com/google/jax)
- jax/_src/export/_export.py:1376:45: error[invalid-argument-type] Argument to function `_get_named_sharding` is incorrect: Expected `ShapedArray`, found `AbstractValue | Unknown`
+ jax/_src/export/_export.py:1376:45: error[invalid-argument-type] Argument to function `_get_named_sharding` is incorrect: Expected `ShapedArray`, found `Unknown | AbstractValue`

rotki (https://github.com/rotki/rotki)
- rotkehlchen/api/services/transactions.py:304:60: error[invalid-argument-type] Argument to function `from_chain` is incorrect: Expected `Literal[SupportedBlockchain.ETHEREUM, SupportedBlockchain.OPTIMISM, SupportedBlockchain.POLYGON_POS, SupportedBlockchain.ARBITRUM_ONE, SupportedBlockchain.BASE, ... omitted 7 literals]`, found `Unknown | SupportedBlockchain`
- rotkehlchen/api/services/transactions.py:307:25: error[invalid-argument-type] Argument to bound method `reset_events_for_redecode` is incorrect: Expected `Literal[Location.ETHEREUM, Location.OPTIMISM, Location.POLYGON_POS, Location.ARBITRUM_ONE, Location.BASE, ... omitted 7 literals]`, found `Unknown | Location`
- rotkehlchen/chain/aggregator.py:390:40: error[invalid-argument-

... (truncated 66 lines) ...

(Type::LiteralValue(literal), Type::NominalInstance(instance))
if literal.is_string(db) =>
{
let value = literal.as_string(db).unwrap();
Copy link
Member Author

@ibraheemdev ibraheemdev Feb 5, 2026

Choose a reason for hiding this comment

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

Unfortunately, there are a lot of places where we have to unwrap like this due to the lack of if let guards.

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 5, 2026

Merging this PR will not alter performance

✅ 24 untouched benchmarks
⏩ 30 skipped benchmarks1


Comparing ibraheem/literal-origins (3745dc7) with main (e7c806c)

Open in CodSpeed

Footnotes

  1. 30 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 5, 2026

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-argument-type 0 24 30
invalid-await 0 40 0
unsupported-operator 0 0 23
unresolved-attribute 0 0 10
no-matching-overload 0 6 0
invalid-assignment 0 4 1
invalid-return-type 0 4 0
unused-type-ignore-comment 2 1 0
type-assertion-failure 0 1 0
Total 2 80 64

Full report with detailed diff (timing results)

@ibraheemdev ibraheemdev force-pushed the ibraheem/literal-origins branch 4 times, most recently from b33fd11 to f749fe8 Compare February 6, 2026 01:41
@ibraheemdev
Copy link
Member Author

Hmm.. a lot of the ecosystem changes seem to have gone away after rebasing on #23100.

@ibraheemdev ibraheemdev marked this pull request as ready for review February 6, 2026 01:52
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

V cool work! A few questions, some of which might help with perf

@ibraheemdev
Copy link
Member Author

I wonder if it makes sense to switch the layout so that unpromotable literals do not allocate, which is the type we infer for any annotated literal types (e.g., function parameters or return values). I assumed those would be rarer, but I'm not exactly sure where the performance regression is coming from.

@AlexWaygood
Copy link
Member

You could also possibly experiment with always interning the data held by int-Literals, keeping bool Literals always uninterned, and not distinguishing between promotable vs unpromotable Literals when it comes to whether they are interned

@ibraheemdev ibraheemdev force-pushed the ibraheem/literal-origins branch from d67da9c to 1e94b0f Compare February 6, 2026 20:03
@ibraheemdev
Copy link
Member Author

I removed the interning for both literal types, but the walltime benchmarks seem unaffected. The performance regression seems to be coming from elsewhere, maybe the type mapping?

@ibraheemdev
Copy link
Member Author

That seems to have done it.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Awesome work getting rid of the perf regression!

| Type::StringLiteral(_)
| Type::BytesLiteral(_)
| Type::EnumLiteral(_) => match type_mapping {
Type::ModuleLiteral(_) => match type_mapping {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure we should ever be promoting module-literal types TBH, but I guess that's a separate change...

@sharkdp sharkdp removed their request for review February 9, 2026 09:58
@ibraheemdev ibraheemdev force-pushed the ibraheem/literal-origins branch 2 times, most recently from ccc8647 to 506cbf5 Compare February 10, 2026 21:40
@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 10, 2026

Memory usage report

Summary

Project Old New Diff Outcome
flake8 49.74MB 49.45MB -0.58% (295.35kB) ⬇️
trio 120.63MB 119.32MB -1.08% (1.31MB) ⬇️
sphinx 276.55MB 272.07MB -1.62% (4.48MB) ⬇️
prefect 706.38MB 692.44MB -1.97% (13.94MB) ⬇️

Significant changes

Click to expand detailed breakdown

flake8

Name Old New Diff Outcome
infer_scope_types_impl 1.09MB 1012.32kB -9.25% (103.14kB) ⬇️
infer_definition_types 1.95MB 1.89MB -3.04% (60.66kB) ⬇️
infer_expression_types_impl 1.13MB 1.08MB -4.45% (51.29kB) ⬇️
infer_deferred_types 728.05kB 688.52kB -5.43% (39.53kB) ⬇️
Type<'db>::class_member_with_policy_ 574.84kB 551.55kB -4.05% (23.29kB) ⬇️
StaticClassLiteral<'db>::implicit_attribute_inner_ 313.77kB 293.88kB -6.34% (19.89kB) ⬇️
Type<'db>::member_lookup_with_policy_ 426.64kB 410.68kB -3.74% (15.97kB) ⬇️
place_by_id 155.13kB 143.30kB -7.62% (11.83kB) ⬇️
is_redundant_with_impl::interned_arguments 155.03kB 166.20kB +7.21% (11.17kB) ⬇️
is_redundant_with_impl 150.12kB 158.98kB +5.90% (8.86kB) ⬇️
IntersectionType 81.98kB 90.02kB +9.81% (8.04kB) ⬇️
StaticClassLiteral<'db>::try_mro_ 344.85kB 346.99kB +0.62% (2.14kB) ⬇️
infer_expression_type_impl 164.36kB 166.17kB +1.10% (1.80kB) ⬇️
TypeVarInstance 22.55kB 20.81kB -7.69% (1.73kB) ⬇️
infer_unpack_types 40.31kB 38.98kB -3.31% (1.34kB) ⬇️
... 10 more

trio

Name Old New Diff Outcome
infer_scope_types_impl 5.49MB 5.01MB -8.71% (489.45kB) ⬇️
infer_expression_types_impl 6.33MB 6.07MB -4.06% (262.77kB) ⬇️
infer_definition_types 7.81MB 7.59MB -2.72% (217.48kB) ⬇️
infer_deferred_types 2.47MB 2.36MB -4.66% (117.98kB) ⬇️
Type<'db>::class_member_with_policy_ 2.07MB 1.99MB -4.13% (87.75kB) ⬇️
Type<'db>::member_lookup_with_policy_ 1.76MB 1.69MB -3.71% (66.80kB) ⬇️
StaticClassLiteral<'db>::implicit_attribute_inner_ 820.93kB 769.63kB -6.25% (51.30kB) ⬇️
place_by_id 603.96kB 557.88kB -7.63% (46.08kB) ⬇️
is_redundant_with_impl::interned_arguments 557.91kB 567.10kB +1.65% (9.20kB) ⬇️
TypeVarInstance 69.27kB 63.94kB -7.69% (5.33kB) ⬇️
IntersectionType 251.67kB 256.59kB +1.96% (4.92kB) ⬇️
infer_unpack_types 152.45kB 148.06kB -2.88% (4.39kB) ⬇️
ProtocolInterface 92.26kB 88.47kB -4.11% (3.79kB) ⬇️
is_redundant_with_impl 485.16kB 487.48kB +0.48% (2.32kB) ⬇️
lookup_dunder_new_inner 71.39kB 69.70kB -2.37% (1.70kB) ⬇️
... 6 more

sphinx

Name Old New Diff Outcome
infer_scope_types_impl 17.57MB 15.82MB -9.96% (1.75MB) ⬇️
infer_expression_types_impl 23.00MB 22.04MB -4.16% (979.89kB) ⬇️
infer_definition_types 25.26MB 24.47MB -3.13% (810.65kB) ⬇️
Type<'db>::class_member_with_policy_ 7.84MB 7.55MB -3.79% (304.60kB) ⬇️
infer_deferred_types 5.89MB 5.61MB -4.79% (288.77kB) ⬇️
Type<'db>::member_lookup_with_policy_ 6.30MB 6.10MB -3.07% (198.07kB) ⬇️
StaticClassLiteral<'db>::implicit_attribute_inner_ 2.54MB 2.38MB -6.26% (162.81kB) ⬇️
place_by_id 1.49MB 1.37MB -7.72% (117.73kB) ⬇️
is_redundant_with_impl::interned_arguments 2.12MB 2.16MB +1.58% (34.29kB) ⬇️
is_redundant_with_impl 1.84MB 1.86MB +1.09% (20.55kB) ⬇️
TypeVarInstance 189.11kB 174.56kB -7.69% (14.55kB) ⬇️
infer_unpack_types 469.35kB 456.60kB -2.72% (12.75kB) ⬇️
IntersectionType 1.02MB 1.03MB +0.99% (10.34kB) ⬇️
ProtocolInterface 146.06kB 140.81kB -3.60% (5.25kB) ⬇️
StaticClassLiteral<'db>::try_mro_ 2.16MB 2.17MB +0.21% (4.70kB) ⬇️
... 28 more

prefect

Name Old New Diff Outcome
infer_scope_types_impl 59.09MB 53.16MB -10.04% (5.93MB) ⬇️
infer_definition_types 88.80MB 85.68MB -3.51% (3.12MB) ⬇️
infer_expression_types_impl 55.72MB 53.43MB -4.10% (2.28MB) ⬇️
infer_deferred_types 14.90MB 14.17MB -4.92% (751.26kB) ⬇️
Type<'db>::class_member_with_policy_ 17.07MB 16.39MB -3.98% (695.37kB) ⬇️
StaticClassLiteral<'db>::implicit_attribute_inner_ 9.93MB 9.51MB -4.21% (427.76kB) ⬇️
Type<'db>::member_lookup_with_policy_ 15.01MB 14.60MB -2.73% (419.41kB) ⬇️
place_by_id 4.84MB 4.47MB -7.53% (372.95kB) ⬇️
is_redundant_with_impl::interned_arguments 5.57MB 5.61MB +0.67% (38.24kB) ⬇️
TypeVarInstance 420.98kB 388.59kB -7.69% (32.38kB) ⬇️
infer_unpack_types 889.90kB 867.23kB -2.55% (22.67kB) ⬇️
IntersectionType 2.50MB 2.51MB +0.53% (13.65kB) ⬇️
ProtocolInterface 278.61kB 266.94kB -4.19% (11.67kB) ⬇️
lookup_dunder_new_inner 285.46kB 278.46kB -2.45% (6.99kB) ⬇️
Type<'db>::try_call_dunder_get_ 11.38MB 11.39MB +0.02% (2.81kB) ⬇️
... 18 more

Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

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

Nice work! LGTM. I haven't looked at the ecosystem; trusting that you have and it looks OK.

@ibraheemdev ibraheemdev force-pushed the ibraheem/literal-origins branch from 506cbf5 to f414505 Compare February 18, 2026 23:23
@ibraheemdev
Copy link
Member Author

There seem to be a couple new false positives on rotki, looking into those now.

@ibraheemdev
Copy link
Member Author

ibraheemdev commented Feb 19, 2026

Ecosystem results look much better now.

Note that we are no longer using the TypeContext parameter in any type mappings, I'll clean that up in a follow up PR.

@ibraheemdev ibraheemdev merged commit 96b27a7 into main Feb 19, 2026
50 checks passed
@ibraheemdev ibraheemdev deleted the ibraheem/literal-origins branch February 19, 2026 01:27
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.

Incorrect inferred type for list comprehension of asyncio.create_task

3 participants