Skip to content

[ty] improve complex TDD-based narrowing#23201

Draft
mtshiba wants to merge 27 commits intoastral-sh:mainfrom
mtshiba:improve-23109
Draft

[ty] improve complex TDD-based narrowing#23201
mtshiba wants to merge 27 commits intoastral-sh:mainfrom
mtshiba:improve-23109

Conversation

@mtshiba
Copy link
Collaborator

@mtshiba mtshiba commented Feb 10, 2026

Summary

An unsolved issue in #23109 is that the following narrowing doesn't work properly:

def _(x: int | None):
    if 1 + 1 == 2:
        if x is None:
            return

    reveal_type(x)  # revealed: int

This was attempted to be fixed in ada1084, but was abandoned due to the exponential blowup (5fd9a9c).
I've come up with a different approach to this, so I'll try it out to see if it works.

Test Plan

mdtest updated

@mtshiba mtshiba added the ty Multi-file analysis & type inference label Feb 10, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 10, 2026

Typing conformance results

No changes detected ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 10, 2026

Memory usage report

Summary

Project Old New Diff Outcome
flake8 49.73MB 49.49MB -0.48% (246.15kB) ⬇️
sphinx 276.42MB 276.02MB -0.14% (405.69kB) ⬇️
trio 120.57MB 120.08MB -0.41% (504.29kB) ⬇️
prefect 694.15MB 690.98MB -0.46% (3.17MB) ⬇️

Significant changes

Click to expand detailed breakdown

flake8

Name Old New Diff Outcome
semantic_index 15.29MB 15.05MB -1.57% (245.81kB) ⬇️
all_negative_narrowing_constraints_for_expression 35.59kB 0.00B -100.00% (35.59kB) ⬇️
all_narrowing_constraints_for_expression 65.73kB 98.22kB +49.43% (32.49kB) ⬇️
IntersectionType 81.79kB 82.88kB +1.34% (1.09kB) ⬇️
infer_expression_types_impl 1.12MB 1.12MB -0.09% (1.07kB) ⬇️
is_redundant_with_impl::interned_arguments 154.86kB 155.72kB +0.55% (880.00B) ⬇️
infer_expression_type_impl 164.36kB 165.07kB +0.43% (728.00B) ⬇️
is_redundant_with_impl 150.02kB 150.49kB +0.31% (480.00B) ⬇️
UnionType 112.00kB 112.33kB +0.29% (336.00B) ⬇️
infer_definition_types 1.95MB 1.95MB +0.01% (156.00B) ⬇️
place_table 25.08kB 25.20kB +0.47% (120.00B) ⬇️
infer_scope_types_impl 1.09MB 1.09MB +0.01% (96.00B) ⬇️

sphinx

Name Old New Diff Outcome
all_negative_narrowing_constraints_for_expression 839.38kB 0.00B -100.00% (839.38kB) ⬇️
all_narrowing_constraints_for_expression 1.82MB 2.58MB +42.19% (784.40kB) ⬇️
semantic_index 69.45MB 68.75MB -1.02% (724.27kB) ⬇️
infer_expression_type_impl 3.41MB 3.51MB +3.00% (104.55kB) ⬇️
infer_expression_types_impl 22.95MB 23.04MB +0.42% (98.93kB) ⬇️
infer_definition_types 25.23MB 25.30MB +0.28% (73.19kB) ⬇️
IntersectionType 1.02MB 1.06MB +3.60% (37.71kB) ⬇️
is_redundant_with_impl::interned_arguments 2.13MB 2.14MB +0.90% (19.59kB) ⬇️
is_redundant_with_impl 1.84MB 1.86MB +0.73% (13.83kB) ⬇️
UnionType 1.33MB 1.34MB +0.61% (8.33kB) ⬇️
infer_scope_types_impl 17.56MB 17.55MB -0.03% (4.58kB) ⬇️
Type<'db>::try_call_dunder_get_ 5.49MB 5.50MB +0.08% (4.40kB) ⬇️
Type<'db>::member_lookup_with_policy_ 6.30MB 6.30MB +0.05% (3.08kB) ⬇️
Type<'db>::class_member_with_policy_ 7.84MB 7.85MB +0.04% (2.91kB) ⬇️
Type<'db>::apply_specialization_ 1.74MB 1.75MB +0.14% (2.49kB) ⬇️
... 14 more

trio

Name Old New Diff Outcome
semantic_index 33.07MB 32.44MB -1.91% (645.78kB) ⬇️
all_narrowing_constraints_for_expression 485.54kB 638.41kB +31.48% (152.87kB) ⬇️
all_negative_narrowing_constraints_for_expression 147.71kB 0.00B -100.00% (147.71kB) ⬇️
infer_expression_types_impl 6.31MB 6.35MB +0.66% (42.74kB) ⬇️
infer_expression_type_impl 1.28MB 1.31MB +2.68% (35.06kB) ⬇️
IntersectionType 251.28kB 264.41kB +5.23% (13.13kB) ⬇️
infer_definition_types 7.80MB 7.81MB +0.16% (12.74kB) ⬇️
is_redundant_with_impl::interned_arguments 557.39kB 564.35kB +1.25% (6.96kB) ⬇️
is_redundant_with_impl 484.93kB 489.97kB +1.04% (5.04kB) ⬇️
Type<'db>::class_member_with_policy_ 2.08MB 2.08MB +0.12% (2.58kB) ⬇️
Type<'db>::try_call_dunder_get_ 1.52MB 1.52MB +0.14% (2.20kB) ⬇️
Type<'db>::member_lookup_with_policy_ 1.76MB 1.76MB +0.12% (2.10kB) ⬇️
UnionType 338.72kB 340.75kB +0.60% (2.03kB) ⬇️
Type<'db>::apply_specialization_ 770.43kB 772.23kB +0.23% (1.80kB) ⬇️
Type<'db>::class_member_with_policy_::interned_arguments 1.11MB 1.11MB +0.15% (1.73kB) ⬇️
... 27 more

prefect

Name Old New Diff Outcome
semantic_index 184.67MB 181.19MB -1.89% (3.48MB) ⬇️
all_negative_narrowing_constraints_for_expression 2.21MB 0.00B -100.00% (2.21MB) ⬇️
all_narrowing_constraints_for_expression 5.23MB 6.92MB +32.34% (1.69MB) ⬇️
infer_expression_types_impl 54.35MB 54.55MB +0.38% (212.61kB) ⬇️
infer_expression_type_impl 12.66MB 12.85MB +1.58% (204.12kB) ⬇️
infer_definition_types 86.89MB 87.02MB +0.15% (132.63kB) ⬇️
IntersectionType 2.48MB 2.54MB +2.51% (63.61kB) ⬇️
StaticClassLiteral<'db>::implicit_attribute_inner_ 9.86MB 9.90MB +0.46% (46.64kB) ⬇️
is_redundant_with_impl::interned_arguments 5.52MB 5.56MB +0.70% (39.70kB) ⬇️
is_redundant_with_impl 5.58MB 5.61MB +0.57% (32.65kB) ⬇️
GenericAlias<'db>::variance_of_ 565.02kB 586.27kB +3.76% (21.25kB) ⬇️
UnionType 3.59MB 3.61MB +0.52% (19.11kB) ⬇️
FunctionType<'db>::signature_ 3.78MB 3.79MB +0.29% (11.42kB) ⬇️
Type<'db>::try_call_dunder_get_ 11.21MB 11.22MB +0.09% (10.73kB) ⬇️
Type<'db>::apply_specialization_ 3.70MB 3.71MB +0.27% (10.30kB) ⬇️
... 23 more

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 10, 2026

Merging this PR will degrade performance by 7.33%

❌ 2 regressed benchmarks
✅ 22 untouched benchmarks
⏩ 30 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime sympy 69.7 s 75.3 s -7.33%
Simulation hydra-zen 1.3 s 1.4 s -6.27%

Comparing mtshiba:improve-23109 (b0add5e) with main (51d04aa)

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 10, 2026

mypy_primer results

Changes were detected when running on open source projects
pip (https://github.com/pypa/pip)
- src/pip/_internal/req/req_uninstall.py:132:42: error[invalid-argument-type] Argument to function `norm_join` is incorrect: Expected `str`, found `Sized | Unknown`
+ src/pip/_internal/req/req_uninstall.py:132:42: error[invalid-argument-type] Argument to function `norm_join` is incorrect: Expected `str`, found `Unknown | Sized`
- src/pip/_internal/req/req_uninstall.py:133:40: error[invalid-argument-type] Argument to function `norm_join` is incorrect: Expected `str`, found `Sized | Unknown`
+ src/pip/_internal/req/req_uninstall.py:133:40: error[invalid-argument-type] Argument to function `norm_join` is incorrect: Expected `str`, found `Unknown | Sized`
- src/pip/_internal/req/req_uninstall.py:139:27: error[unsupported-operator] Operator `+` is not supported between objects of type `Sized | Unknown` and `LiteralString`
+ src/pip/_internal/req/req_uninstall.py:139:27: error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | Sized` and `LiteralString`

spack (https://github.com/spack/spack)
- lib/spack/spack/cmd/style.py:697:27: error[unresolved-attribute] Attribute `lineno` is not defined on `AST & ~Str` in union `Str | (AST & ~Str)`
- lib/spack/spack/cmd/style.py:697:40: error[unresolved-attribute] Attribute `col_offset` is not defined on `AST & ~Str` in union `Str | (AST & ~Str)`
- 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[int | str | bytes | ... 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/solver/requirements.py:255:52: error[invalid-argument-type] Argument to function `parse_spec_from_yaml_string` is incorrect: Expected `str`, found `(Unknown & ~AlwaysFalsy) | (list[Unknown] & ~AlwaysFalsy)`
- lib/spack/spack/solver/requirements.py:271:25: error[invalid-argument-type] Argument is incorrect: Expected `str | None`, found `Unknown | list[Unknown] | None`
- lib/spack/spack/vendor/ruamel/yaml/emitter.py:806:26: error[unresolved-attribute] Attribute `empty` is not defined on `None` in union `Unknown | None`
+ lib/spack/spack/vendor/ruamel/yaml/emitter.py:806:26: error[unresolved-attribute] Attribute `empty` is not defined on `None` in union `None | Unknown`
- lib/spack/spack/vendor/ruamel/yaml/emitter.py:807:25: error[unresolved-attribute] Attribute `multiline` is not defined on `None` in union `Unknown | None`
+ lib/spack/spack/vendor/ruamel/yaml/emitter.py:807:25: error[unresolved-attribute] Attribute `multiline` is not defined on `None` in union `None | Unknown`
- Found 4382 diagnostics
+ Found 4378 diagnostics

websockets (https://github.com/aaugustin/websockets)
- src/websockets/asyncio/connection.py:1219:17: error[unresolved-reference] Name `exceptions` used when not defined
- src/websockets/asyncio/connection.py:1235:17: error[unresolved-reference] Name `exceptions` used when not defined
- src/websockets/asyncio/connection.py:1242:29: error[unresolved-reference] Name `exceptions` used when not defined
- src/websockets/asyncio/connection.py:1243:15: error[unresolved-reference] Name `ExceptionGroup` used when not defined
- src/websockets/asyncio/connection.py:1243:51: error[unresolved-reference] Name `exceptions` used when not defined
- src/websockets/legacy/protocol.py:1610:17: error[unresolved-reference] Name `exceptions` used when not defined
- src/websockets/legacy/protocol.py:1623:17: error[unresolved-reference] Name `exceptions` used when not defined
- src/websockets/legacy/protocol.py:1630:29: error[unresolved-reference] Name `exceptions` used when not defined
- src/websockets/legacy/protocol.py:1631:15: error[unresolved-reference] Name `ExceptionGroup` used when not defined
- src/websockets/legacy/protocol.py:1631:51: error[unresolved-reference] Name `exceptions` used when not defined
- Found 41 diagnostics
+ Found 31 diagnostics

alerta (https://github.com/alerta/alerta)
- alerta/utils/api.py:125:17: error[invalid-assignment] Too many values to unpack: Expected 3
- Found 627 diagnostics
+ Found 626 diagnostics

graphql-core (https://github.com/graphql-python/graphql-core)
- src/graphql/language/visitor.py:277:26: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `tuple[int | str, Node]`, found `tuple[None | Any | int | Node, Node | (Any & tuple[object, ...] & ~Node) | (tuple[Unknown, ...] & ~Node)]`
+ src/graphql/language/visitor.py:277:26: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `tuple[int | str, Node]`, found `tuple[None | Any | int | Node, Node | (Any & tuple[object, ...]) | tuple[Unknown, ...]]`

ignite (https://github.com/pytorch/ignite)
+ ignite/engine/deterministic.py:270:37: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- tests/ignite/distributed/utils/__init__.py:286:10: error[unsupported-operator] Operator `in` is not supported between objects of type `None | str` and `Literal["xla-tpu"]`
+ tests/ignite/distributed/utils/__init__.py:286:10: error[unsupported-operator] Operator `in` is not supported between objects of type `str | None` and `Literal["xla-tpu"]`
- Found 2140 diagnostics
+ Found 2141 diagnostics

pylint (https://github.com/pycqa/pylint)
- pylint/checkers/async_checker.py:92:63: error[unresolved-attribute] Attribute `name` is not defined on `None` in union `(Unknown & ~AlwaysTruthy) | (Unknown & ~AlwaysFalsy) | None`
- pylint/checkers/refactoring/implicit_booleaness_checker.py:219:24: error[unresolved-attribute] Attribute `as_string` is not defined on `str` in union `Unknown | str`
+ pylint/checkers/refactoring/implicit_booleaness_checker.py:219:24: error[unresolved-attribute] Attribute `as_string` is not defined on `str` in union `str | Unknown`
- pylint/checkers/refactoring/implicit_booleaness_checker.py:219:62: error[unresolved-attribute] Attribute `as_string` is not defined on `str` in union `Unknown | str`
+ pylint/checkers/refactoring/implicit_booleaness_checker.py:219:62: error[unresolved-attribute] Attribute `as_string` is not defined on `str` in union `str | Unknown`
- pylint/checkers/refactoring/implicit_booleaness_checker.py:222:27: error[unresolved-attribute] Attribute `as_string` is not defined on `str` in union `(Unknown & ~None) | str`
+ pylint/checkers/refactoring/implicit_booleaness_checker.py:222:27: error[unresolved-attribute] Attribute `as_string` is not defined on `str` in union `str | (Unknown & ~None)`
- pylint/checkers/refactoring/implicit_booleaness_checker.py:236:29: error[unresolved-attribute] Attribute `as_string` is not defined on `str` in union `Unknown | str`
+ pylint/checkers/refactoring/implicit_booleaness_checker.py:236:29: error[unresolved-attribute] Attribute `as_string` is not defined on `str` in union `str | Unknown`
- pylint/checkers/refactoring/implicit_booleaness_checker.py:239:29: error[unresolved-attribute] Attribute `as_string` is not defined on `str` in union `Unknown | str`
+ pylint/checkers/refactoring/implicit_booleaness_checker.py:239:29: error[unresolved-attribute] Attribute `as_string` is not defined on `str` in union `str | Unknown`
- Found 220 diagnostics
+ Found 219 diagnostics

kopf (https://github.com/nolar/kopf)
- kopf/_cogs/structs/references.py:306:24: error[unresolved-attribute] Attribute `split` is not defined on `Marker`, `(Resource, /) -> bool`, `None` in union `str | Marker | ((Resource, /) -> bool) | None`
- kopf/_cogs/structs/references.py:307:55: error[unresolved-attribute] Attribute `split` is not defined on `Marker`, `(Resource, /) -> bool`, `None` in union `str | Marker | ((Resource, /) -> bool) | None`
- kopf/_cogs/structs/references.py:308:53: error[unresolved-attribute] Attribute `split` is not defined on `Marker`, `(Resource, /) -> bool`, `None` in union `str | Marker | ((Resource, /) -> bool) | None`
- kopf/_cogs/structs/references.py:309:54: error[unresolved-attribute] Attribute `split` is not defined on `Marker`, `(Resource, /) -> bool`, `None` in union `str | Marker | ((Resource, /) -> bool) | None`
+ kopf/_cogs/structs/references.py:306:24: error[unresolved-attribute] Attribute `split` is not defined on `(Resource, /) -> bool`, `Marker`, `None` in union `(str & Top[(...) -> object]) | ((Resource, /) -> bool) | (str & ~Top[(...) -> object]) | Marker | None`
+ kopf/_cogs/structs/references.py:307:55: error[unresolved-attribute] Attribute `split` is not defined on `(Resource, /) -> bool`, `Marker`, `None` in union `(str & Top[(...) -> object]) | ((Resource, /) -> bool) | (str & ~Top[(...) -> object]) | Marker | None`
+ kopf/_cogs/structs/references.py:308:53: error[unresolved-attribute] Attribute `split` is not defined on `(Resource, /) -> bool`, `Marker`, `None` in union `(str & Top[(...) -> object]) | ((Resource, /) -> bool) | (str & ~Top[(...) -> object]) | Marker | None`
+ kopf/_cogs/structs/references.py:309:54: error[unresolved-attribute] Attribute `split` is not defined on `(Resource, /) -> bool`, `Marker`, `None` in union `(str & Top[(...) -> object]) | ((Resource, /) -> bool) | (str & ~Top[(...) -> object]) | Marker | None`
- kopf/_cogs/structs/references.py:310:45: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["."]` and `str | Marker | ((Resource, /) -> bool) | None`
+ kopf/_cogs/structs/references.py:310:45: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["."]` and `(str & Top[(...) -> object]) | ((Resource, /) -> bool) | (str & ~Top[(...) -> object]) | Marker | None`
- kopf/_cogs/structs/references.py:311:51: error[unresolved-attribute] Attribute `split` is not defined on `Marker`, `(Resource, /) -> bool`, `None` in union `str | Marker | ((Resource, /) -> bool) | None`
- kopf/_cogs/structs/references.py:312:54: error[unresolved-attribute] Attribute `split` is not defined on `Marker`, `(Resource, /) -> bool`, `None` in union `str | Marker | ((Resource, /) -> bool) | None`
+ kopf/_cogs/structs/references.py:311:51: error[unresolved-attribute] Attribute `split` is not defined on `(Resource, /) -> bool`, `Marker`, `None` in union `(str & Top[(...) -> object]) | ((Resource, /) -> bool) | (str & ~Top[(...) -> object]) | Marker | None`
+ kopf/_cogs/structs/references.py:312:54: error[unresolved-attribute] Attribute `split` is not defined on `(Resource, /) -> bool`, `Marker`, `None` in union `(str & Top[(...) -> object]) | ((Resource, /) -> bool) | (str & ~Top[(...) -> object]) | Marker | None`
- kopf/_cogs/structs/references.py:315:42: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["/"]` and `str | Marker | ((Resource, /) -> bool) | None`
+ kopf/_cogs/structs/references.py:315:42: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["/"]` and `(str & Top[(...) -> object]) | ((Resource, /) -> bool) | (str & ~Top[(...) -> object]) | Marker | None`
- kopf/_cogs/structs/references.py:316:51: error[unresolved-attribute] Attribute `rsplit` is not defined on `Marker`, `(Resource, /) -> bool`, `None` in union `str | Marker | ((Resource, /) -> bool) | None`
- kopf/_cogs/structs/references.py:317:53: error[unresolved-attribute] Attribute `rsplit` is not defined on `Marker`, `(Resource, /) -> bool`, `None` in union `str | Marker | ((Resource, /) -> bool) | None`
+ kopf/_cogs/structs/references.py:316:51: error[unresolved-attribute] Attribute `rsplit` is not defined on `(Resource, /) -> bool`, `Marker`, `None` in union `(str & Top[(...) -> object]) | ((Resource, /) -> bool) | (str & ~Top[(...) -> object]) | Marker | None`
+ kopf/_cogs/structs/references.py:317:53: error[unresolved-attribute] Attribute `rsplit` is not defined on `(Resource, /) -> bool`, `Marker`, `None` in union `(str & Top[(...) -> object]) | ((Resource, /) -> bool) | (str & ~Top[(...) -> object]) | Marker | None`

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, str | Unknown]]`
+ 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: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: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: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: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:20: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]]`

pylox (https://github.com/sco1/pylox)
- pylox/containers/array.py:146:9: error[invalid-assignment] Object of type `deque[Unknown | None]` is not assignable to attribute `fields` of type `dict[Unknown, Unknown]`
+ pylox/containers/array.py:146:9: error[invalid-assignment] Object of type `deque[None | Unknown]` is not assignable to attribute `fields` of type `dict[Unknown, Unknown]`

PyGithub (https://github.com/PyGithub/PyGithub)
- github/Requester.py:899:57: error[invalid-argument-type] Argument to bound method `__hostnameHasDomain` is incorrect: Expected `str | list[str]`, found `Unknown | list[Unknown | str] | list[str | Unknown | None]`
+ github/Requester.py:899:57: error[invalid-argument-type] Argument to bound method `__hostnameHasDomain` is incorrect: Expected `str | list[str]`, found `Unknown | list[Unknown | str] | list[None | Unknown | str]`

mitmproxy (https://github.com/mitmproxy/mitmproxy)
- mitmproxy/addons/cut.py:57:24: error[unresolved-attribute] Attribute `headers` is not defined on `Flow & ~AlwaysFalsy` in union `(Flow & ~AlwaysFalsy) | (Any & ~AlwaysFalsy)`
+ mitmproxy/addons/cut.py:57:24: error[unresolved-attribute] Attribute `headers` is not defined on `Flow & ~AlwaysFalsy` in union `(Flow & ~AlwaysFalsy) | (Any & Top[list[Unknown]] & ~AlwaysFalsy) | (Any & Cert & ~AlwaysFalsy) | ... omitted 3 union elements`
- test/mitmproxy/proxy/tutils.py:419:16: error[invalid-return-type] Return type does not match returned value: expected `AnyStr@_AnyStrPlaceholder`, found `Unknown | None | AnyStr@_AnyStrPlaceholder`
+ test/mitmproxy/proxy/tutils.py:419:16: error[invalid-return-type] Return type does not match returned value: expected `AnyStr@_AnyStrPlaceholder`, found `Unknown | AnyStr@_AnyStrPlaceholder | None`

urllib3 (https://github.com/urllib3/urllib3)
- src/urllib3/http2/connection.py:263:21: warning[possibly-unresolved-reference] Name `headers` used when possibly not defined
- Found 279 diagnostics
+ Found 278 diagnostics

pydantic (https://github.com/pydantic/pydantic)
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `CustomErrorSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `DecimalSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `StringSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `BytesSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `DateSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `TimeSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `DatetimeSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `TimedeltaSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `LiteralSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `MissingSentinelSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `EnumSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `IsInstanceSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `IsSubclassSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `CallableSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `ListSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `TupleSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `SetSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `FrozenSetSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `GeneratorSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `DictSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `AfterValidatorFunctionSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `BeforeValidatorFunctionSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `WrapValidatorFunctionSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `PlainValidatorFunctionSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `FloatSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `NullableSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `UnionSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `TaggedUnionSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `ChainSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `LaxOrStrictSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `JsonOrPythonSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `TypedDictSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `ModelFieldsSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `ModelSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `DataclassArgsSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `DataclassSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `ArgumentsSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `ArgumentsV3Schema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `CallSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `InvalidSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `JsonSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `UrlSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `MultiHostUrlSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `DefinitionsSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `UuidSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `ComplexSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `AnySchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `NoneSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `BoolSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `IntSchema`: Unknown key "schema_ref"
- pydantic/_internal/_generate_schema.py:2814:37: error[invalid-key] Unknown key "schema_ref" for TypedDict `WithDefaultSchema`: Unknown key "schema_ref"
- Found 3204 diagnostics
+ Found 3153 diagnostics

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 205 diagnostics
+ Found 204 diagnostics

trio (https://github.com/python-trio/trio)
- src/trio/_ssl.py:638:16: warning[possibly-unresolved-reference] Name `ret` used when possibly not defined
- Found 471 diagnostics
+ Found 470 diagnostics

meson (https://github.com/mesonbuild/meson)
- mesonbuild/backend/ninjabackend.py:609:12: error[unresolved-attribute] Attribute `coredata` is not defined on `None` in union `Environment | None`
+ mesonbuild/backend/ninjabackend.py:609:12: error[unresolved-attribute] Attribute `coredata` is not defined on `None` in union `(Environment & ~AlwaysFalsy) | (Environment & ~AlwaysTruthy) | None`
- mesonbuild/backend/ninjabackend.py:610:29: error[unresolved-attribute] Attribute `get_build_dir` is not defined on `None` in union `Environment | None`
+ mesonbuild/backend/ninjabackend.py:610:29: error[unresolved-attribute] Attribute `get_build_dir` is not defined on `None` in union `(Environment & ~AlwaysFalsy) | (Environment & ~AlwaysTruthy) | None`
- mesonbuild/build.py:2074:39: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `BuildTarget | CustomTarget | CustomTargetIndex`, found `Unknown | ExternalProgram | Executable | CustomTarget | CustomTargetIndex`
+ mesonbuild/build.py:2074:39: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `BuildTarget | CustomTarget | CustomTargetIndex`, found `Unknown | ExternalProgram | Executable | CustomTargetIndex | CustomTarget`
- mesonbuild/interpreter/interpreter.py:1566:13: error[invalid-assignment] Invalid subscript assignment with key of type `str` and value of type `(Unknown & ~AlwaysFalsy) | Compiler` on object of type `dict[Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals], Compiler]`
+ mesonbuild/interpreter/interpreter.py:1566:13: error[invalid-assignment] Invalid subscript assignment with key of type `str` and value of type `(Unknown & ~AlwaysFalsy) | (Compiler & ~AlwaysTruthy)` on object of type `dict[Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals], Compiler]`
- mesonbuild/interpreter/interpreter.py:2796:56: error[invalid-argument-type] Argument to function `bold` is incorrect: Expected `str`, found `(str & ~AlwaysTruthy & ~AlwaysFalsy) | (Program & ~AlwaysTruthy & ~AlwaysFalsy) | (Unknown & ~AlwaysFalsy)`
+ mesonbuild/interpreter/interpreter.py:2796:56: error[invalid-argument-type] Argument to function `bold` is incorrect: Expected `str`, found `(str & ~AlwaysFalsy & ~AlwaysTruthy) | (Program & ~AlwaysTruthy & ~AlwaysFalsy) | (Unknown & ~AlwaysFalsy)`
- mesonbuild/interpreter/interpreter.py:2797:27: error[invalid-argument-type] Argument to function `open` is incorrect: Expected `int | str | bytes | PathLike[str] | PathLike[bytes]`, found `(str & ~AlwaysTruthy & ~AlwaysFalsy) | (Program & ~AlwaysTruthy & ~AlwaysFalsy) | (Unknown & ~AlwaysFalsy)`
+ mesonbuild/interpreter/interpreter.py:2797:27: error[invalid-argument-type] Argument to function `open` is incorrect: Expected `int | str | bytes | PathLike[str] | PathLike[bytes]`, found `(str & ~AlwaysFalsy & ~AlwaysTruthy) | (Program & ~AlwaysTruthy & ~AlwaysFalsy) | (Unknown & ~AlwaysFalsy)`

cloud-init (https://github.com/canonical/cloud-init)
- cloudinit/net/eni.py:664:53: error[invalid-argument-type] Argument to bound method `_render_route` is incorrect: Expected `dict[Unknown, Unknown]`, found `Unknown | str`
- 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`
- Found 1150 diagnostics
+ Found 1149 diagnostics

manticore (https://github.com/trailofbits/manticore)
- manticore/core/plugin.py:329:32: error[invalid-argument-type] Argument to bound method `add` is incorrect: Argument type `PstatsFormatted` does not satisfy upper bound `Stats` of type variable `Self`
- manticore/core/plugin.py:329:32: error[invalid-argument-type] Argument to bound method `add` is incorrect: Expected `None | str | profile.Profile | cProfile.Profile | Stats`, found `PstatsFormatted`
- 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 objects of type `int | bytes | Divergent` and `Unknown | int | bytes | Divergent`
- manticore/platforms/wasm.py:262:68: error[invalid-argument-type] Argument is incorrect: Expected `FunctionType`, found `(ProtoFuncInst & Top[(...) -> object] & ~FuncAddr & ~TableAddr & ~MemAddr & ~GlobalAddr & ~AlwaysFalsy) | (TableInst & Top[(...) -> object] & ~FuncAddr & ~TableAddr & ~MemAddr & ~GlobalAddr & ~AlwaysFalsy) | (MemInst & Top[(...) -> object] & ~FuncAddr & ~TableAddr & ~MemAddr & ~GlobalAddr & ~AlwaysFalsy) | (GlobalInst & Top[(...) -> object] & ~FuncAddr & ~TableAddr & ~MemAddr & ~GlobalAddr & ~AlwaysFalsy) | (((...) -> Unknown) & ~FuncAddr & ~TableAddr & ~MemAddr & ~GlobalAddr & ~AlwaysFalsy)`
- manticore/platforms/wasm.py:264:25: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `ProtoFuncInst`, found `(ProtoFuncInst & Top[(...) -> object] & ~FuncAddr & ~TableAddr & ~MemAddr & ~GlobalAddr & ~AlwaysFalsy) | (TableInst & Top[(...) -> object] & ~FuncAddr & ~TableAddr & ~MemAddr & ~GlobalAddr & ~AlwaysFalsy) | (MemInst & Top[(...) -> object] & ~FuncAddr & ~TableAddr & ~MemAddr & ~GlobalAddr & ~AlwaysFalsy) | ... omitted 7 union elements`
- manticore/platforms/wasm.py:278:25: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `TableInst`, found `(ProtoFuncInst & ~FuncAddr & ~TableAddr & ~MemAddr & ~GlobalAddr & ~AlwaysFalsy) | TableInst | (MemInst & ~FuncAddr & ~TableAddr & ~MemAddr & ~GlobalAddr & ~AlwaysFalsy) | (GlobalInst & ~FuncAddr & ~TableAddr & ~MemAddr & ~GlobalAddr & ~AlwaysFalsy) | (((...) -> Unknown) & ~FuncAddr & ~TableAddr & ~MemAddr & ~GlobalAddr & ~AlwaysFalsy)`
- manticore/platforms/wasm.py:286:25: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `MemInst`, found `(ProtoFuncInst & ~FuncAddr & ~TableAddr & ~MemAddr & ~GlobalAddr & ~AlwaysFalsy) | (TableInst & ~FuncAddr & ~TableAddr & ~MemAddr & ~GlobalAddr & ~AlwaysFalsy) | MemInst | (GlobalInst & ~FuncAddr & ~TableAddr & ~MemAddr & ~GlobalAddr & ~AlwaysFalsy) | (((...) -> Unknown) & ~FuncAddr & ~TableAddr & ~MemAddr & ~GlobalAddr & ~AlwaysFalsy)`
- manticore/platforms/wasm.py:294:25: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `GlobalInst`, found `(ProtoFuncInst & ~FuncAddr & ~TableAddr & ~MemAddr & ~GlobalAddr & ~AlwaysFalsy) | (TableInst & ~FuncAddr & ~TableAddr & ~MemAddr & ~GlobalAddr & ~AlwaysFalsy) | (MemInst & ~FuncAddr & ~TableAddr & ~MemAddr & ~GlobalAddr & ~AlwaysFalsy) | GlobalInst | (((...) -> Unknown) & ~FuncAddr & ~TableAddr & ~MemAddr & ~GlobalAddr & ~AlwaysFalsy)`
- Found 11085 diagnostics
+ Found 11078 diagnostics

setuptools (https://github.com/pypa/setuptools)
- setuptools/_distutils/compilers/C/zos.py:210:25: error[unresolved-attribute] Attribute `append` is not defined on `None` in union `Unknown | None | list[Unknown]`
+ setuptools/_distutils/compilers/C/zos.py:210:25: error[unresolved-attribute] Attribute `append` is not defined on `None` in union `(Unknown & ~AlwaysFalsy) | (Unknown & ~AlwaysTruthy) | None | list[Unknown]`
- setuptools/_distutils/compilers/C/zos.py:214:9: error[unresolved-attribute] Attribute `extend` is not defined on `None` in union `Unknown | None | list[Unknown]`
+ setuptools/_distutils/compilers/C/zos.py:214:9: error[unresolved-attribute] Attribute `extend` is not defined on `None` in union `(Unknown & ~AlwaysFalsy) | (Unknown & ~AlwaysTruthy) | None | list[Unknown]`
- setuptools/_vendor/backports/tarfile/__init__.py:2713:20: error[unresolved-attribute] Attribute `offset` is not defined on `None` in union `Unknown | None`
+ setuptools/_vendor/backports/tarfile/__init__.py:2713:20: error[unresolved-attribute] Attribute `offset` is not defined on `None` in union `(Unknown & ~None) | None`

cwltool (https://github.com/common-workflow-language/cwltool)
- cwltool/main.py:301:42: error[invalid-argument-type] Argument to function `realize_input_schema` is incorrect: Expected `MutableSequence[str | MutableMapping[str, None | int | str | ... omitted 3 union elements]]`, found `list[str | MutableMapping[str, None | int | str | ... omitted 3 union elements] | (Unknown & Top[Mapping[Unknown, object]]) | ... omitted 4 union elements]`
+ cwltool/main.py:301:42: error[invalid-argument-type] Argument to function `realize_input_schema` is incorrect: Expected `MutableSequence[str | MutableMapping[str, None | int | str | ... omitted 3 union elements]]`, found `list[str | MutableMapping[str, None | int | str | ... omitted 3 union elements] | (int & Top[Mapping[Unknown, object]]) | ... omitted 4 union elements]`

hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
- src/hydra_zen/structured_configs/_implementations.py:2555:76: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- Found 518 diagnostics
+ Found 517 diagnostics

prefect (https://github.com/PrefectHQ/prefect)
+ src/integrations/prefect-docker/tests/test_containers.py:27:47: error[invalid-argument-type] Argument is incorrect: Expected `str`, found `str | bool | dict[Unknown | str, Unknown | int] | None`
+ src/integrations/prefect-docker/tests/test_containers.py:27:47: error[invalid-argument-type] Argument is incorrect: Expected `str | list[str] | None`, found `str | bool | dict[Unknown | str, Unknown | int] | None`
+ src/integrations/prefect-docker/tests/test_containers.py:27:47: error[invalid-argument-type] Argument is incorrect: Expected `str | None`, found `str | bool | dict[Unknown | str, Unknown | int] | None`
+ src/integrations/prefect-docker/tests/test_containers.py:27:47: error[invalid-argument-type] Argument is incorrect: Expected `bool | None`, found `str | bool | dict[Unknown | str, Unknown | int] | None`
+ src/integrations/prefect-docker/tests/test_containers.py:27:47: error[invalid-argument-type] Argument is incorrect: Expected `str | list[str] | None`, found `str | bool | dict[Unknown | str, Unknown | int] | None`
+ src/integrations/prefect-docker/tests/test_containers.py:27:47: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, str] | list[str] | None`, found `str | bool | dict[Unknown | str, Unknown | int] | None`
+ src/integrations/prefect-docker/tests/test_containers.py:27:47: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `str | bool | dict[Unknown | str, Unknown | int] | None`
+ src/integrations/prefect-docker/tests/test_containers.py:42:47: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `str`
+ src/integrations/prefect-docker/tests/test_containers.py:55:47: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `str`
+ src/integrations/prefect-docker/tests/test_containers.py:68:47: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `str`
+ src/integrations/prefect-docker/tests/test_containers.py:81:47: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `str`
+ src/integrations/prefect-docker/tests/test_images.py:16:44: error[invalid-argument-type] Argument is incorrect: Expected `str`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:16:44: error[invalid-argument-type] Argument is incorrect: Expected `str | None`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:16:44: error[invalid-argument-type] Argument is incorrect: Expected `str | None`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:16:44: error[invalid-argument-type] Argument is incorrect: Expected `bool`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:16:44: error[invalid-argument-type] Argument is incorrect: Expected `DockerHost | None`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:16:44: error[invalid-argument-type] Argument is incorrect: Expected `DockerRegistryCredentials | None`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:16:44: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:21:16: error[unresolved-attribute] Attribute `id` is not defined on `list[Unknown]` in union `Unknown | list[Unknown]`
+ src/integrations/prefect-docker/tests/test_images.py:29:47: error[invalid-argument-type] Argument is incorrect: Expected `bool`, found `str`
+ src/integrations/prefect-docker/tests/test_images.py:29:47: error[invalid-argument-type] Argument is incorrect: Expected `DockerRegistryCredentials | None`, found `str`
+ src/integrations/prefect-docker/tests/test_images.py:29:47: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `str`
+ src/integrations/prefect-docker/tests/test_images.py:31:16: error[unresolved-attribute] Attribute `id` is not defined on `list[Unknown]` in union `Unknown | list[Unknown]`
+ src/integrations/prefect-docker/tests/test_images.py:51:17: error[invalid-argument-type] Argument is incorrect: Expected `bool`, found `str`
+ src/integrations/prefect-docker/tests/test_images.py:51:17: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `str`
+ src/integrations/prefect-docker/tests/test_images.py:53:16: error[unresolved-attribute] Attribute `id` is not defined on `list[Unknown]` in union `Unknown | list[Unknown]`
+ src/integrations/prefect-docker/tests/test_images.py:64:47: error[invalid-argument-type] Argument is incorrect: Expected `str`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:64:47: error[invalid-argument-type] Argument is incorrect: Expected `str | None`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:64:47: error[invalid-argument-type] Argument is incorrect: Expected `str | None`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:64:47: error[invalid-argument-type] Argument is incorrect: Expected `bool`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:64:47: error[invalid-argument-type] Argument is incorrect: Expected `DockerRegistryCredentials | None`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:64:47: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `str | bool`
+ src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py:428:17: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `str`
+ src/integrations/prefect-kubernetes/tests/test_custom_objects.py:20:13: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `None`
+ src/integrations/prefect-kubernetes/tests/test_custom_objects.py:29:13: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `None`
+ src/integrations/prefect-kubernetes/tests/test_custom_objects.py:38:13: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `None`
+ src/integrations/prefect-kubernetes/tests/test_custom_objects.py:57:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_custom_objects.py:103:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_custom_objects.py:149:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_custom_objects.py:195:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_custom_objects.py:240:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_custom_objects.py:286:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_custom_objects.py:344:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_deployments.py:18:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_deployments.py:38:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_deployments.py:70:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_deployments.py:92:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_deployments.py:113:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_deployments.py:141:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_jobs.py:36:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_jobs.py:52:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_jobs.py:68:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_jobs.py:87:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_jobs.py:107:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_jobs.py:131:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_jobs.py:159:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_pods.py:29:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_pods.py:46:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_pods.py:78:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_pods.py:96:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_pods.py:115:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_pods.py:137:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_pods.py:167:9: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
- src/prefect/cache_policies.py:311:25: error[unresolved-attribute] Attribute `__code__` is not defined on `((...) -> Any) & ((*args: object, **kwargs: object) -> object)` in union `Unknown | (((...) -> Any) & ((*args: object, **kwargs: object) -> object))`
+ src/prefect/cache_policies.py:311:25: error[unresolved-attribute] Attribute `__code__` is not defined on `(...) -> Any` in union `Unknown | ((...) -> Any)`
- src/prefect/deployments/flow_runs.py:141:59: error[invalid-argument-type] Argument to bound method `read_deployment_by_name` is incorrect: Expected `str`, found `str | UUID`
+ src/prefect/deployments/flow_runs.py:141:59: error[invalid-argument-type] Argument to bound method `read_deployment_by_name` is incorrect: Expected `str`, found `UUID | str`
- src/prefect/deployments/flow_runs.py:338:62: error[invalid-argument-type] Argument to bound method `read_deployment_by_name` is incorrect: Expected `str`, found `str | UUID`
+ src/prefect/deployments/flow_runs.py:338:62: error[invalid-argument-type] Argument to bound method `read_deployment_by_name` is incorrect: Expected `str`, found `UUID | str`
- src/prefect/input/run_input.py:672:20: error[invalid-return-type] Return type does not match returned value: expected `T@GetAutomaticInputHandler | AutomaticRunInput[T@GetAutomaticInputHandler]`, found `T@GetAutomaticInputHandler | AutomaticRunInput[T@GetAutomaticInputHandler] | Coroutine[Any, Any, T@GetAutomaticInputHandler | AutomaticRunInput[T@GetAutomaticInputHandler]]`
+ src/prefect/input/run_input.py:672:20: error[invalid-return-type] Return type does not match returned value: expected `T@GetAutomaticInputHandler | AutomaticRunInput[T@GetAutomaticInputHandler]`, found `Unknown | Coroutine[Any, Any, Unknown]`
+ src/prefect/task_engine.py:1642:28: error[invalid-await] `Unknown | R@AsyncTaskRunEngine | Coroutine[Any, Any, R@AsyncTaskRunEngine]` is not awaitable
+ src/prefect/task_engine.py:1750:47: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Unknown | R@run_generator_task_sync`
+ src/prefect/task_engine.py:1763:25: error[unresolved-attribute] Attribute `throw` is not defined on `R@run_generator_task_sync` in union `Unknown | R@run_generator_task_sync`
+ src/prefect/task_engine.py:1809:48: error[unresolved-attribute] Attribute `__anext__` is not defined on `R@run_generator_task_async` in union `Unknown | R@run_generator_task_async`
+ src/prefect/task_engine.py:1821:29: error[unresolved-attribute] Attribute `throw` is not defined on `R@run_generator_task_async` in union `Unknown | R@run_generator_task_async`
- src/prefect/tasks.py:185:9: error[unresolved-attribute] Attribute `__code__` is not defined on `((...) -> Any) & ((*args: object, **kwargs: object) -> object)` in union `Unknown | (((...) -> Any) & ((*args: object, **kwargs: object) -> object))`
+ src/prefect/tasks.py:185:9: error[unresolved-attribute] Attribute `__code__` is not defined on `(...) -> Any` in union `Unknown | ((...) -> Any)`
- src/prefect/tasks.py:795:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `(() -> str) | TaskRunNameCallbackWithParameters | str | None`, found `((() -> str) & ~<class 'NotSet'>) | TaskRunNameCallbackWithParameters | str | ... omitted 4 union elements`
+ src/prefect/tasks.py:795:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `(() -> str) | TaskRunNameCallbackWithParameters | str | None`, found `(() -> str) | TaskRunNameCallbackWithParameters | str | ... omitted 3 union elements`
- src/prefect/utilities/_engine.py:64:13: error[invalid-argument-type] Argument to bound method `is_callback_with_parameters` is incorrect: Expected `(...) -> str`, found `(Unknown & Top[(...) -> object]) | (str & Top[(...) -> object]) | ((() -> str) & ((*args: object, **kwargs: object) -> object)) | (TaskRunNameCallbackWithParameters & ((*args: object, **kwargs: object) -> object))`
+ src/prefect/utilities/_engine.py:64:13: error[invalid-argument-type] Argument to bound method `is_callback_with_parameters` is incorrect: Expected `(...) -> str`, found `(Unknown & Top[(...) -> object]) | (str & Top[(...) -> object]) | (() -> str) | TaskRunNameCallbackWithParameters`
+ src/prefect/utilities/_engine.py:66:48: error[unknown-argument] Argument `parameters` does not match any known parameter
+ src/prefect/utilities/_engine.py:69:29: error[missing-argument] No argument provided for required parameter `parameters` of bound method `__call__`
- 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:216:36: warning[possibly-missing-attribute] Attribute `replace` may be missing on object of type `str | T@apply_values`
- Found 5424 diagnostics
+ Found 5492 diagnostics

pycryptodome (https://github.com/Legrandin/pycryptodome)
- lib/Crypto/SelfTest/loader.py:100:13: error[unresolved-attribute] Attribute `others` is not defined on `None` in union `None | TestVector`
- Found 1338 diagnostics
+ Found 1337 diagnostics

xarray (https://github.com/pydata/xarray)
+ xarray/tests/test_dataset.py:6349:52: error[invalid-argument-type] Argument to bound method `quantile` is incorrect: Expected `_Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | ... omitted 5 union elements`, found `Hashable`
- Found 1709 diagnostics
+ Found 1710 diagnostics

pwndbg (https://github.com/pwndbg/pwndbg)
- pwndbg/aglib/heap/ptmalloc.py:1866:52: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `int | None | Unknown`
+ pwndbg/aglib/heap/ptmalloc.py:1866:52: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `int | None | (Unknown & ~AlwaysTruthy)`
- pwndbg/aglib/heap/ptmalloc.py:1867:38: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int`, found `int | None | Unknown`
+ pwndbg/aglib/heap/ptmalloc.py:1867:38: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int`, found `int | None | (Unknown & ~AlwaysTruthy)`

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 50 diagnostics
+ Found 51 diagnostics

dd-trace-py (https://github.com/DataDog/dd-trace-py)
- benchmarks/base/run.py:114:45: error[invalid-argument-type] Argument to function `cpu_affinity_to_cpu_groups` is incorrect: Expected `str`, found `str | None`
+ benchmarks/base/run.py:114:45: error[invalid-argument-type] Argument to function `cpu_affinity_to_cpu_groups` is incorrect: Expected `str`, found `(str & ~AlwaysTruthy) | None | (str & ~AlwaysFalsy)`
- ddtrace/propagation/http.py:1249:61: error[invalid-argument-type] Argument to function `_context_to_span_link` is incorrect: Expected `Context`, found `Context | Unknown | None`
+ ddtrace/propagation/http.py:1249:61: error[invalid-argument-type] Argument to function `_context_to_span_link` is incorrect: Expected `Context`, found `Context | None | (Unknown & ~AlwaysFalsy) | (Unknown & ~AlwaysTruthy)`
- ddtrace/propagation/http.py:1250:43: error[unresolved-attribute] Attribute `get_all_baggage_items` is not defined on `None` in union `Context | Unknown | None`
+ ddtrace/propagation/http.py:1250:43: error[unresolved-attribute] Attribute `get_all_baggage_items` is not defined on `None` in union `Context | None | (Unknown & ~AlwaysFalsy) | (Unknown & ~AlwaysTruthy)`
- ddtrace/vendor/ply/lex.py:924:9: error[unresolved-attribute] Attribute `info` is not defined on `None` in union `Unknown | None | PlyLogger`
+ ddtrace/vendor/ply/lex.py:924:9: error[unresolved-attribute] Attribute `info` is not defined on `None` in union `None | (Unknown & ~None) | PlyLogger`
- ddtrace/vendor/ply/lex.py:925:9: error[unresolved-attribute] Attribute `info` is not defined on `None` in union `Unknown | None | PlyLogger`
+ ddtrace/vendor/ply/lex.py:925:9: error[unresolved-attribute] Attribute `info` is not defined on `None` in union `None | (Unknown & ~None) | PlyLogger`
- ddtrace/vendor/ply/lex.py:926:9: error[unresolved-attribute] Attribute `info` is not defined on `None` in union `Unknown | None | PlyLogger`
+ ddtrace/vendor/ply/lex.py:926:9: error[unresolved-attribute] Attribute `info` is not defined on `None` in union `None | (Unknown & ~None) | PlyLogger`
- ddtrace/vendor/ply/lex.py:953:17: error[unresolved-attribute] Attribute `info` is not defined on `None` in union `Unknown | None | PlyLogger`
+ ddtrace/vendor/ply/lex.py:953:17: error[unresolved-attribute] Attribute `info` is not defined on `None` in union `None | (Unknown & ~None) | PlyLogger`
- ddtrace/vendor/ply/lex.py:959:17: error[unresolved-attribute] Attribute `info` is not defined on `None` in union `Unknown | None | PlyLogger`
+ ddtrace/vendor/ply/lex.py:959:17: error[unresolved-attribute] Attribute `info` is not defined on `None` in union `None | (Unknown & ~None) | PlyLogger`
- ddtrace/vendor/ply/lex.py:966:9: error[unresolved-attribute] Attribute `info` is not defined on `None` in union `Unknown | None | PlyLogger`
+ ddtrace/vendor/ply/lex.py:966:9: error[unresolved-attribute] Attribute `info` is not defined on `None` in union `None | (Unknown & ~None) | PlyLogger`
- ddtrace/vendor/ply/lex.py:975:17: error[unresolved-attribute] Attribute `info` is not defined on `None` in union `Unknown | None | PlyLogger`
+ ddtrace/vendor/ply/lex.py:975:17: error[unresolved-attribute] Attribute `info` is not defined on `None` in union `None | (Unknown & ~None) | PlyLogger`
- ddtrace/vendor/ply/yacc.py:597:24: error[unresolved-attribute] Attribute `type` is not defined on `None`, `YaccSymbol` in union `None | (Unknown & ~AlwaysFalsy) | YaccSymbol`
+ ddtrace/vendor/ply/yacc.py:597:24: error[unresolved-attribute] Attribute `type` is not defined on `None`, `YaccSymbol & ~AlwaysTruthy`, `YaccSymbol & ~AlwaysFalsy` in union `None | (Unknown & ~AlwaysTruthy & ~AlwaysFalsy) | (YaccSymbol & ~AlwaysTruthy) | (YaccSymbol & ~AlwaysFalsy)`
- ddtrace/vendor/ply/yacc.py:601:29: error[invalid-assignment] Object of type `Unknown` is not assignable to attribute `lexer` on type `(Unknown & ~AlwaysFalsy & ~<Protocol with members 'lexer'>) | (YaccSymbol & ~AlwaysFalsy & ~<Protocol with members 'lexer'>)`
+ ddtrace/vendor/ply/yacc.py:601:29: error[invalid-assignment] Object of type `Unknown` is not assignable to attribute `lexer` on type `(Unknown & ~AlwaysTruthy & ~AlwaysFalsy & ~<Protocol with members 'lexer'>) | (YaccSymbol & ~AlwaysFalsy & ~<Protocol with members 'lexer'>)`
- ddtrace/vendor/ply/yacc.py:614:42: error[unresolved-attribute] Attribute `lineno` is not defined on `None`, `YaccSymbol` in union `None | (Unknown & ~AlwaysFalsy) | YaccSymbol`
+ ddtrace/vendor/ply/yacc.py:614:42: error[unresolved-attribute] Attribute `lineno` is not defined on `None`, `YaccSymbol & ~AlwaysTruthy`, `YaccSymbol & ~AlwaysFalsy` in union `None | (Unknown & ~AlwaysTruthy & ~AlwaysFalsy) | (YaccSymbol & ~AlwaysTruthy) | (YaccSymbol & ~AlwaysFalsy)`
- ddtrace/vendor/ply/yacc.py:618:105: error[unresolved-attribute] Attribute `type` is not defined on `YaccSymbol & ~AlwaysFalsy` in union `(Unknown & ~AlwaysFalsy) | (YaccSymbol & ~AlwaysFalsy)`
+ ddtrace/vendor/ply/yacc.py:618:105: error[unresolved-attribute] Attribute `type` is not defined on `YaccSymbol & ~AlwaysFalsy` in union `(Unknown & ~AlwaysTruthy & ~AlwaysFalsy) | (YaccSymbol & ~AlwaysFalsy)`
- ddtrace/vendor/ply/yacc.py:620:83: error[unresolved-attribute] Attribute `type` is not defined on `YaccSymbol & ~AlwaysFalsy` in union `(Unknown & ~AlwaysFalsy) | (YaccSymbol & ~AlwaysFalsy)`
+ ddtrace/vendor/ply/yacc.py:620:83: error[unresolved-attribute] Attribute `type` is not defined on `YaccSymbol & ~AlwaysFalsy` in union `(Unknown & ~AlwaysTruthy & ~AlwaysFalsy) | (YaccSymbol & ~AlwaysFalsy)`
- ddtrace/vendor/ply/yacc.py:632:45: error[unresolved-attribute] Attribute `type` is not defined on `None`, `YaccSymbol` in union `None | (Unknown & ~AlwaysFalsy) | YaccSymbol`
+ ddtrace/vendor/ply/yacc.py:632:45: error[unresolved-attribute] Attribute `type` is not defined on `None`, `YaccSymbol & ~AlwaysTruthy`, `YaccSymbol & ~AlwaysFalsy` in union `None | (Unknown & ~AlwaysTruthy & ~AlwaysFalsy) | (YaccSymbol & ~AlwaysTruthy) | (YaccSymbol & ~AlwaysFalsy)`
- ddtrace/vendor/ply/yacc.py:644:20: error[unresolved-attribute] Attribute `type` is not defined on `None`, `YaccSymbol` in union `None | (Unknown & ~AlwaysFalsy) | YaccSymbol`
+ ddtrace/vendor/ply/yacc.py:644:20: error[unresolved-attribute] Attribute `type` is not defined on `None`, `YaccSymbol & ~AlwaysTruthy`, `YaccSymbol & ~AlwaysFalsy` in union `None | (Unknown & ~AlwaysTruthy & ~AlwaysFalsy) | (YaccSymbol & ~AlwaysTruthy) | (YaccSymbol & ~AlwaysFalsy)`
- ddtrace/vendor/ply/yacc.py:648:20: error[unresolved-attribute] Attribute `type` is not defined on `None`, `YaccSymbol` in union `None | (Unknown & ~AlwaysFalsy) | YaccSymbol`
+ ddtrace/vendor/ply/yacc.py:648:20: error[unresolved-attribute] Attribute `type` is not defined on `None`, `YaccSymbol & ~AlwaysTruthy`, `YaccSymbol & ~AlwaysFalsy` in union `None | (Unknown & ~AlwaysTruthy & ~AlwaysFalsy) | (YaccSymbol & ~AlwaysTruthy) | (YaccSymbol & ~AlwaysFalsy)`
- ddtrace/vendor/ply/yacc.py:676:25: error[invalid-assignment] Object of type `Unknown` is not assignable to attribute `lineno` on type `None | (Unknown & ~AlwaysFalsy) | YaccSymbol`
+ ddtrace/vendor/ply/yacc.py:676:25: error[invalid-assignment] Object of type `Unknown` is not assignable to attribute `lineno` on type `None | (Unknown & ~AlwaysTruthy & ~AlwaysFalsy) | (YaccSymbol & ~AlwaysTruthy) | (YaccSymbol & ~AlwaysFalsy)`
- ddtrace/vendor/ply/yacc.py:677:25: error[invalid-assignment] Object of type `Unknown` is not assignable to attribute `lexpos` on type `None | (Unknown & ~AlwaysFalsy) | YaccSymbol`
+ ddtrace/vendor/ply/yacc.py:677:25: error[invalid-assignment] Object of type `Unknown` is not assignable to attribute `lexpos` on type `None | (Unknown & ~AlwaysTruthy & ~AlwaysFalsy) | (YaccSymbol & ~AlwaysTruthy) | (YaccSymbol & ~AlwaysFalsy)`
- ddtrace/vendor/ply/yacc.py:903:24: error[unresolved-attribute] Attribute `type` is not defined on `None`, `YaccSymbol` in union `None | (Unknown & ~AlwaysFalsy) | YaccSymbol`
+ ddtrace/vendor/ply/yacc.py:903:24: error[unresolved-attribute] Attribute `type` is not defined on `None`, `YaccSymbol` in union `None | (Unknown & ~AlwaysTruthy & ~AlwaysFalsy) | YaccSymbol`
- ddtrace/vendor/ply/yacc.py:907:29: error[invalid-assignment] Object of type `Unknown` is not assignable to attribute `lexer` on type `(Unknown & ~AlwaysFalsy & ~<Protocol with members 'lexer'>) | (YaccSymbol & ~AlwaysFalsy & ~<Protocol with members 'lexer'>)`
+ ddtrace/vendor/ply/yacc.py:907:29: error[invalid-assignment] Object of type `Unknown` is not assignable to attribute `lexer` on type `(Unknown & ~AlwaysTruthy & ~AlwaysFalsy & ~<Protocol with members 'lexer'>) | (YaccSymbol & ~AlwaysFalsy & ~<Protocol with members 'lexer'>)`
- ddtrace/vendor/ply/yacc.py:920:42: error[unresolved-attribute] Attribute `lineno` is not defined on `None`, `YaccSymbol` in union `None | (Unknown & ~AlwaysFalsy) | YaccSymbol`
+ ddtrace/vendor/ply/yacc.py:920:42: error[unresolved-attribute] Attribute `lineno` is not defined on `None`, `YaccSymbol` in union `None | (Unknown & ~AlwaysTruthy & ~AlwaysFalsy) | YaccSymbol`
- ddtrace/vendor/ply/yacc.py:924:105: error[unresolved-attribute] Attribute `type` is not defined on `YaccSymbol & ~AlwaysFalsy` in union `(Unknown & ~AlwaysFalsy) | (YaccSymbol & ~AlwaysFalsy)`
+ ddtrace/vendor/ply/yacc.py:924:105: error[unresolved-attribute] Attribute `type` is not defined on `YaccSymbol & ~AlwaysFalsy` in union `(Unknown & ~AlwaysTruthy & ~AlwaysFalsy) | (YaccSymbol & ~AlwaysFalsy)`
- ddtrace/vendor/ply/yacc.py:926:83: error[unresolved-attribute] Attribute `type` is not defined on `YaccSymbol & ~AlwaysFalsy` in union `(Unknown & ~AlwaysFalsy) | (YaccSymbol & ~AlwaysFalsy)`
+ ddtrace/vendor/ply/yacc.py:926:83: error[unresolved-attribute] Attribute `type` is not defined on `YaccSymbol & ~AlwaysFalsy` in union `(Unknown & ~AlwaysTruthy & ~AlwaysFalsy) | (YaccSymbol & ~AlwaysFalsy)`
- ddtrace/vendor/ply/yacc.py:938:45: error[unresolved-attribute] Attribute `type` is not defined on `None`, `YaccSymbol` in union `None | (Unknown & ~AlwaysFalsy) | YaccSymbol`
+ ddtrace/vendor/ply/yacc.py:938:45: error[unresolved-attribute] Attribute `type` is not defined on `None`, `YaccSymbol & ~AlwaysTruthy`, `YaccSymbol & ~AlwaysFalsy` in union `None | (Unknown & ~AlwaysTruthy & ~AlwaysFalsy) | (YaccSymbol & ~AlwaysTruthy) | (YaccSymbol & ~AlwaysFalsy)`
- ddtrace/vendor/ply/yacc.py:950:20: error[unresolved-attribute] Attribute `type` is not defined on `None`, `YaccSymbol` in union `None | (Unknown & ~AlwaysFalsy) | YaccSymbol`
+ ddtrace/vendor/ply/yacc.py:950:20: error[unresolved-attribute] Attribute `type` is not defined on `None`, `YaccSymbol & ~AlwaysTruthy`, `YaccSymbol & ~AlwaysFalsy` in union `None | (Unknown & ~AlwaysTruthy & ~AlwaysFalsy) | (YaccSymbol & ~AlwaysTruthy) | (YaccSymbol & ~AlwaysFalsy)`
- ddtrace/vendor/ply/yacc.py:954:20: error[unresolved-a

... (truncated 640 lines) ...

@mtshiba
Copy link
Collaborator Author

mtshiba commented Feb 10, 2026

My original idea didn't work, but instead I was able to suppress the exponential blowup by implementing a cache for narrow_by_constraint_inner.
I'll continue working on it to see if I can improve performance a bit more.

@mtshiba mtshiba reopened this Feb 12, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 12, 2026

ecosystem-analyzer results

Lint rule Added Removed Changed
unresolved-attribute 3 4 60
invalid-key 0 51 0
invalid-argument-type 1 11 38
possibly-unresolved-reference 0 21 0
invalid-assignment 0 0 11
unresolved-reference 0 10 0
not-subscriptable 8 0 0
unsupported-operator 1 0 6
type-assertion-failure 1 1 3
invalid-return-type 1 0 3
no-matching-overload 3 1 0
unused-type-ignore-comment 3 1 0
not-iterable 0 0 3
index-out-of-bounds 0 1 0
possibly-missing-attribute 0 1 0
Total 21 102 124

Full report with detailed diff (timing results)

@mtshiba mtshiba changed the title [ty] [experiment] improve #23109 TDD-based narrowing [ty] improve complex TDD-based narrowing Feb 12, 2026
..
}) => Some(!resolve_to_literal(operand)?),
_ => None,
#[derive(Copy, Clone)]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the end, this didn't seem to do much to improve the performance degradation, but I don't think there's anything bad that can come from leaving it.

self.record_narrowing_constraint(negated_predicate);
self.record_reachability_constraint(negated_predicate);
let predicate_id = self.record_narrowing_constraint(negated_predicate);
self.record_reachability_constraint_id(predicate_id);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because the reachability constraint and the narrowing constraint point to the same predicate, we can reuse the same ID to save memory. That was the original intention, but this change was actually essential for this PR (it was essential for the Bindings::merge change https://github.com/astral-sh/ruff/pull/23201/changes#r2800954123).
Without this identification, it seems that narrowing would be mistakenly determined to be a non no-op when it should be no-op.

place: ScopedPlaceId,
) -> Type<'db> {
self.narrow_by_constraint_inner(db, predicates, id, base_ty, place, None)
let mut memo = FxHashMap::default();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Caching helps mitigate the exponential blowup reported in 5fd9a9c.

{
ScopedNarrowingConstraint::ALWAYS_TRUE
} else {
// A branch contributes narrowing only when it is reachable.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This technique is possible because narrowing and reachability are now managed in the same data structure. The narrowing of a/b is triggered when the reachability of a/b is ALWAYS_TRUE.
That is, gate each narrowing constraint with each reachability constraint with and.

@mtshiba
Copy link
Collaborator Author

mtshiba commented Feb 12, 2026

I've tried various things, but this is the limit. I'm out of ideas for optimization, and the codspeed profiling results show no abnormal hot spots.

So I'll mark this PR as ready for review.

@mtshiba mtshiba marked this pull request as ready for review February 12, 2026 20:48
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.

Thank you for working on this!

@carljm
Copy link
Contributor

carljm commented Feb 13, 2026

@sharkdp I'm wondering if you can review this, since you reviewed the previous diff? I'm realizing that it will take me some time to fully wrap my head around what exactly the previous diff did, and it seems necessary to understand that in order to review this diff well.

@carljm carljm requested review from carljm and removed request for carljm February 13, 2026 05:26
@sharkdp
Copy link
Contributor

sharkdp commented Feb 13, 2026

Sorry I didn't get to this today, it look very interesting. I'll review it next week.

@mtshiba
Copy link
Collaborator Author

mtshiba commented Feb 13, 2026

Hmm, merging the main now results in one test failing.
Looks like I need to address the changes in #22794.

@mtshiba mtshiba marked this pull request as draft February 13, 2026 16:23
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.

(only a partial review, of the ConstExpr logic)

Comment on lines +977 to +988
ast::Operator::FloorDiv => {
if right == 0 {
return None;
}
left.div_euclid(right)
}
ast::Operator::Mod => {
if right == 0 {
return None;
}
left.rem_euclid(right)
}
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure these give the correct result? This is different to the logic we have on the type-inference side in

(Type::IntLiteral(n), Type::IntLiteral(m), ast::Operator::FloorDiv) => Some({
let mut q = n.checked_div(m);
let r = n.checked_rem(m);
// Division works differently in Python than in Rust. If the result is negative and
// there is a remainder, the division rounds down (instead of towards zero):
if n.is_negative() != m.is_negative() && r.unwrap_or(0) != 0 {
q = q.map(|q| q - 1);
}
q.map(Type::IntLiteral)
.unwrap_or_else(|| KnownClass::Int.to_instance(self.db()))
}),
(Type::IntLiteral(n), Type::IntLiteral(m), ast::Operator::Mod) => Some({
let mut r = n.checked_rem(m);
// Division works differently in Python than in Rust. If the result is negative and
// there is a remainder, the division rounds down (instead of towards zero). Adjust
// the remainder to compensate so that q * m + r == n:
if n.is_negative() != m.is_negative() && r.unwrap_or(0) != 0 {
r = r.map(|x| x + m);
}
r.map(Type::IntLiteral)
.unwrap_or_else(|| KnownClass::Int.to_instance(self.db()))
}),

And tests start failing if I apply this patch to the main branch:

diff --git a/crates/ty_python_semantic/src/types/infer/builder.rs b/crates/ty_python_semantic/src/types/infer/builder.rs
index 32e9c34bc2..bbf2f58474 100644
--- a/crates/ty_python_semantic/src/types/infer/builder.rs
+++ b/crates/ty_python_semantic/src/types/infer/builder.rs
@@ -13974,17 +13974,9 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
                 Some(KnownClass::Float.to_instance(self.db()))
             }
 
-            (Type::IntLiteral(n), Type::IntLiteral(m), ast::Operator::FloorDiv) => Some({
-                let mut q = n.checked_div(m);
-                let r = n.checked_rem(m);
-                // Division works differently in Python than in Rust. If the result is negative and
-                // there is a remainder, the division rounds down (instead of towards zero):
-                if n.is_negative() != m.is_negative() && r.unwrap_or(0) != 0 {
-                    q = q.map(|q| q - 1);
-                }
-                q.map(Type::IntLiteral)
-                    .unwrap_or_else(|| KnownClass::Int.to_instance(self.db()))
-            }),
+            (Type::IntLiteral(n), Type::IntLiteral(m), ast::Operator::FloorDiv) => {
+                Some(Type::IntLiteral(n.div_euclid(m)))
+            }
 
             (Type::IntLiteral(n), Type::IntLiteral(m), ast::Operator::Mod) => Some({
                 let mut r = n.checked_rem(m);

Comment on lines +992 to +999
ast::Operator::LShift => {
let shift = u32::try_from(right).ok()?;
left.checked_shl(shift)?
}
ast::Operator::RShift => {
let shift = u32::try_from(right).ok()?;
left.checked_shr(shift)?
}
Copy link
Member

Choose a reason for hiding this comment

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

we actually don't have these ones implemented on the type-inference side at all right now; we just fallback to the dunder methods on int. But that doesn't need to stop us from implementing it here.

Comment on lines +1042 to +1054
let eq = |left: ConstExpr, right: ConstExpr| match (
left.as_int(),
right.as_int(),
) {
(Some(left), Some(right)) => Some(left == right),
_ => match (left, right) {
(ConstExpr::None, ConstExpr::None)
| (ConstExpr::Ellipsis, ConstExpr::Ellipsis) => Some(true),
(ConstExpr::None | ConstExpr::Ellipsis, _)
| (_, ConstExpr::None | ConstExpr::Ellipsis) => Some(false),
_ => None,
},
};
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
let eq = |left: ConstExpr, right: ConstExpr| match (
left.as_int(),
right.as_int(),
) {
(Some(left), Some(right)) => Some(left == right),
_ => match (left, right) {
(ConstExpr::None, ConstExpr::None)
| (ConstExpr::Ellipsis, ConstExpr::Ellipsis) => Some(true),
(ConstExpr::None | ConstExpr::Ellipsis, _)
| (_, ConstExpr::None | ConstExpr::Ellipsis) => Some(false),
_ => None,
},
};
let eq = |left: ConstExpr, right: ConstExpr| match (left, right) {
(ConstExpr::Int(left), ConstExpr::Int(right)) => {
Some(left == right)
}
(ConstExpr::None, ConstExpr::None)
| (ConstExpr::Ellipsis, ConstExpr::Ellipsis) => Some(true),
(ConstExpr::None | ConstExpr::Ellipsis, _)
| (_, ConstExpr::None | ConstExpr::Ellipsis) => Some(false),
_ => None,
};

Comment on lines +948 to +950
ast::Expr::Name(ast::ExprName { id, .. }) if id == "TYPE_CHECKING" => {
Some(ConstExpr::Bool(true))
}
Copy link
Member

Choose a reason for hiding this comment

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

it might be better to use this helper function to identify TYPE_CHECKING constants, so that we have consistent handling everywhere. For example, in other places we treat any attribute expressions where all components are names and the last component is TYPE_CHECKING the same as symbols called TYPE_CHECKING:

/// Returns if the expression is a `TYPE_CHECKING` expression.
fn is_if_type_checking(expr: &ast::Expr) -> bool {
fn is_dotted_name(expr: &ast::Expr) -> bool {
match expr {
ast::Expr::Name(_) => true,
ast::Expr::Attribute(ast::ExprAttribute { value, .. }) => is_dotted_name(value),
_ => false,
}
}
match expr {
ast::Expr::Name(ast::ExprName { id, .. }) => id == "TYPE_CHECKING",
ast::Expr::Attribute(ast::ExprAttribute { value, attr, .. }) => {
attr == "TYPE_CHECKING" && is_dotted_name(value)
}
_ => false,
}
}

// path(s) are reachable, rather than walking both branches.
// `ReturnsNever` always evaluates to `AlwaysTrue` or `AlwaysFalse`,
// never `Ambiguous`.
if matches!(predicate.node, PredicateNode::ReturnsNever(_)) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This special-casing appears to have been introduced for performance reasons, but is no longer necessary due to the addition of the generalized guard below.

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.

4 participants