Skip to content

[ty] Fix intersection <-> Protocol type relations#24830

Draft
AlexWaygood wants to merge 5 commits into
mainfrom
alex/proto-intersection-3
Draft

[ty] Fix intersection <-> Protocol type relations#24830
AlexWaygood wants to merge 5 commits into
mainfrom
alex/proto-intersection-3

Conversation

@AlexWaygood

@AlexWaygood AlexWaygood commented Apr 25, 2026

Copy link
Copy Markdown
Member

Summary

Fixes astral-sh/ty#3612

Test Plan

mdtests updated and extended

@AlexWaygood AlexWaygood added the ty Multi-file analysis & type inference label Apr 25, 2026
@AlexWaygood AlexWaygood force-pushed the alex/proto-intersection-3 branch from b4dbafc to 2853ea3 Compare April 25, 2026 14:13
@astral-sh-bot

astral-sh-bot Bot commented Apr 25, 2026

Copy link
Copy Markdown

Typing conformance results

No changes detected ✅

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

@astral-sh-bot

astral-sh-bot Bot commented Apr 25, 2026

Copy link
Copy Markdown

Memory usage report

Summary

Project Old New Diff Outcome
prefect 700.59MB 700.96MB +0.05% (381.29kB)
sphinx 258.30MB 258.41MB +0.04% (115.34kB)
trio 116.36MB 116.38MB +0.02% (23.78kB)
flake8 47.59MB 47.61MB +0.04% (17.50kB)

Significant changes

Click to expand detailed breakdown

prefect

Name Old New Diff Outcome
infer_expression_types_impl 63.64MB 63.71MB +0.11% (74.02kB)
infer_definition_types 89.13MB 89.18MB +0.06% (55.08kB)
infer_expression_type_impl 13.58MB 13.62MB +0.28% (38.77kB)
Type<'db>::member_lookup_with_policy_ 17.29MB 17.33MB +0.22% (38.18kB)
Type<'db>::member_lookup_with_policy_::interned_arguments 5.96MB 6.00MB +0.60% (36.36kB)
Type<'db>::apply_specialization_ 3.71MB 3.73MB +0.73% (27.75kB)
infer_deferred_types 11.09MB 11.11MB +0.19% (21.87kB)
StaticClassLiteral<'db>::implicit_attribute_inner_ 10.09MB 10.10MB +0.16% (16.37kB)
all_narrowing_constraints_for_expression 7.38MB 7.39MB +0.19% (14.50kB)
infer_scope_types_impl 55.41MB 55.42MB +0.02% (13.45kB)
all_negative_narrowing_constraints_for_expression 2.69MB 2.70MB +0.33% (9.13kB)
Type<'db>::class_member_with_policy_ 17.70MB 17.70MB +0.04% (7.73kB)
BoundMethodType<'db>::into_callable_type_ 322.31kB 328.80kB +2.01% (6.49kB)
GenericAlias<'db>::variance_of_ 584.20kB 589.86kB +0.97% (5.66kB)
is_redundant_with_impl 2.01MB 2.01MB +0.18% (3.73kB)
... 37 more

sphinx

Name Old New Diff Outcome
Type<'db>::member_lookup_with_policy_ 6.84MB 6.86MB +0.33% (23.07kB)
Type<'db>::member_lookup_with_policy_::interned_arguments 2.67MB 2.69MB +0.81% (22.24kB)
Type<'db>::apply_specialization_ 1.63MB 1.64MB +0.61% (10.11kB)
infer_expression_types_impl 20.81MB 20.82MB +0.04% (9.47kB)
infer_deferred_types 5.27MB 5.28MB +0.17% (9.33kB)
Type<'db>::class_member_with_policy_ 7.62MB 7.62MB +0.09% (7.22kB)
BoundMethodType<'db>::into_callable_type_ 277.71kB 284.82kB +2.56% (7.11kB)
infer_definition_types 23.49MB 23.49MB +0.03% (6.33kB)
Type<'db>::class_member_with_policy_::interned_arguments 4.02MB 4.03MB +0.10% (4.06kB)
Type<'db>::try_call_dunder_get_ 4.86MB 4.87MB +0.05% (2.52kB)
infer_scope_types_impl 15.45MB 15.46MB +0.02% (2.41kB)
code_generator_of_static_class 741.41kB 742.65kB +0.17% (1.24kB)
is_redundant_with_impl::interned_arguments 1.08MB 1.07MB -0.10% (1.12kB)
StaticClassLiteral<'db>::implicit_attribute_inner_ 2.36MB 2.36MB +0.04% (1.04kB)
enum_metadata 705.66kB 706.65kB +0.14% (1016.00B)
... 34 more

trio

Name Old New Diff Outcome
Type<'db>::member_lookup_with_policy_::interned_arguments 922.09kB 927.98kB +0.64% (5.89kB)
Type<'db>::apply_specialization_ 709.38kB 714.67kB +0.75% (5.29kB)
Type<'db>::member_lookup_with_policy_ 1.94MB 1.95MB +0.24% (4.77kB)
infer_deferred_types 2.33MB 2.34MB +0.18% (4.25kB)
infer_definition_types 7.53MB 7.53MB +0.02% (1.61kB)
Type<'db>::class_member_with_policy_ 2.04MB 2.04MB -0.03% (652.00B)
infer_expression_types_impl 7.00MB 7.00MB +0.01% (624.00B)
BoundMethodType<'db>::into_callable_type_ 74.23kB 74.78kB +0.74% (564.00B)
is_redundant_with_impl 248.21kB 248.62kB +0.17% (420.00B)
infer_expression_type_impl 1.31MB 1.31MB +0.02% (320.00B)
CallableType 579.96kB 580.24kB +0.05% (288.00B)
ClassType<'db>::into_callable_ 7.78kB 8.06kB +3.61% (288.00B)
infer_scope_types_impl 4.71MB 4.71MB +0.01% (264.00B)
StaticClassLiteral<'db>::implicit_attribute_inner_ 743.30kB 743.19kB -0.01% (112.00B)
Type<'db>::class_member_with_policy_::interned_arguments 1.12MB 1.12MB -0.01% (104.00B)
... 6 more

flake8

Name Old New Diff Outcome
Type<'db>::member_lookup_with_policy_ 551.79kB 555.39kB +0.65% (3.60kB)
Type<'db>::member_lookup_with_policy_::interned_arguments 230.55kB 234.00kB +1.50% (3.45kB)
Type<'db>::class_member_with_policy_ 572.44kB 573.96kB +0.27% (1.52kB)
Type<'db>::apply_specialization_ 208.90kB 210.28kB +0.66% (1.38kB)
enum_metadata 65.21kB 66.20kB +1.52% (1016.00B)
StaticClassLiteral<'db>::implicit_attribute_inner_ 309.72kB 310.59kB +0.28% (896.00B)
code_generator_of_static_class 87.94kB 88.75kB +0.92% (824.00B)
StaticClassLiteral<'db>::implicit_attribute_inner_::interned_arguments 255.66kB 256.41kB +0.29% (768.00B)
infer_deferred_types 563.80kB 564.45kB +0.12% (672.00B)
Type<'db>::class_member_with_policy_::interned_arguments 311.19kB 311.80kB +0.20% (624.00B)
infer_definition_types 1.81MB 1.81MB +0.03% (492.00B)
StaticClassLiteral<'db>::try_metaclass_ 53.77kB 54.22kB +0.84% (464.00B)
StaticClassLiteral<'db>::try_mro_ 305.97kB 306.39kB +0.14% (424.00B)
BoundMethodType<'db>::into_callable_type_ 27.19kB 27.52kB +1.21% (336.00B)
code_generator_of_static_class::interned_arguments 30.30kB 30.59kB +0.93% (288.00B)
... 8 more

@astral-sh-bot

astral-sh-bot Bot commented Apr 25, 2026

Copy link
Copy Markdown

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-argument-type 19 0 4
unsupported-operator 8 0 1
unresolved-attribute 4 0 3
unused-type-ignore-comment 0 4 0
call-top-callable 2 0 0
invalid-assignment 1 0 1
invalid-return-type 2 0 0
Total 36 4 9
Raw diff (49 changes)
altair (https://github.com/vega/altair)
- altair/utils/data.py:209:28 error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `(NativeDataFrame & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (narwhals.stable.v1.typing.DataFrameLike & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (Unknown & ~None & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (altair.utils.core.DataFrameLike & ~DataFrame & ~Top[dict[Unknown, Unknown]])`
+ altair/utils/data.py:209:28 error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `(NativeDataFrame & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (narwhals.stable.v1.typing.DataFrameLike & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (altair.utils.core.DataFrameLike & ~DataFrame & ~Top[dict[Unknown, Unknown]])`
- altair/utils/data.py:210:39 error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `(NativeDataFrame & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (narwhals.stable.v1.typing.DataFrameLike & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (Unknown & ~None & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (altair.utils.core.DataFrameLike & ~DataFrame & ~Top[dict[Unknown, Unknown]])`
+ altair/utils/data.py:210:39 error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `(NativeDataFrame & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (narwhals.stable.v1.typing.DataFrameLike & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (altair.utils.core.DataFrameLike & ~DataFrame & ~Top[dict[Unknown, Unknown]])`
- altair/utils/data.py:416:12 error[unresolved-attribute] Attribute `write_csv` is not defined on `NativeDataFrame & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]`, `DataFrameLike & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]`, `DataFrameLike & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]` in union `(NativeDataFrame & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (narwhals.stable.v1.typing.DataFrameLike & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (Unknown & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (altair.utils.core.DataFrameLike & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]])`
+ altair/utils/data.py:416:12 error[unresolved-attribute] Object of type `(NativeDataFrame & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (narwhals.stable.v1.typing.DataFrameLike & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (altair.utils.core.DataFrameLike & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]])` has no attribute `write_csv`

beartype (https://github.com/beartype/beartype)
- beartype/_util/func/utilfunctest.py:1262:16 error[unresolved-attribute] Attribute `__name__` is not defined on `(...) -> Unknown` in union `(Any & ~MethodType) | ((...) -> Unknown)`
+ beartype/_util/func/utilfunctest.py:1262:16 error[unresolved-attribute] Object of type `(...) -> Unknown` has no attribute `__name__`

discord.py (https://github.com/Rapptz/discord.py)
- discord/ext/commands/bot.py:1222:79 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ discord/ext/commands/cog.py:527:13 error[unresolved-attribute] Unresolved attribute `__cog_listener__` on type `(...) -> Coroutine[Any, Any, Any]`
+ discord/ext/commands/cog.py:528:33 error[unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, Any]` has no attribute `__name__`
+ discord/ext/commands/cog.py:530:17 error[unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, Any]` has no attribute `__cog_listener_names__`
+ discord/ext/commands/cog.py:532:17 error[unresolved-attribute] Unresolved attribute `__cog_listener_names__` on type `(...) -> Coroutine[Any, Any, Any]`

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

ibis (https://github.com/ibis-project/ibis)
- ibis/common/annotations.py:653:5 error[unresolved-attribute] Unresolved attribute `__signature__` on type `_Wrapped[(...), Unknown, (...), Unknown]`
+ ibis/common/annotations.py:653:5 error[unresolved-attribute] Unresolved attribute `__signature__` on type `_Wrapped[(...), object, (...), Unknown]`

jax (https://github.com/google/jax)
+ jax/_src/lax/slicing.py:3425:21 error[invalid-argument-type] Argument to bound method `list.append` is incorrect: Expected `Array | ndarray[tuple[Any, ...], dtype[Any]] | numpy.bool[builtins.bool] | ... omitted 4 union elements`, found `object`
+ jax/_src/lax/slicing.py:3452:21 error[invalid-argument-type] Argument to bound method `list.append` is incorrect: Expected `Array | ndarray[tuple[Any, ...], dtype[Any]] | numpy.bool[builtins.bool] | ... omitted 4 union elements`, found `~int & ~Top[integer[Any]]`
- jax/_src/lax/slicing.py:3450:32 error[unsupported-operator] Operator `<` is not supported between objects of type `(Array & ~int & ~Top[integer[Any]]) | (ndarray[tuple[Any, ...], dtype[Any]] & ~int & ~Top[integer[Any]]) | (numpy.bool[builtins.bool] & ~int & ~Top[integer[Any]]) | ... omitted 4 union elements` and `Literal[0]`
+ jax/_src/lax/slicing.py:3450:32 error[unsupported-operator] Operator `<` is not supported between objects of type `~int & ~Top[integer[Any]]` and `Literal[0]`
+ jax/_src/lax/slicing.py:3450:39 error[unsupported-operator] Operator `+` is not supported between objects of type `~int & ~Top[integer[Any]]` and `Array`
+ jax/_src/lax/slicing.py:3450:50 error[invalid-argument-type] Argument to function `select` is incorrect: Expected `Array | ndarray[tuple[Any, ...], dtype[Any]] | numpy.bool[builtins.bool] | ... omitted 4 union elements`, found `~int & ~Top[integer[Any]]`

psycopg (https://github.com/psycopg/psycopg)
+ psycopg_pool/psycopg_pool/pool_async.py:710:20 error[invalid-return-type] Return type does not match returned value: expected `str`, found `object`
+ psycopg_pool/psycopg_pool/pool_async.py:710:26 error[call-top-callable] Object of type `Overload[[**P, T](f: (**P) -> Awaitable[T], *args: P.args, **kwargs: P.kwargs) -> CoroutineType[Any, Any, T], [**P, T](f: (**P) -> T, *args: P.args, **kwargs: P.kwargs) -> CoroutineType[Any, Any, T]]` is not safe to call; its signature is not known
+ psycopg_pool/psycopg_pool/pool_async.py:720:20 error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `object`
+ psycopg_pool/psycopg_pool/pool_async.py:720:26 error[call-top-callable] Object of type `Overload[[**P, T](f: (**P) -> Awaitable[T], *args: P.args, **kwargs: P.kwargs) -> CoroutineType[Any, Any, T], [**P, T](f: (**P) -> T, *args: P.args, **kwargs: P.kwargs) -> CoroutineType[Any, Any, T]]` is not safe to call; its signature is not known

pydantic (https://github.com/pydantic/pydantic)
+ pydantic/deprecated/decorator.py:65:25 error[invalid-argument-type] Argument to function `validate` is incorrect: Expected `(...) -> Any`, found `AnyCallableT@validate_arguments & ~AlwaysFalsy`
+ pydantic/v1/decorator.py:49:25 error[invalid-argument-type] Argument to function `validate` is incorrect: Expected `(...) -> Any`, found `AnyCallableT@validate_arguments & ~AlwaysFalsy`

scipy (https://github.com/scipy/scipy)
- scipy/sparse/_sputils.py:529:16 error[invalid-argument-type] Argument to `list.__init__` is incorrect: Expected `Iterable[Unknown]`, found `Sized`
+ scipy/sparse/_sputils.py:529:16 error[invalid-argument-type] Argument to `list.__init__` is incorrect: Expected `Iterable[Unknown]`, found `(Unknown & tuple[object, ...]) | (Unknown & Top[list[Unknown]]) | Sized`

scrapy (https://github.com/scrapy/scrapy)
+ tests/test_http_request.py:288:55 error[invalid-argument-type] Argument to `Request.__init__` is incorrect: Expected `((Unknown, /) -> Any) | None`, found `(def a_function() -> Unknown) & ((Response, /, *args: Any, **kwargs: Any) -> Any)`

spack (https://github.com/spack/spack)
+ lib/spack/spack/multimethod.py:97:38 error[invalid-argument-type] Argument to function `update_wrapper` is incorrect: Expected `(...) -> Unknown`, found `Self@register & ~<Protocol with members '__name__'>`
- lib/spack/spack/vendor/ruamel/yaml/representer.py:458:30 error[invalid-argument-type] Argument to `list.__init__` is incorrect: Expected `Iterable[Unknown]`, found `str | ((...) -> Any) | tuple[Any, ...] | (Any & ~None)`
+ lib/spack/spack/vendor/ruamel/yaml/representer.py:458:30 error[invalid-argument-type] Argument to `list.__init__` is incorrect: Expected `Iterable[Unknown]`, found `str | ((...) -> Any) | tuple[Any, ...]`

streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/elements/dialog_decorator.py:314:9 error[invalid-argument-type] Argument to function `_dialog_decorator` is incorrect: Argument type `F@dialog_decorator & ~str` does not satisfy upper bound `(...) -> Any` of type variable `F`

sympy (https://github.com/sympy/sympy)
+ sympy/polys/series/ringpython.py:189:37 error[invalid-argument-type] Argument to function `dup_add_ground` is incorrect: Argument type `Er@_useries_add_ground & ~Literal[0]` does not satisfy upper bound `RingElement` of type variable `Er`
+ sympy/polys/series/ringpython.py:216:37 error[invalid-argument-type] Argument to function `dup_sub_ground` is incorrect: Argument type `Er@_useries_sub_ground & ~Literal[0]` does not satisfy upper bound `RingElement` of type variable `Er`
+ sympy/polys/series/ringpython.py:234:41 error[invalid-argument-type] Argument to function `dup_add_ground` is incorrect: Argument type `Er@_useries_rsub_ground & ~Literal[0]` does not satisfy upper bound `RingElement` of type variable `Er`
+ sympy/polys/series/ringpython.py:266:37 error[invalid-argument-type] Argument to function `dup_mul_ground` is incorrect: Argument type `Er@_useries_mul_ground & ~Literal[0] & ~Literal[1] & ~Literal[-1]` does not satisfy upper bound `RingElement` of type variable `Er`
+ sympy/polys/series/ringpython.py:343:50 error[invalid-argument-type] Argument to function `_useries_mul_ground` is incorrect: Argument type `Ef@_useries_sqrt & ~AlwaysFalsy` does not satisfy upper bound `RingElement` of type variable `Er`
+ sympy/polys/series/ringpython.py:348:47 error[invalid-argument-type] Argument to function `_useries_mul_ground` is incorrect: Argument type `Ef@_useries_sqrt & ~AlwaysFalsy` does not satisfy upper bound `RingElement` of type variable `Er`
+ sympy/polys/densetools.py:296:9 error[unsupported-operator] Operator `*=` is not supported between objects of type `Er@dup_eval` and `Er@dup_eval & ~AlwaysFalsy`
+ sympy/polys/densetools.py:325:41 error[invalid-argument-type] Argument to function `dmp_mul_ground` is incorrect: Argument type `Er@dmp_eval & ~AlwaysFalsy` does not satisfy upper bound `RingElement` of type variable `Er`
+ sympy/polys/densetools.py:956:44 error[invalid-argument-type] Argument to function `dmp_mul_ground` is incorrect: Argument type `Er@dmp_shift & ~AlwaysFalsy` does not satisfy upper bound `RingElement` of type variable `Er`
- sympy/polys/domains/domain.py:590:51 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- sympy/polys/domains/domain.py:599:55 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ sympy/polys/domains/domain.py:618:38 error[invalid-argument-type] Argument to bound method `Domain.convert_from` is incorrect: Argument type `(Es@convert & DomainElement & ~Er@Domain & ~MPZ & ~int & ~float & ~complex) | (Expr & DomainElement & ~Er@Domain & ~MPZ)` does not satisfy upper bound `RingElement` of type variable `Es`
+ sympy/polys/rings.py:2201:13 error[unsupported-operator] Operator `+` is not supported between objects of type `Er@PolyElement` and `Er@PolyElement & ~AlwaysFalsy`
+ sympy/polys/rings.py:2226:13 error[unsupported-operator] Operator `-` is not supported between objects of type `Er@PolyElement` and `Er@PolyElement & ~AlwaysFalsy`
+ sympy/polys/rings.py:2251:26 error[unsupported-operator] Operator `*` is not supported between objects of type `Er@PolyElement` and `Er@PolyElement & ~AlwaysFalsy`
+ sympy/polys/rings.py:2550:13 error[unsupported-operator] Operator `*=` is not supported between objects of type `Er@PolyElement` and `(Er@PolyElement & ~AlwaysFalsy) | (int & ~AlwaysFalsy)`
+ sympy/polys/rings.py:3049:44 error[unsupported-operator] Operator `*` is not supported between objects of type `Er@PolyElement` and `Er@PolyElement & ~AlwaysFalsy`
+ sympy/polys/rings.py:3493:21 error[unsupported-operator] Operator `+=` is not supported between objects of type `Er@PolyElement` and `Er@PolyElement & ~AlwaysFalsy`

xarray (https://github.com/pydata/xarray)
- xarray/core/common.py:1702:22 error[invalid-assignment] Object of type `(type[Any] & Top[Mapping[Unknown, object]]) | (str & Top[Mapping[Unknown, object]]) | (tuple[Any, SupportsIndex | Sequence[SupportsIndex]] & Top[Mapping[Unknown, object]]) | ... omitted 5 union elements` is not assignable to `Mapping[Any, dtype[Any] | None | type[Any] | ... omitted 6 union elements]`
+ xarray/core/common.py:1702:22 error[invalid-assignment] Object of type `(_HasDType[dtype[Any]] & Top[Mapping[Unknown, object]]) | (str & Top[Mapping[Unknown, object]]) | (tuple[Any, SupportsIndex | Sequence[SupportsIndex]] & Top[Mapping[Unknown, object]]) | ... omitted 4 union elements` is not assignable to `Mapping[Any, dtype[Any] | None | type[Any] | ... omitted 6 union elements]`
+ xarray/namedarray/core.py:203:33 error[invalid-argument-type] Argument to `NamedArray.__init__` is incorrect: Expected `_arrayfunction[Any, Unknown] | _arrayapi[Any, Unknown]`, found `(_SupportsArray[dtype[Any]] & MaskedArray[tuple[object, ...], dtype[object]] & ~NamedArray[object, object]) | (_arrayapi[_ShapeType@from_array, _DType@from_array] & MaskedArray[tuple[object, ...], dtype[object]] & ~NamedArray[object, object]) | (_Buffer & MaskedArray[tuple[object, ...], dtype[object]] & ~NamedArray[object, object]) | ... omitted 6 union elements`
+ xarray/namedarray/core.py:206:33 error[invalid-argument-type] Argument to `NamedArray.__init__` is incorrect: Expected `_arrayfunction[Any, Unknown] | _arrayapi[Any, Unknown]`, found `(_SupportsArray[dtype[Any]] & _arrayfunction[object, object] & ~NamedArray[object, object] & ~MaskedArray[tuple[object, ...], dtype[object]] & ~generic[object]) | (_arrayapi[_ShapeType@from_array, _DType@from_array] & ~NamedArray[object, object] & ~MaskedArray[tuple[object, ...], dtype[object]] & ~generic[object]) | (_Buffer & _arrayfunction[object, object] & ~NamedArray[object, object] & ~MaskedArray[tuple[object, ...], dtype[object]] & ~generic[object]) | ... omitted 9 union elements`
+ xarray/namedarray/core.py:836:25 error[invalid-assignment] Object of type `(_arrayfunction[Any, _DType_co@NamedArray] & ~ExplicitlyIndexed) | (_arrayapi[Any, _DType_co@NamedArray] & ~ExplicitlyIndexed)` is not assignable to `_arrayfunction[Any, Any] | _arrayapi[Any, Any]`

Full report with detailed diff (timing results)

@codspeed-hq

codspeed-hq Bot commented Apr 25, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 5.88%

❌ 1 regressed benchmark
✅ 52 untouched benchmarks
⏩ 60 skipped benchmarks1

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

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime colour_science 50.9 s 54.1 s -5.88%

Comparing alex/proto-intersection-3 (2544414) with main (1d287fa)

Open in CodSpeed

Footnotes

  1. 60 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broken type relations between intersections and protocols

1 participant