Skip to content

Conversation

@jackulau
Copy link
Contributor

Summary

Fixes #1960

When passing a generic class as a factory to a function expecting Callable[[T], Result[T]], pyrefly incorrectly reported a bad-specialization error

The Problem

from collections.abc import Callable

class Box[U]:
    pass

class Result[T: int]:
    def __init__(self, x: T | Box[T]) -> None:
        pass

def f[T: int](factory: Callable[[T], Result[T]]) -> None:
    pass

f(factory=Result)  # ERROR: `Box[Unknown] | Unknown` is not assignable to upper bound `int`

Root Cause

When checking $T <: SomeType where $T has a bound (e.g., T: int), the solver was:

  1. Setting $T = SomeType
  2. Then checking if SomeType satisfies the bound

For this case, the constructor callable for Result[Any] has parameter type Any | Box[Any]. The solver set $T = Any | Box[Any] and then checked Any | Box[Any] <: int, which failed.

The Fix

Before setting the type variable, check if the bound already satisfies the constraint. If bound <: target, then any value within the bound automatically satisfies the constraint by transitivity, so we can return early without incorrectly setting the variable.

For this case: int <: Any | Box[Any] is true (since int <: Any), so the constraint is satisfied without needing to set $T = Any | Box[Any].

Test Plan

  • Added regression test test_callable_constructor_bounded_typevar_with_union_param

@meta-cla meta-cla bot added the cla signed label Dec 31, 2025
@github-actions

This comment has been minimized.

@github-actions
Copy link

github-actions bot commented Jan 1, 2026

Diff from mypy_primer, showing the effect of this PR on open source code:

CPython (cases_generator) (https://github.com/python/cpython)
- ERROR Tools/cases_generator/parsing.py:333:5-16: Argument `(self: Self@Parser) -> Family | InstDef | LabelDef | Macro | Pseudo | None` is not assignable to parameter `func` with type `(Self@Parser) -> Family | None` in function `contextual` [bad-argument-type]
+ ERROR Tools/cases_generator/parsing.py:333:5-16: Argument `(self: Self@Parser) -> Family | InstDef | LabelDef | Macro | Pseudo | None` is not assignable to parameter `func` with type `(Parser) -> Family | None` in function `contextual` [bad-argument-type]
- ERROR Tools/cases_generator/parsing.py:429:5-16: Argument `(self: Self@Parser) -> CacheEffect | StackEffect | None` is not assignable to parameter `func` with type `(Self@Parser) -> CacheEffect | None` in function `contextual` [bad-argument-type]
+ ERROR Tools/cases_generator/parsing.py:429:5-16: Argument `(self: Self@Parser) -> CacheEffect | StackEffect | None` is not assignable to parameter `func` with type `(Parser) -> CacheEffect | None` in function `contextual` [bad-argument-type]
- ERROR Tools/cases_generator/parsing.py:535:5-16: Argument `(self: Self@Parser) -> CacheEffect | OpName | None` is not assignable to parameter `func` with type `(Self@Parser) -> CacheEffect | None` in function `contextual` [bad-argument-type]
+ ERROR Tools/cases_generator/parsing.py:535:5-16: Argument `(self: Self@Parser) -> CacheEffect | OpName | None` is not assignable to parameter `func` with type `(Parser) -> CacheEffect | None` in function `contextual` [bad-argument-type]

nionutils (https://github.com/nion-software/nionutils)
+ ERROR nion/utils/StructuredModel.py:158:29-45: Type `object` is not iterable [not-iterable]
+ ERROR nion/utils/StructuredModel.py:211:29-50: Type `object` is not iterable [not-iterable]
+ ERROR nion/utils/StructuredModel.py:281:42-53: Argument `object` is not assignable to parameter `schema` with type `dict[str, Any] | str` in function `build_value` [bad-argument-type]
+ ERROR nion/utils/StructuredModel.py:311:44-55: Argument `object` is not assignable to parameter `schema` with type `dict[str, Any] | str` in function `build_value` [bad-argument-type]

psycopg (https://github.com/psycopg/psycopg)
+ ERROR docs/lib/pg3_docs.py:68:30-34: Argument `bytes | str` is not assignable to parameter `prefix` with type `str | tuple[str, ...]` in function `str.startswith` [bad-argument-type]
+ ERROR psycopg_c/build_backend/psycopg_build_ext.py:56:56-69: `+` is not supported between `bytes` and `Literal['.pyx']` [unsupported-operation]
+ ERROR psycopg_c/build_backend/psycopg_build_ext.py:57:42-55: `+` is not supported between `bytes` and `Literal['.pyx']` [unsupported-operation]

svcs (https://github.com/hynek/svcs)
+ ERROR src/svcs/starlette.py:89:27-38: `dict[str, object] | object | Unknown` is not assignable to attribute `_state` with type `dict[str, object]` [bad-assignment]

egglog-python (https://github.com/egraphs-good/egglog-python)
+ ERROR python/egglog/egraph.py:2165:31-57: Argument `((egraph: EGraph, expr: BaseExpr, children_costs: list[int]) -> int) | CostModel[Any]` is not assignable to parameter `base` with type `CostModel[ComparableAddSub]` in function `GreedyDagCostModel.__init__` [bad-argument-type]

Tanjun (https://github.com/FasterSpeeding/Tanjun)
+ ERROR tanjun/_internal/__init__.py:568:32-43: `list[tuple[list[str], MessageCommand[Any]]] | object | Unknown` is not assignable to variable `node` with type `dict[_IndexKeys | str, list[tuple[list[str], MessageCommand[Any]]] | Unknown] | list[tuple[list[str], MessageCommand[Any]]]` [bad-assignment]

archinstall (https://github.com/archlinux/archinstall)
+ ERROR archinstall/lib/disk/device_handler.py:188:12-16: Returned type `object` is not assignable to declared return type `_PartitionInfo | None` [bad-return]
+ ERROR archinstall/lib/models/device.py:415:14-28: Object of class `object` has no attribute `value` [missing-attribute]
+ ERROR archinstall/lib/models/device.py:415:31-44: Object of class `object` has no attribute `unit` [missing-attribute]
+ ERROR archinstall/lib/models/device.py:416:13-27: Object of class `object` has no attribute `value` [missing-attribute]

cwltool (https://github.com/common-workflow-language/cwltool)
+ ERROR cwltool/builder.py:246:38-39: Cannot set item in `MutableMapping[str, MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None]` [unsupported-operation]
+ ERROR cwltool/builder.py:283:21-23: Argument `MutableMapping[str, object]` is not assignable to parameter `schema` with type `MutableMapping[str, MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None]` in function `Builder.bind_input` [bad-argument-type]
+ ERROR cwltool/builder.py:292:25-27: Argument `MutableMapping[str, object]` is not assignable to parameter `schema` with type `MutableMapping[str, MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None]` in function `Builder.bind_input` [bad-argument-type]
+ ERROR cwltool/builder.py:678:41-42: Argument `object` is not assignable to parameter `ex` with type `MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None` in function `Builder.do_eval` [bad-argument-type]
+ ERROR cwltool/builder.py:680:38-39: Argument `object` is not assignable to parameter `ex` with type `MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None` in function `Builder.do_eval` [bad-argument-type]
+ ERROR cwltool/checker.py:89:40-41: Argument `object` is not assignable to parameter `src` with type `MutableMapping[str, MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None] | MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None` in function `merge_flatten_type` [bad-argument-type]
+ ERROR cwltool/checker.py:134:47-55: Argument `object` is not assignable to parameter `src` with type `MutableMapping[str, MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None] | MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None` in function `can_assign_src_to_sink` [bad-argument-type]
+ ERROR cwltool/checker.py:138:62-70: Argument `object` is not assignable to parameter `src` with type `MutableMapping[str, MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None] | MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None` in function `can_assign_src_to_sink` [bad-argument-type]
+ ERROR cwltool/checker.py:143:44-53: Argument `object` is not assignable to parameter `sink` with type `MutableMapping[str, MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None] | MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None` in function `can_assign_src_to_sink` [bad-argument-type]
+ ERROR cwltool/command_line_tool.py:1434:38-47: `object` is not assignable to variable `result` with type `MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None` [bad-assignment]
+ ERROR cwltool/main.py:196:59-69: Argument `object` is not assignable to parameter `inptype` with type `MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None` in function `generate_example_input` [bad-argument-type]
+ ERROR cwltool/main.py:203:59-69: Argument `object` is not assignable to parameter `inptype` with type `MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None` in function `generate_example_input` [bad-argument-type]
+ ERROR cwltool/main.py:206:63-68: Argument `object` is not assignable to parameter `inptype` with type `MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None` in function `generate_example_input` [bad-argument-type]
+ ERROR cwltool/main.py:374:27-58: Argument `bytes | str | Unknown` is not assignable to parameter `path` with type `str` in function `schema_salad.ref_resolver.file_uri` [bad-argument-type]
+ ERROR cwltool/main.py:391:12-53: Returned type `tuple[MutableMapping[Unknown, Unknown] | None, bytes | str | Any, Loader]` is not assignable to declared return type `tuple[MutableMapping[str, MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None] | None, str, Loader]` [bad-return]
+ ERROR cwltool/main.py:902:17-73: `+` is not supported between `bytes` and `Literal['']` [unsupported-operation]
+ ERROR cwltool/main.py:902:17-73: `+` is not supported between `bytes` and `Literal['/']` [unsupported-operation]
+ ERROR cwltool/main.py:1240:48-87: `+` is not supported between `bytes` and `Literal['_tmp']` [unsupported-operation]
+ ERROR cwltool/main.py:1240:48-87: `bytes | str` is not assignable to attribute `tmp_outdir_prefix` with type `str` [bad-assignment]
+ ERROR cwltool/main.py:1331:50-55: Argument `MutableMapping[str, object]` is not assignable to parameter `doc` with type `MutableMapping[str, MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None]` in function `remove_at_id` [bad-argument-type]
+ ERROR cwltool/process.py:437:46-51: Argument `object` is not assignable to parameter `field_type` with type `MutableMapping[str, MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None] | MutableMapping[str, Unknown] | MutableSequence[Any] | MutableSequence[Unknown] | bool | float | int | str | None` in function `avroize_type` [bad-argument-type]
+ ERROR cwltool/process.py:496:40-46: Argument `object` is not assignable to parameter `obj` with type `MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None` in function `var_spool_cwl_detector` [bad-argument-type]
+ ERROR cwltool/process.py:499:40-46: Argument `object` is not assignable to parameter `obj` with type `MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None` in function `var_spool_cwl_detector` [bad-argument-type]
+ ERROR cwltool/secrets.py:46:40-50: Argument `object` is not assignable to parameter `value` with type `MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None` in function `SecretStore.has_secret` [bad-argument-type]
+ ERROR cwltool/secrets.py:50:40-50: Argument `object` is not assignable to parameter `value` with type `MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None` in function `SecretStore.has_secret` [bad-argument-type]
+ ERROR cwltool/secrets.py:62:42-43: Argument `object` is not assignable to parameter `value` with type `MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None` in function `SecretStore.retrieve` [bad-argument-type]
+ ERROR cwltool/secrets.py:64:39-40: Argument `object` is not assignable to parameter `value` with type `MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None` in function `SecretStore.retrieve` [bad-argument-type]
+ ERROR cwltool/software_requirements.py:60:40-59: `bytes | str | Any` is not assignable to attribute `tool_dependency_dir` with type `str | None` [bad-assignment]
+ ERROR cwltool/software_requirements.py:61:53-79: `bytes | str` is not assignable to attribute `dependency_resolvers_config_file` with type `str | None` [bad-assignment]
+ ERROR cwltool/update.py:135:56-57: Argument `object` is not assignable to parameter `t` with type `MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None` in function `update_secondaryFiles` [bad-argument-type]
+ ERROR cwltool/update.py:306:9-20: Object of class `object` has no attribute `lc` [missing-attribute]
+ ERROR cwltool/update.py:307:9-20: Object of class `object` has no attribute `lc` [missing-attribute]
+ ERROR cwltool/update.py:308:9-27: Cannot set item in `object` [unsupported-operation]
+ ERROR cwltool/update.py:315:15-37: Cannot index into `object` [bad-index]
+ ERROR cwltool/update.py:316:5-23: Cannot set item in `object` [unsupported-operation]
+ ERROR cwltool/update.py:318:20-32: Object of class `object` has no attribute `get` [missing-attribute]
+ ERROR cwltool/update.py:318:57-65: Object of class `object` has no attribute `get` [missing-attribute]
+ ERROR cwltool/workflow_job.py:337:28-30: Argument `object` is not assignable to parameter `sinktype` with type `MutableMapping[str, MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None] | MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None` in function `match_types` [bad-argument-type]
+ ERROR cwltool/workflow_job.py:344:37-48: Cannot set item in `MutableMapping[str, MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None]` [unsupported-operation]
+ ERROR cwltool/workflow_job.py:359:36-45: Argument `MutableSequence[object]` is not assignable to parameter `iterable` with type `Iterable[MutableMapping[str, Unknown] | MutableSequence[Unknown] | bool | float | int | str | None]` in function `list.extend` [bad-argument-type]

kornia (https://github.com/kornia/kornia)
+ ERROR kornia/augmentation/container/augment.py:405:35-41: Object of class `object` has no attribute `type` [missing-attribute]
+ ERROR kornia/augmentation/container/augment.py:414:35-41: Object of class `object` has no attribute `type` [missing-attribute]
+ ERROR kornia/augmentation/container/augment.py:590:25-29: Object of class `object` has no attribute `to` [missing-attribute]
+ ERROR kornia/augmentation/container/augment.py:590:73-77: Object of class `object` has no attribute `to` [missing-attribute]
+ ERROR kornia/augmentation/container/augment.py:602:25-29: Object of class `object` has no attribute `to` [missing-attribute]
+ ERROR kornia/augmentation/container/augment.py:602:71-75: Object of class `object` has no attribute `to` [missing-attribute]
+ ERROR kornia/augmentation/container/augment.py:655:29-41: Object of class `object` has no attribute `dtype` [missing-attribute]
+ ERROR kornia/augmentation/container/augment.py:656:28-35: Object of class `object` has no attribute `float` [missing-attribute]
+ ERROR kornia/augmentation/presets/ada.py:209:26-42: Object of class `object` has no attribute `size` [missing-attribute]
+ ERROR kornia/augmentation/presets/ada.py:210:22-40: Object of class `object` has no attribute `device` [missing-attribute]
+ ERROR kornia/augmentation/presets/ada.py:219:26-47: Cannot index into `object` [bad-index]
+ ERROR kornia/augmentation/presets/ada.py:233:33-52: Object of class `object` has no attribute `clone` [missing-attribute]
+ ERROR kornia/feature/dedode/transformer/dinov2.py:232:22-31: Expected a callable, got `object` [not-callable]
+ ERROR kornia/feature/dedode/transformer/dinov2.py:252:18-27: Expected a callable, got `object` [not-callable]
+ ERROR kornia/feature/dedode/transformer/dinov2.py:299:24-33: Expected a callable, got `object` [not-callable]
+ ERROR kornia/models/base.py:81:29-32: Argument `object` is not assignable to parameter `path_file` with type `Path | str` in function `kornia.io.io.write_image` [bad-argument-type]
+ ERROR kornia/models/base.py:105:29-32: Argument `object` is not assignable to parameter `path_file` with type `Path | str` in function `kornia.io.io.write_image` [bad-argument-type]
+ ERROR kornia/models/depth_estimation/base.py:53:62-73: Cannot index into `object` [bad-index]
+ ERROR kornia/models/depth_estimation/base.py:55:62-74: Object of class `object` has no attribute `device` [missing-attribute]
+ ERROR kornia/models/depth_estimation/base.py:55:82-93: Object of class `object` has no attribute `dtype` [missing-attribute]
+ ERROR kornia/models/efficient_vit/nn/ops.py:163:26-38: Argument `object | Unknown` is not assignable to parameter `out_channels` with type `int` in function `ConvLayer.__init__` [bad-argument-type]
+ ERROR kornia/models/efficient_vit/nn/ops.py:166:13-25: Argument `object | Unknown` is not assignable to parameter `in_channels` with type `int` in function `ConvLayer.__init__` [bad-argument-type]
+ ERROR kornia/models/efficient_vit/nn/ops.py:167:13-25: Argument `object | Unknown` is not assignable to parameter `out_channels` with type `int` in function `ConvLayer.__init__` [bad-argument-type]
+ ERROR kornia/models/efficient_vit/nn/ops.py:176:13-25: Argument `object | Unknown` is not assignable to parameter `in_channels` with type `int` in function `ConvLayer.__init__` [bad-argument-type]
+ ERROR kornia/models/efficient_vit/nn/ops.py:209:13-25: Argument `object | Unknown` is not assignable to parameter `out_channels` with type `int` in function `ConvLayer.__init__` [bad-argument-type]
+ ERROR kornia/models/efficient_vit/nn/ops.py:218:13-25: Argument `object | Unknown` is not assignable to parameter `in_channels` with type `int` in function `ConvLayer.__init__` [bad-argument-type]
+ ERROR kornia/models/efficient_vit/nn/ops.py:248:26-38: Argument `object | Unknown` is not assignable to parameter `out_channels` with type `int` in function `ConvLayer.__init__` [bad-argument-type]
+ ERROR kornia/models/efficient_vit/nn/ops.py:251:13-25: Argument `object | Unknown` is not assignable to parameter `in_channels` with type `int` in function `ConvLayer.__init__` [bad-argument-type]
+ ERROR kornia/models/segmentation/base.py:63:44-55: Cannot index into `object` [bad-index]
+ ERROR kornia/models/segmentation/base.py:175:20-38: Object of class `object` has no attribute `ndim` [missing-attribute]
+ ERROR kornia/models/segmentation/base.py:176:87-106: Object of class `object` has no attribute `shape` [missing-attribute]
+ ERROR kornia/models/segmentation/base.py:178:44-62: Object of class `object` has no attribute `size` [missing-attribute]
+ ERROR kornia/models/segmentation/base.py:229:61-76: Cannot index into `object` [bad-index]
+ ERROR kornia/models/segmentation/base.py:229:83-105: Cannot index into `object` [bad-index]
+ ERROR kornia/utils/helpers.py:382:55-60: Argument `object` is not assignable to parameter `dict_obj` with type `dict[str, Any]` in function `dict_to_dataclass` [bad-argument-type]

cki-lib (https://gitlab.com/cki-project/cki-lib)
+ ERROR cki_lib/config_tree.py:31:46-52: Argument `object` is not assignable to parameter `key` with type `str` in function `_merged` [bad-argument-type]
+ ERROR cki_lib/logger.py:87:60-65: Argument `object` is not assignable to parameter `obj` with type `dict[str, Any]` in function `PackFormatter.flatten` [bad-argument-type]
+ ERROR cki_lib/misc.py:85:20-81: `object | Any` is not assignable to variable `data` with type `dict[str, Any] | list[Any]` [bad-assignment]
+ ERROR cki_lib/misc.py:119:20-37: `object` is not assignable to variable `data` with type `dict[str, Any] | list[Any]` [bad-assignment]
+ ERROR cki_lib/yaml.py:264:5-31: Cannot set item in `object` [unsupported-operation]
+ ERROR cki_lib/yaml.py:272:9-35: Cannot delete item in `object` [unsupported-operation]

dulwich (https://github.com/dulwich/dulwich)
+ ERROR dulwich/cli.py:1613:18-26: Argument `bytes | str` is not assignable to parameter `basename` with type `str` in function `dulwich.pack.Pack.__init__` [bad-argument-type]
+ ERROR dulwich/graph.py:212:21-28: Type `SupportsDunderGT[Any]` is not iterable [not-iterable]
+ ERROR dulwich/graph.py:212:21-28: Type `SupportsDunderLT[Any]` is not iterable [not-iterable]
+ ERROR dulwich/porcelain/__init__.py:1792:44-60: No matching overload found for function `posixpath.join` called with arguments: (str, bytes | str) [no-matching-overload]
+ ERROR dulwich/porcelain/__init__.py:1798:49-70: No matching overload found for function `posixpath.join` called with arguments: (str, bytes | str) [no-matching-overload]
+ ERROR dulwich/porcelain/__init__.py:1804:49-82: No matching overload found for function `posixpath.join` called with arguments: (bytes | str | Unknown, bytes | str | Unknown) [no-matching-overload]
+ ERROR dulwich/reftable.py:985:13-47: Type `SupportsDunderGT[Any]` is not iterable [not-iterable]
+ ERROR dulwich/reftable.py:985:13-47: Type `SupportsDunderLT[Any]` is not iterable [not-iterable]

alerta (https://github.com/alerta/alerta)
+ ERROR alerta/models/alert.py:238:38-39: Argument `dict[object, object]` is not assignable to parameter `doc` with type `dict[str, Any]` in function `Alert.from_document` [bad-argument-type]
+ ERROR alerta/models/blackout.py:215:38-39: Argument `dict[object, object]` is not assignable to parameter `doc` with type `dict[str, Any]` in function `Blackout.from_document` [bad-argument-type]
+ ERROR alerta/models/customer.py:59:38-39: Argument `dict[object, object]` is not assignable to parameter `doc` with type `dict[str, Any]` in function `Customer.from_document` [bad-argument-type]
+ ERROR alerta/models/group.py:123:38-39: Argument `dict[object, object]` is not assignable to parameter `doc` with type `dict[str, Any]` in function `Group.from_document` [bad-argument-type]
+ ERROR alerta/models/heartbeat.py:151:38-39: Argument `dict[object, object]` is not assignable to parameter `doc` with type `dict[str, Any]` in function `Heartbeat.from_document` [bad-argument-type]
+ ERROR alerta/models/key.py:116:38-39: Argument `dict[object, object]` is not assignable to parameter `doc` with type `dict[str, Any]` in function `ApiKey.from_document` [bad-argument-type]
+ ERROR alerta/models/note.py:103:38-39: Argument `dict[object, object]` is not assignable to parameter `doc` with type `dict[str, Any]` in function `Note.from_document` [bad-argument-type]
+ ERROR alerta/models/permission.py:64:38-39: Argument `dict[object, object]` is not assignable to parameter `doc` with type `dict[str, Any]` in function `Permission.from_document` [bad-argument-type]
+ ERROR alerta/models/user.py:142:38-39: Argument `dict[object, object]` is not assignable to parameter `doc` with type `dict[str, Any]` in function `User.from_document` [bad-argument-type]

hydpy (https://github.com/hydpy-dev/hydpy)
+ ERROR hydpy/auxs/armatools.py:802:54-804:10: No matching overload found for function `numpy.linalg._linalg.lstsq` called with arguments: (ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[generic[Any]]], rcond=Literal[-1]) [no-matching-overload]
+ ERROR hydpy/auxs/calibtools.py:286:35-60: `*` is not supported between `float` and `ndarray[tuple[Any, ...], dtype[generic[Any]]]` [unsupported-operation]
+ ERROR hydpy/auxs/calibtools.py:288:28-56: `*` is not supported between `float` and `ndarray[tuple[Any, ...], dtype[generic[Any]]]` [unsupported-operation]
+ ERROR hydpy/auxs/calibtools.py:719:51-62: `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to upper bound `float | ndarray[tuple[Any, ...], dtype[float64]]` of type variable `ArrayFloat` [bad-specialization]
+ ERROR hydpy/auxs/validtools.py:74:13-38: `<` is not supported between `generic[Any]` and `float` [unsupported-operation]
+ ERROR hydpy/core/importtools.py:1352:27-67: `bytes | str` is not assignable to variable `controlfile` with type `str | None` [bad-assignment]
+ ERROR hydpy/core/itemtools.py:1564:22-40: `+` is not supported between `ndarray[tuple[Any, ...], dtype[generic[Any]]]` and `ndarray[tuple[Any, ...], dtype[float64]]` [unsupported-operation]
+ ERROR hydpy/core/itemtools.py:1636:22-40: `*` is not supported between `ndarray[tuple[Any, ...], dtype[generic[Any]]]` and `ndarray[tuple[Any, ...], dtype[float64]]` [unsupported-operation]
+ ERROR hydpy/core/masktools.py:229:56-77: `<` is not supported between `generic[Any]` and `Literal[1]` [unsupported-operation]
+ ERROR hydpy/core/masktools.py:243:18-36: Unary `~` is not supported on `ndarray[tuple[Any, ...], dtype[generic[Any]]]` [unsupported-operation]
- ERROR hydpy/core/masktools.py:299:22-47: Cannot index into `ndarray[tuple[Any, ...], dtype[Any]]` [bad-index]
+ ERROR hydpy/core/masktools.py:299:22-47: Cannot index into `ndarray[tuple[Any, ...], dtype[generic[Any]]]` [bad-index]
- ERROR hydpy/core/masktools.py:300:19-27: No matching overload found for function `set.__init__` called with arguments: (bool | float | int | ndarray[tuple[Any, ...], dtype[Any]] | Unknown) [no-matching-overload]
+ ERROR hydpy/core/masktools.py:300:19-27: No matching overload found for function `set.__init__` called with arguments: (bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]] | Unknown) [no-matching-overload]
- ERROR hydpy/core/modeltools.py:3456:33-76: No matching overload found for function `range.__new__` called with arguments: (type[range], bool | float | int | ndarray[tuple[Any, ...], dtype[Any]]) [no-matching-overload]
+ ERROR hydpy/core/modeltools.py:3456:33-76: No matching overload found for function `range.__new__` called with arguments: (type[range], bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]) [no-matching-overload]
- ERROR hydpy/core/modeltools.py:3458:33-71: No matching overload found for function `range.__new__` called with arguments: (type[range], bool | float | int | ndarray[tuple[Any, ...], dtype[Any]]) [no-matching-overload]
+ ERROR hydpy/core/modeltools.py:3458:33-71: No matching overload found for function `range.__new__` called with arguments: (type[range], bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]) [no-matching-overload]
- ERROR hydpy/core/modeltools.py:3514:25-62: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[Any]]` is not assignable to parameter `value` with type `float` in function `SubstepModel.timeleft` [bad-argument-type]
+ ERROR hydpy/core/modeltools.py:3514:25-62: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to parameter `value` with type `float` in function `SubstepModel.timeleft` [bad-argument-type]
- ERROR hydpy/core/modeltools.py:4050:13-53: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[Any]]` is not assignable to parameter `double` with type `float` in function `hydpy.cythons.modelutils.isnan` [bad-argument-type]
+ ERROR hydpy/core/modeltools.py:4050:13-53: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to parameter `double` with type `float` in function `hydpy.cythons.modelutils.isnan` [bad-argument-type]
+ ERROR hydpy/core/modeltools.py:4061:17-60: `*` is not supported between `float` and `ndarray[tuple[Any, ...], dtype[generic[Any]]]` [unsupported-operation]
+ ERROR hydpy/core/modeltools.py:4578:40-72: No matching overload found for function `max` called with arguments: (float, generic[Any]) [no-matching-overload]
- ERROR hydpy/core/modeltools.py:4059:34-4063:14: No matching overload found for function `min` called with arguments: (float, float | ndarray[tuple[Any, ...], dtype[float64]], Unknown) [no-matching-overload]
+ ERROR hydpy/core/modeltools.py:4585:44-4587:18: No matching overload found for function `max` called with arguments: (float, generic[Any]) [no-matching-overload]
+ ERROR hydpy/core/objecttools.py:2022:28-29: Argument `object` is not assignable to parameter `ys` with type `Mapping[str, Unknown] | Sequence[Unknown] | float | ndarray[tuple[Any, ...], dtype[float64]]` in function `is_equal` [bad-argument-type]
+ ERROR hydpy/core/parametertools.py:1788:48-61: `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to upper bound `float | ndarray[tuple[Any, ...], dtype[float64]]` of type variable `ArrayFloat` [bad-specialization]
+ ERROR hydpy/core/parametertools.py:1794:43-55: `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to upper bound `float | ndarray[tuple[Any, ...], dtype[float64]]` of type variable `ArrayFloat` [bad-specialization]
+ ERROR hydpy/core/parametertools.py:2374:42-50: `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to upper bound `float | ndarray[tuple[Any, ...], dtype[float64]]` of type variable `ArrayFloat` [bad-specialization]
+ ERROR hydpy/core/parametertools.py:2435:24-42: Unary `~` is not supported on `ndarray[tuple[Any, ...], dtype[generic[Any]]]` [unsupported-operation]
+ ERROR hydpy/core/parametertools.py:2442:48-56: `ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to upper bound `float | ndarray[tuple[Any, ...], dtype[float64]]` of type variable `ArrayFloat` [bad-specialization]
+ ERROR hydpy/core/parametertools.py:2842:43-51: `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to upper bound `float | ndarray[tuple[Any, ...], dtype[float64]]` of type variable `ArrayFloat` [bad-specialization]
+ ERROR hydpy/core/parametertools.py:3414:40-53: `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to upper bound `float | ndarray[tuple[Any, ...], dtype[float64]]` of type variable `ArrayFloat` [bad-specialization]
- ERROR hydpy/core/parametertools.py:3423:38-63: No matching overload found for function `zip.__new__` called with arguments: (type[zip[_T_co]], tuple[str, ...], bool | float | int | ndarray[tuple[Any, ...], dtype[Any]]) [no-matching-overload]
+ ERROR hydpy/core/parametertools.py:3423:38-63: No matching overload found for function `zip.__new__` called with arguments: (type[zip[_T_co]], tuple[str, ...], bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]) [no-matching-overload]
+ ERROR hydpy/core/parametertools.py:3894:40-53: `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to upper bound `float | ndarray[tuple[Any, ...], dtype[float64]]` of type variable `ArrayFloat` [bad-specialization]
+ ERROR hydpy/core/parametertools.py:4077:22-46: `<` is not supported between `ndarray[tuple[Any, ...], dtype[generic[Any]]]` and `ndarray[tuple[Any, ...], dtype[generic[Any]]]` [unsupported-operation]
+ ERROR hydpy/core/sequencetools.py:818:53-63: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to parameter `x` with type `float | ndarray[tuple[Any, ...], dtype[float64]]` in function `copy.deepcopy` [bad-argument-type]
+ ERROR hydpy/core/sequencetools.py:2095:30-35: Argument `ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to parameter `array` with type `ndarray[tuple[Any, ...], dtype[float64]]` in function `InfoArray.__new__` [bad-argument-type]
- ERROR hydpy/core/variabletools.py:1680:20-30: Returned type `bool | float | int | ndarray[tuple[Any, ...], dtype[Any]]` is not assignable to declared return type `ndarray[tuple[Any, ...], dtype[Unknown]]` [bad-return]
+ ERROR hydpy/core/variabletools.py:1680:20-30: Returned type `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to declared return type `ndarray[tuple[Any, ...], dtype[Unknown]]` [bad-return]
- ERROR hydpy/core/variabletools.py:1855:24-34: Returned type `bool | float | int | ndarray[tuple[Any, ...], dtype[Any]]` is not assignable to declared return type `float` [bad-return]
+ ERROR hydpy/core/variabletools.py:1855:24-34: Returned type `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to declared return type `float` [bad-return]
+ ERROR hydpy/core/variabletools.py:2070:16-27: Unary `+` is not supported on `ndarray[tuple[Any, ...], dtype[generic[Any]]]` [unsupported-operation]
+ ERROR hydpy/core/variabletools.py:2073:16-27: Unary `-` is not supported on `ndarray[tuple[Any, ...], dtype[generic[Any]]]` [unsupported-operation]
- ERROR hydpy/core/variabletools.py:2076:20-30: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[Any]]` is not assignable to parameter `x` with type `SupportsAbs[int]` in function `abs` [bad-argument-type]
+ ERROR hydpy/core/variabletools.py:2076:20-30: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to parameter `x` with type `SupportsAbs[int]` in function `abs` [bad-argument-type]
+ ERROR hydpy/core/variabletools.py:2079:16-32: `/` is not supported between `float` and `ndarray[tuple[Any, ...], dtype[generic[Any]]]` [unsupported-operation]
+ ERROR hydpy/core/variabletools.py:2082:18-35: `//` is not supported between `ndarray[tuple[Any, ...], dtype[generic[Any]]]` and `float` [unsupported-operation]
+ ERROR hydpy/core/variabletools.py:2218:27-48: No matching overload found for function `numpy._core.fromnumeric.around` called with arguments: (bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]], int) [no-matching-overload]
- ERROR hydpy/exe/xmltools.py:2340:53-61: Argument `type[AddItem] | type[GetItem] | type[MultiplyItem] | type[SetItem]` is not assignable to parameter `itemtype` with type `type[AddItem]` in function `XMLVar._get_changeitem` [bad-argument-type]
+ ERROR hydpy/exe/xmltools.py:2340:53-61: Argument `type[AddItem] | type[GetItem] | type[MultiplyItem] | type[SetItem]` is not assignable to parameter `itemtype` with type `type[AddItem | MultiplyItem | SetItem]` in function `XMLVar._get_changeitem` [bad-argument-type]
- ERROR hydpy/models/arma/arma_derived.py:45:29-39: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[Any]]` is not assignable to parameter `value` with type `int | tuple[int, ...]` in function `hydpy.core.propertytools.BaseProperty.__set__` [bad-argument-type]
+ ERROR hydpy/models/arma/arma_derived.py:45:29-39: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to parameter `value` with type `int | tuple[int, ...]` in function `hydpy.core.propertytools.BaseProperty.__set__` [bad-argument-type]
- ERROR hydpy/models/arma/arma_derived.py:46:30-40: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[Any]]` is not assignable to parameter `value` with type `int | tuple[int, ...]` in function `hydpy.core.propertytools.BaseProperty.__set__` [bad-argument-type]
+ ERROR hydpy/models/arma/arma_derived.py:46:30-40: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to parameter `value` with type `int | tuple[int, ...]` in function `hydpy.core.propertytools.BaseProperty.__set__` [bad-argument-type]
- ERROR hydpy/models/arma/arma_derived.py:47:28-38: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[Any]]` is not assignable to parameter `value` with type `int | tuple[int, ...]` in function `hydpy.core.propertytools.BaseProperty.__set__` [bad-argument-type]
+ ERROR hydpy/models/arma/arma_derived.py:47:28-38: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to parameter `value` with type `int | tuple[int, ...]` in function `hydpy.core.propertytools.BaseProperty.__set__` [bad-argument-type]
- ERROR hydpy/models/arma/arma_derived.py:48:28-38: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[Any]]` is not assignable to parameter `value` with type `int | tuple[int, ...]` in function `hydpy.core.propertytools.BaseProperty.__set__` [bad-argument-type]
+ ERROR hydpy/models/arma/arma_derived.py:48:28-38: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to parameter `value` with type `int | tuple[int, ...]` in function `hydpy.core.propertytools.BaseProperty.__set__` [bad-argument-type]
- ERROR hydpy/models/conv/conv_derived.py:32:34-44: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[Any]]` is not assignable to parameter `value` with type `int | tuple[int, ...]` in function `hydpy.core.propertytools.BaseProperty.__set__` [bad-argument-type]
+ ERROR hydpy/models/conv/conv_derived.py:32:34-44: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to parameter `value` with type `int | tuple[int, ...]` in function `hydpy.core.propertytools.BaseProperty.__set__` [bad-argument-type]
- ERROR hydpy/models/conv/conv_derived.py:78:34-44: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[Any]]` is not assignable to parameter `value` with type `int | tuple[int, ...]` in function `hydpy.core.propertytools.BaseProperty.__set__` [bad-argument-type]
+ ERROR hydpy/models/conv/conv_derived.py:78:34-44: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to parameter `value` with type `int | tuple[int, ...]` in function `hydpy.core.propertytools.BaseProperty.__set__` [bad-argument-type]
- ERROR hydpy/models/conv/conv_derived.py:138:38-47: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[Any]]` is not assignable to parameter `obj` with type `Sized` in function `len` [bad-argument-type]
+ ERROR hydpy/models/conv/conv_derived.py:138:38-47: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to parameter `obj` with type `Sized` in function `len` [bad-argument-type]
- ERROR hydpy/models/conv/conv_derived.py:138:54-62: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[Any]]` is not assignable to parameter `obj` with type `Sized` in function `len` [bad-argument-type]
+ ERROR hydpy/models/conv/conv_derived.py:138:54-62: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to parameter `obj` with type `Sized` in function `len` [bad-argument-type]
- ERROR hydpy/models/conv/conv_derived.py:139:40-49: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[Any]]` is not assignable to parameter `iterable` with type `Iterable[@_]` in function `enumerate.__new__` [bad-argument-type]
+ ERROR hydpy/models/conv/conv_derived.py:139:40-49: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]` is not assignable to parameter `iterable` with type `Iterable[@_]` in function `enumerate.__new__` [bad-argument-type]
- ERROR hydpy/models/conv/conv_derived.py:196:27-77: No matching overload found for function `numpy._core.multiarray._ConstructorEmpty.__call__` called with arguments: (tuple[int, bool | float | int | ndarray[tuple[Any, ...], dtype[Any]]], dtype=type[signedinteger[_64Bit]]) [no-matching-overload]
+ ERROR hydpy/models/conv/conv_derived.py:196:27-77: No matching overload found for function `numpy._core.multiarray._ConstructorEmpty.__call__` called with arguments: (tuple[int, bool | float | int | ndarray[tuple[Any, ...], dtype[generic[Any]]]], dtype=type[signedinteger[_64Bit]]) [no-matching-overload]
- ERROR hydpy/models/conv/conv_derived.py:196:33-42: Argument `bool | float | int | ndarray[tuple[Any, ...], dtype[Any]]` is not assignable to parameter `obj` with type `Sized` in function `len` [bad-argument-type]

... (truncated 456 lines) ...

django-stubs (https://github.com/typeddjango/django-stubs)
+ ERROR ext/django_stubs_ext/patch.py:114:9-15: Object of class `object` has no attribute `cls` [missing-attribute]

dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ERROR ddtrace/_trace/utils_botocore/span_pointers/dynamodb.py:663:16-26: Returned type `dict[str, object]` is not assignable to declared return type `dict[str, str] | None` [bad-return]
+ ERROR ddtrace/appsec/_trace_utils.py:54:34-65: Argument `tuple[str, object, int]` is not assignable to parameter `object` with type `tuple[str, dict[Unknown, Unknown], int]` in function `list.append` [bad-argument-type]
- ERROR ddtrace/commands/ddtrace_run.py:98:33-56: No matching overload found for function `posixpath.join` called with arguments: (object, Literal['bootstrap']) [no-matching-overload]
+ ERROR ddtrace/commands/ddtrace_run.py:98:33-56: No matching overload found for function `posixpath.join` called with arguments: (LiteralString | bytes | str, Literal['bootstrap']) [no-matching-overload]
- ERROR ddtrace/contrib/internal/botocore/services/bedrock.py:303:12-58: Returned type `dict[str, list[str | Unknown | None] | list[Any] | list[Unknown]]` is not assignable to declared return type `dict[str, list[str]]` [bad-return]
+ ERROR ddtrace/contrib/internal/botocore/services/bedrock.py:303:12-58: Returned type `dict[str, list[str | Unknown | None] | list[object]]` is not assignable to declared return type `dict[str, list[str]]` [bad-return]
+ ERROR ddtrace/contrib/internal/botocore/services/bedrock.py:358:12-58: Returned type `dict[str, list[str | Any] | list[str | Unknown] | list[object]]` is not assignable to declared return type `dict[str, list[str]]` [bad-return]
+ ERROR ddtrace/contrib/internal/flask_cache/utils.py:47:29-54: Object of class `object` has no attribute `address` [missing-attribute]
- ERROR ddtrace/contrib/internal/pylibmc/client.py:130:104-113: Cannot index into `Iterable[Unknown]` [bad-index]
+ ERROR ddtrace/contrib/internal/pylibmc/client.py:130:104-113: Cannot index into `Iterable[object]` [bad-index]
+ ERROR ddtrace/contrib/internal/ray/patch.py:539:9-29: Object of class `object` has no attribute `__signature__` [missing-attribute]
+ ERROR ddtrace/contrib/internal/ray/patch.py:543:36-42: Argument `object` is not assignable to parameter `wrapped` with type `(ParamSpec(@_)) -> @_` in function `functools.wraps` [bad-argument-type]
+ ERROR ddtrace/contrib/internal/ray/patch.py:543:72-78: Argument `object` is not assignable to parameter `method` with type `(...) -> Any` in function `_job_supervisor_run_wrapper` [bad-argument-type]
+ ERROR ddtrace/contrib/internal/ray/patch.py:545:36-42: Argument `object` is not assignable to parameter `wrapped` with type `(ParamSpec(@_)) -> @_` in function `functools.wraps` [bad-argument-type]
+ ERROR ddtrace/contrib/internal/ray/patch.py:545:69-75: Argument `object` is not assignable to parameter `method` with type `(...) -> Any` in function `_exec_entrypoint_wrapper` [bad-argument-type]
+ ERROR ddtrace/contrib/internal/ray/patch.py:550:40-46: Argument `object` is not assignable to parameter `wrapped` with type `(ParamSpec(@_)) -> @_` in function `functools.wraps` [bad-argument-type]
+ ERROR ddtrace/contrib/internal/ray/patch.py:550:77-83: Argument `object` is not assignable to parameter `method` with type `(...) -> Any` in function `_inject_tracing_actor_method` [bad-argument-type]
+ ERROR ddtrace/debugging/_probe/remoteconfig.py:312:12-48: `>` is not supported between `float` and `SupportsComplex` [unsupported-operation]
+ ERROR ddtrace/debugging/_probe/remoteconfig.py:312:12-48: `>` is not supported between `float` and `SupportsFloat` [unsupported-operation]
+ ERROR ddtrace/debugging/_probe/remoteconfig.py:312:12-48: `>` is not supported between `float` and `SupportsIndex` [unsupported-operation]
+ ERROR ddtrace/debugging/_probe/remoteconfig.py:312:12-48: `>` is not supported between `float` and `SupportsInt` [unsupported-operation]
+ ERROR ddtrace/internal/ci_visibility/git_client.py:500:85-101: Object of class `bytes` has no attribute `encode` [missing-attribute]
+ ERROR ddtrace/internal/coverage/report.py:209:51-213:10: No matching overload found for function `sorted` called with arguments: (set[object]) [no-matching-overload]
+ ERROR ddtrace/internal/coverage/report.py:214:50-217:10: No matching overload found for function `sorted` called with arguments: (set[object]) [no-matching-overload]
+ ERROR ddtrace/internal/coverage/report.py:219:51-222:10: No matching overload found for function `sorted` called with arguments: (set[object]) [no-matching-overload]
+ ERROR ddtrace/internal/coverage/report.py:223:50-226:10: No matching overload found for function `sorted` called with arguments: (set[object]) [no-matching-overload]
+ ERROR ddtrace/internal/utils/http.py:452:22-76: No matching overload found for function `dict.__init__` called with arguments: (Generator[list[str], None, None]) [no-matching-overload]
+ ERROR ddtrace/llmobs/_evaluators/ragas/faithfulness.py:170:20-30: Returned type `list[object]` is not assignable to declared return type `list[str] | None` [bad-return]
+ ERROR ddtrace/llmobs/_experiment.py:319:77-96: Cannot set item in `dict[tuple[str, str], Never]` [unsupported-operation]
+ ERROR ddtrace/llmobs/_experiment.py:328:63-75: Cannot set item in `dict[tuple[str, str], Never]` [unsupported-operation]
+ ERROR ddtrace/llmobs/_integrations/langchain.py:509:32-43: Type `object` is not iterable [not-iterable]
+ ERROR ddtrace/llmobs/_integrations/langchain.py:734:33-47: Object of class `object` has no attribute `page_content` [missing-attribute]
+ ERROR ddtrace/llmobs/_utils.py:124:20-33: Type `object` is not iterable [not-iterable]
+ ERROR ddtrace/llmobs/_utils.py:131:39-46: Cannot set item in `dict[str, dict[str, Any] | list[dict[str, str]] | list[str] | list[Unknown] | str]` [unsupported-operation]
+ ERROR ddtrace/llmobs/_utils.py:133:41-50: Cannot set item in `dict[str, dict[str, Any] | list[dict[str, str]] | list[str] | list[Unknown] | str]` [unsupported-operation]
+ ERROR ddtrace/llmobs/_utils.py:135:40-48: Cannot set item in `dict[str, dict[str, Any] | list[dict[str, str]] | list[str] | list[Unknown] | str]` [unsupported-operation]
+ ERROR ddtrace/llmobs/_utils.py:139:36-40: Cannot set item in `dict[str, dict[str, Any] | list[dict[str, str]] | list[str] | list[Unknown] | str]` [unsupported-operation]
+ ERROR ddtrace/vendor/ply/yacc.py:1339:57-68: No matching overload found for function `str.join` called with arguments: (tuple[object, ...]) [no-matching-overload]
- ERROR ddtrace/vendor/ply/yacc.py:1437:27-43: `tuple[Unknown, ...]` is not assignable to attribute `prod` with type `list[Unknown]` [bad-assignment]
+ ERROR ddtrace/vendor/ply/yacc.py:1437:27-43: `tuple[object, ...]` is not assignable to attribute `prod` with type `list[Unknown]` [bad-assignment]
+ ERROR ddtrace/vendor/ply/yacc.py:2982:20-24: Cannot index into `SupportsDunderGT[Any]` [bad-index]
+ ERROR ddtrace/vendor/ply/yacc.py:2982:20-24: Cannot index into `SupportsDunderLT[Any]` [bad-index]
+ ERROR ddtrace/vendor/ply/yacc.py:2983:34-38: Cannot index into `SupportsDunderGT[Any]` [bad-index]
+ ERROR ddtrace/vendor/ply/yacc.py:2983:34-38: Cannot index into `SupportsDunderLT[Any]` [bad-index]
+ ERROR ddtrace/vendor/ply/yacc.py:3158:13-36: Type `SupportsDunderGT[Any]` is not iterable [not-iterable]
+ ERROR ddtrace/vendor/ply/yacc.py:3158:13-36: Type `SupportsDunderLT[Any]` is not iterable [not-iterable]
+ ERROR scripts/validate_wheel.py:68:28-49: No matching overload found for function `sorted` called with arguments: (set[object]) [no-matching-overload]
- ERROR scripts/validate_wheel.py:74:28-48: No matching overload found for function `sorted` called with arguments: (set[Unknown | None]) [no-matching-overload]
+ ERROR scripts/validate_wheel.py:74:28-48: No matching overload found for function `sorted` called with arguments: (set[object]) [no-matching-overload]
- ERROR scripts/validate_wheel.py:84:36-45: Argument `Unknown | None` is not assignable to parameter `name` with type `ZipInfo | str` in function `zipfile.ZipFile.read` [bad-argument-type]
+ ERROR scripts/validate_wheel.py:84:36-45: Argument `object` is not assignable to parameter `name` with type `ZipInfo | str` in function `zipfile.ZipFile.read` [bad-argument-type]
+ ERROR tests/appsec/iast/fixtures/taint_sinks/path_traversal.py:17:32-77: No matching overload found for function `genericpath.commonprefix` called with arguments: (tuple[bytes | str, str]) [no-matching-overload]
+ ERROR tests/commands/test_runner.py:35:40-53: No matching overload found for function `str.join` called with arguments: (list[bytes | str]) [no-matching-overload]
+ ERROR tests/conftest.py:684:54-57: Argument `object` is not assignable to parameter `req` with type `dict[str, Any]` in function `TelemetryTestSession._get_request_bodies` [bad-argument-type]
+ ERROR tests/conftest.py:737:28-37: Cannot index into `SupportsDunderGT[Any]` [bad-index]
+ ERROR tests/conftest.py:737:28-37: Cannot index into `SupportsDunderLT[Any]` [bad-index]
+ ERROR tests/conftest.py:742:17-22: Object of class `SupportsDunderGT` has no attribute `pop`
+ Object of class `SupportsDunderLT` has no attribute `pop` [missing-attribute]
+ ERROR tests/llmobs/test_experiments.py:500:16-31: Cannot index into `object` [bad-index]
+ ERROR tests/llmobs/test_experiments.py:501:16-36: Cannot index into `object` [bad-index]
+ ERROR tests/llmobs/test_experiments.py:691:12-32: Cannot index into `object` [bad-index]
+ ERROR tests/llmobs/test_experiments.py:692:12-37: Cannot index into `object` [bad-index]
+ ERROR tests/llmobs/test_experiments.py:693:12-30: Cannot index into `object` [bad-index]
+ ERROR tests/llmobs/test_experiments.py:695:12-32: Cannot index into `object` [bad-index]
+ ERROR tests/llmobs/test_experiments.py:696:12-37: Cannot index into `object` [bad-index]
+ ERROR tests/llmobs/test_experiments.py:697:12-30: Cannot index into `object` [bad-index]
+ ERROR tests/llmobs/test_experiments.py:1198:12-32: Cannot index into `object` [bad-index]
+ ERROR tests/llmobs/test_experiments.py:1199:12-37: Cannot index into `object` [bad-index]
+ ERROR tests/llmobs/test_experiments.py:1200:12-32: Cannot index into `object` [bad-index]
+ ERROR tests/llmobs/test_experiments.py:1201:12-37: Cannot index into `object` [bad-index]
+ ERROR tests/telemetry/test_telemetry.py:373:12-38: Cannot index into `object` [bad-index]
+ ERROR tests/telemetry/test_telemetry.py:374:12-39: Cannot index into `object` [bad-index]
+ ERROR tests/telemetry/test_telemetry.py:376:12-38: Cannot index into `object` [bad-index]
+ ERROR tests/telemetry/test_telemetry.py:377:12-39: Cannot index into `object` [bad-index]
+ ERROR tests/telemetry/test_telemetry.py:379:12-38: Cannot index into `object` [bad-index]
+ ERROR tests/telemetry/test_telemetry.py:380:12-39: Cannot index into `object` [bad-index]
+ ERROR tests/telemetry/test_telemetry.py:382:12-38: Cannot index into `object` [bad-index]
+ ERROR tests/telemetry/test_telemetry.py:383:12-39: Cannot index into `object` [bad-index]
+ ERROR tests/telemetry/test_writer.py:1170:12-38: Cannot index into `object` [bad-index]
+ ERROR tests/telemetry/test_writer.py:1171:12-39: Cannot index into `object` [bad-index]
+ ERROR tests/telemetry/test_writer.py:1172:12-39: Cannot index into `object` [bad-index]

... (truncated 1940 lines) ...```

@samwgoldman
Copy link
Member

samwgoldman commented Jan 5, 2026

Thanks for investigating! This is a clever idea, but I think solving the variable to its bound is a bit problematic. It looks like the new errors in mypy primer arise from this as well.

I know our current behavior of solving a type variable to the "first" concrete type it sees in constraints leads to issues like this. I took a moment to analyze this example against our currently planned design for improving type variable solving. First, let's simplify the example a little bit:

from collections.abc import Callable

def f[T: int](g: Callable[[T], T]):
    pass

def g(x: int|str) -> int:
    return 0

f(g)

Here, we are passing a callable type int|str -> int into a position expecting T -> T, and we want to solve for T.

* create fresh X <: int, substitute to get `f' : X -> None`
* int|str -> None <: X -> None  [call f'(g)]
   * X <: int | str             [func arg contravariant]
      * X = int | str           [eager variable solution *]
   * int <: X                   [func return covariant]
      * int <: int|str          [X=int|str]
* int|str <: int                [check solution against bound **]

Things go "wrong" when we eagerly solve for X (*) and we realize later when we go check against the bound (**).

Notice that we see both X <: int|str and int <: X when checking the call. If we considered both of these constraints together, we would see that the better, more precise solution for T is int. In general, solving a type variable to an upper bound when a lower bound exists will be imprecise -- this is also why solving to the typevar bound, an upper bound, leads to errors.

Delaying the solution, solving #105, seems like the best solution to this problem as well.

@rchen152
Copy link
Contributor

rchen152 commented Jan 8, 2026

I'm going to close this PR, since it sounds like we should work on a more general solution for #105 instead.

@rchen152 rchen152 closed this Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False positive bad-specialization

3 participants