Skip to content

Comments

[ty] Refactor handling of special forms#23513

Closed
AlexWaygood wants to merge 9 commits intomainfrom
claude/merge-fix-compile-errors-BPawF
Closed

[ty] Refactor handling of special forms#23513
AlexWaygood wants to merge 9 commits intomainfrom
claude/merge-fix-compile-errors-BPawF

Conversation

@AlexWaygood
Copy link
Member

Summary

Our SpecialFormType enum is an enumeration of symbols (mostly in the typing module) that are special enough that we consider each symbol to inhabit its own singleton type. That makes them "similar enough" that they all deserve to inhabit the same Type::SpecialForm top-level variant, but it elides the fact that there are several distinct subcategories within this enumeration that need to be recognised at multiple distinct points throughout the codebase. The flat nature of the SpecialFormType enum often makes it hard to distinguish between these subcategories in a type-safe way; we often have to resort to .expect() or unreachable!() calls, e.g.

let class = special_form
.aliased_stdlib_class()
.expect("A known stdlib class is available");

let class = special_form
.aliased_stdlib_class()
.expect("Stdlib class available");

It also leads to pretty repetitive code: we have to differentiate stdlib aliases from other kinds of special forms in narrow.rs, infer/builder.rs and infer/builder/type_expression.rs, in very similar ways.

This PR adds a SpecialFormType::kind() method, which returns a more fine-grained SpecialFormCategory enumeration of subcategories of special forms. This results in a net increase of total lines of code, but it's more type-safe code (all three .expect()/unreachable!() calls highlighted above are gone), and much less repetitive code.

Test Plan

Existing tests

AlexWaygood and others added 9 commits November 8, 2025 20:00
… use invalid PEP-604 unions for their second argument
Merge the latest main branch into the alex/refactor-special-forms branch
and resolve all resulting compile errors. Key changes:

- Resolved merge conflicts across 8 files in ty_python_semantic
- Updated MiscSpecialForm::in_type_expression to use Type::literal_string()
  instead of removed Type::LiteralString variant
- Updated typing_self call to match new signature (ClassLiteral param,
  returns Option<BoundTypeVarInstance>)
- Changed TypeAlias handling from DynamicType::TodoTypeAlias to proper
  InvalidTypeExpressionError
- Re-added aliased_stdlib_class() method derived from SpecialFormCategory
- Added add_qualifier() method and pub(crate) qualifiers field to
  TypeAndQualifiers for main's annotation_expression.rs changes
- Integrated main's TypeGuard support, Callable refactoring,
  isinstance/issubclass improvements, and ClassVar/Final redundancy detection
- Removed PartialSpecialization import (no longer exists)
- Added Hash and GetSize derives to TypeQualifier enum

https://claude.ai/code/session_01HXMzTUkfPVJCxdxTzZdePf
Refactor match arms on SpecialFormType variants to use exhaustive matches
over SpecialFormCategory where possible:

- In annotation_expression.rs, replace .as_type_qualifier().expect(...)
  with inner exhaustive matches on special_form.kind(), eliminating two
  .expect() calls and merging separate SpecialForm match arms.
- Convert is_valid_in_type_expression and is_valid_isinstance_target from
  matches!/!matches! to exhaustive match expressions, so the compiler
  enforces updates when new SpecialFormCategory variants are added.
- Remove the now-unused as_type_qualifier method.

https://claude.ai/code/session_01HXMzTUkfPVJCxdxTzZdePf
@AlexWaygood AlexWaygood added internal An internal refactor or improvement ty Multi-file analysis & type inference labels Feb 23, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 23, 2026

Typing conformance results

No changes detected ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 23, 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`

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

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

pydantic (https://github.com/pydantic/pydantic)
- pydantic/_internal/_core_metadata.py:87:54: error[invalid-assignment] Invalid assignment to key "pydantic_js_extra" with declared type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | ((dict[str, Divergent], type[Any], /) -> None)` on TypedDict `CoreMetadata`: value of type `dict[object, object]`
+ pydantic/_internal/_core_metadata.py:87:54: error[invalid-assignment] Invalid assignment to key "pydantic_js_extra" with declared type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | ((dict[str, int | float | str | ... omitted 3 union elements], type[Any], /) -> None)` on TypedDict `CoreMetadata`: value of type `dict[object, object]`
- pydantic/fields.py:949:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
+ pydantic/fields.py:949:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
- pydantic/fields.py:989:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
+ pydantic/fields.py:989:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
- pydantic/fields.py:1032:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
+ pydantic/fields.py:1032:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
- pydantic/fields.py:1072:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
+ pydantic/fields.py:1072:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
- pydantic/fields.py:1115:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
+ pydantic/fields.py:1115:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
- pydantic/fields.py:1154:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
+ pydantic/fields.py:1154:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
- pydantic/fields.py:1194:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
+ pydantic/fields.py:1194:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
- pydantic/fields.py:1573:13: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`, found `Top[dict[Unknown, Unknown]] | (((dict[str, Divergent], /) -> None) & ~Top[dict[Unknown, Unknown]]) | None`
+ pydantic/fields.py:1573:13: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`, found `Top[dict[Unknown, Unknown]] | (((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) & ~Top[dict[Unknown, Unknown]]) | None`

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

meson (https://github.com/mesonbuild/meson)
- mesonbuild/dependencies/cuda.py:137:76: error[invalid-argument-type] Argument to function `version_compare_many` is incorrect: Expected `str`, found `str | None | Unknown`
+ mesonbuild/dependencies/cuda.py:137:76: error[invalid-argument-type] Argument to function `version_compare_many` is incorrect: Expected `str`, found `Unknown | str | None`

dd-trace-py (https://github.com/DataDog/dd-trace-py)
- scripts/freshvenvs.py:343:69: error[invalid-argument-type] Argument to function `_versions_fully_cover_bounds` is incorrect: Expected `list[str]`, found `list[Unknown | Version] & ~AlwaysFalsy`
+ scripts/freshvenvs.py:343:69: error[invalid-argument-type] Argument to function `_versions_fully_cover_bounds` is incorrect: Expected `list[str]`, found `list[Version | Unknown] & ~AlwaysFalsy`
- tests/tracer/test_span.py:193:29: error[invalid-argument-type] Argument to bound method `set_metric` is incorrect: Expected `int | float`, found `int | float | complex | ... omitted 6 union elements`
+ tests/tracer/test_span.py:193:29: error[invalid-argument-type] Argument to bound method `set_metric` is incorrect: Expected `int | float`, found `int | Unknown | None | ... omitted 6 union elements`

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

scikit-learn (https://github.com/scikit-learn/scikit-learn)
- sklearn/datasets/_lfw.py:469:60: error[invalid-argument-type] Argument to class `str` is incorrect: Expected `bytes | bytearray`, found `str | Unknown`
+ sklearn/datasets/_lfw.py:469:60: error[invalid-argument-type] Argument to class `str` is incorrect: Expected `bytes | bytearray`, found `Unknown | str`

materialize (https://github.com/MaterializeInc/materialize)
- misc/python/materialize/cli/mz_workload_anonymize.py:251:13: error[no-matching-overload] No overload of bound method `join` matches arguments
- Found 526 diagnostics
+ Found 525 diagnostics

pandas (https://github.com/pandas-dev/pandas)
- pandas/core/methods/describe.py:215:21: error[not-iterable] Object of type `Unknown | Sized` may not be iterable
+ pandas/core/methods/describe.py:215:21: error[not-iterable] Object of type `Sized | Unknown` may not be iterable

sympy (https://github.com/sympy/sympy)
+ sympy/algebras/tests/test_quaternion.py:75:10: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/algebras/tests/test_quaternion.py:75:10: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
- sympy/algebras/tests/test_quaternion.py:422:33: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/codegen/tests/test_matrix_nodes.py:27:21: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/geometry/point.py:1295:25: error[unresolved-attribute] Attribute `tolist` is not defined on `Expr` in union `MatrixBase | Expr`
+ sympy/geometry/point.py:1295:25: error[unresolved-attribute] Attribute `tolist` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/integrals/tests/test_heurisch.py:390:26: error[not-subscriptable] Cannot subscript object of type `Expr` with no `__getitem__` method
+ sympy/integrals/tests/test_heurisch.py:389:17: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/decompositions.py:1321:16: error[unresolved-attribute] Attribute `diagonalize` is not defined on `Expr` in union `MatrixBase | Expr`
- sympy/matrices/decompositions.py:1336:16: error[unresolved-attribute] Attribute `diagonalize` is not defined on `Expr` in union `MatrixBase | Expr`
+ sympy/matrices/decompositions.py:1321:16: error[unresolved-attribute] Attribute `diagonalize` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/decompositions.py:1334:13: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MatrixBase`
+ sympy/matrices/decompositions.py:1336:16: error[unresolved-attribute] Attribute `diagonalize` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/decompositions.py:1348:13: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MatrixBase`
- sympy/matrices/decompositions.py:1350:12: error[invalid-return-type] Return type does not match returned value: expected `tuple[Tmat@_singular_value_decomposition, Tmat@_singular_value_decomposition, Tmat@_singular_value_decomposition]`, found `tuple[MatrixBase | Expr | Unknown, MatrixBase, MatrixBase | Expr | Unknown]`
+ sympy/matrices/decompositions.py:1350:12: error[invalid-return-type] Return type does not match returned value: expected `tuple[Tmat@_singular_value_decomposition, Tmat@_singular_value_decomposition, Tmat@_singular_value_decomposition]`, found `tuple[Unknown | MatrixBase, MatrixBase, MatrixBase | Unknown]`
- sympy/matrices/eigen.py:1202:37: error[unresolved-attribute] Object of type `T2'return@call_highest_priority | T1'return@call_highest_priority` has no attribute `pow`
- sympy/matrices/expressions/hadamard.py:81:22: error[invalid-argument-type] Argument to function `validate_matadd_integer` is incorrect: Expected `MatrixExpr`, found `Any | Basic | int | float | complex`
+ sympy/matrices/expressions/hadamard.py:81:22: error[invalid-argument-type] Argument to function `validate_matadd_integer` is incorrect: Expected `MatrixExpr`, found `int | Any | Basic | float | complex`
- sympy/matrices/expressions/kronecker.py:109:16: error[unresolved-attribute] Attribute `is_Identity` is not defined on `Basic`, `int`, `float`, `complex` in union `Any | Basic | int | float | complex`
+ sympy/matrices/expressions/kronecker.py:109:16: error[unresolved-attribute] Attribute `is_Identity` is not defined on `int`, `Basic`, `float`, `complex` in union `int | Any | Basic | float | complex`
- sympy/matrices/expressions/kronecker.py:110:33: error[unresolved-attribute] Attribute `rows` is not defined on `Basic`, `int`, `float`, `complex` in union `Any | Basic | int | float | complex`
+ sympy/matrices/expressions/kronecker.py:110:33: error[unresolved-attribute] Attribute `rows` is not defined on `int`, `Basic`, `float`, `complex` in union `int | Any | Basic | float | complex`
- sympy/matrices/expressions/matadd.py:60:22: error[invalid-argument-type] Argument to function `validate_matadd_integer` is incorrect: Expected `MatrixExpr`, found `Unknown | Basic | int | float | complex`
+ sympy/matrices/expressions/matadd.py:60:22: error[invalid-argument-type] Argument to function `validate_matadd_integer` is incorrect: Expected `MatrixExpr`, found `Unknown | int | Basic | float | complex`
- sympy/matrices/expressions/tests/test_blockmatrix.py:235:13: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/expressions/tests/test_blockmatrix.py:235:33: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/expressions/tests/test_blockmatrix.py:235:53: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/expressions/tests/test_blockmatrix.py:459:12: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/expressions/tests/test_derivatives.py:551:26: error[unsupported-operator] Operator `+` is not supported between two objects of type `MatrixBase | Expr`
+ sympy/matrices/expressions/tests/test_derivatives.py:551:26: error[unsupported-operator] Operator `+` is not supported between two objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/expressions/tests/test_matadd.py:36:12: error[unsupported-operator] Operator `+` is not supported between objects of type `MatrixBase` and `MatrixBase | Expr`
- sympy/matrices/expressions/tests/test_matmul.py:158:68: error[unresolved-attribute] Attribute `as_explicit` is not defined on `Expr` in union `MatrixBase | Expr`
+ sympy/matrices/expressions/tests/test_matmul.py:158:68: error[unresolved-attribute] Attribute `as_explicit` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/expressions/tests/test_matpow.py:124:47: error[unsupported-operator] Operator `+` is not supported between two objects of type `ImmutableDenseMatrix`
+ sympy/matrices/expressions/tests/test_matpow.py:123:46: error[unsupported-operator] Operator `**` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `Literal[2]`
- sympy/matrices/expressions/tests/test_permutation.py:27:12: error[unresolved-attribute] Attribute `as_explicit` is not defined on `Expr` in union `MatrixBase | Expr`
+ sympy/matrices/expressions/tests/test_permutation.py:27:12: error[unresolved-attribute] Attribute `as_explicit` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/inverse.py:385:11: error[unsupported-operator] Operator `-` is not supported between objects of type `MatrixBase` and `MatrixBase | Expr | Unknown`
+ sympy/matrices/inverse.py:384:11: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MatrixBase`
+ sympy/matrices/inverse.py:392:11: error[unsupported-operator] Unary operator `-` is not supported for object of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/inverse.py:393:11: error[unsupported-operator] Operator `+` is not supported between objects of type `MatrixBase` and `MatrixBase | Expr | Unknown`
+ sympy/matrices/inverse.py:393:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MatrixBase | Expr`
+ sympy/matrices/inverse.py:393:22: error[unsupported-operator] Unary operator `-` is not supported for object of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/matrixbase.py:979:18: error[unsupported-operator] Operator `+` is not supported between two objects of type `Self@_eval_wilkinson`
- sympy/matrices/matrixbase.py:2957:16: error[invalid-return-type] Return type does not match returned value: expected `Self@_eval_pow_by_cayley`, found `Self@_eval_pow_by_cayley | T2'return@call_highest_priority | T1'return@call_highest_priority | Unknown`
+ sympy/matrices/matrixbase.py:2955:13: error[unsupported-operator] Operator `*=` is not supported between objects of type `T1'return@call_highest_priority` and `Self@_eval_pow_by_cayley`
+ sympy/matrices/matrixbase.py:2955:13: error[unsupported-operator] Operator `*=` is not supported between objects of type `T2'return@call_highest_priority` and `Self@_eval_pow_by_cayley`
- sympy/matrices/matrixbase.py:3046:5: error[invalid-argument-type] Argument is incorrect: Expected `(MatrixBase, MatrixBase | Expr, /) -> MatrixBase | Expr`, found `Overload[[Self](self, other: Self) -> Self, (self, other: MatrixBase) -> MatrixBase, (self, other: Expr) -> MatrixBase]`
+ sympy/matrices/matrixbase.py:3046:5: error[invalid-argument-type] Argument is incorrect: Expected `(T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr, T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr, /) -> T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`, found `Overload[[Self](self, other: Self) -> Self, (self, other: MatrixBase) -> MatrixBase, (self, other: Expr) -> MatrixBase]`
- sympy/matrices/matrixbase.py:3256:16: error[invalid-return-type] Return type does not match returned value: expected `MatrixBase`, found `T2'return@call_highest_priority | T1'return@call_highest_priority`
- sympy/matrices/matrixbase.py:3256:29: error[invalid-argument-type] Argument is incorrect: Expected `T2'return@call_highest_priority | T1'return@call_highest_priority`, found `MatrixBase`
- sympy/matrices/matrixbase.py:3310:16: error[unsupported-operator] Operator `+` is not supported between two objects of type `MatrixBase`
- sympy/matrices/matrixbase.py:3314:16: error[invalid-return-type] Return type does not match returned value: expected `Tmat@__sub__`, found `MatrixBase`
+ sympy/matrices/matrixbase.py:3944:39: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/matrixbase.py:3944:39: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
- sympy/matrices/matrixbase.py:4386:16: error[unsupported-operator] Operator `+` is not supported between two objects of type `Self@add`
- sympy/matrices/matrixbase.py:4640:16: error[invalid-return-type] Return type does not match returned value: expected `Self@D`, found `MatrixBase | Expr`
+ sympy/matrices/matrixbase.py:4640:16: error[invalid-return-type] Return type does not match returned value: expected `Self@D`, found `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/matrixbase.py:4748:16: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/matrixbase.py:4748:16: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
- sympy/matrices/matrixbase.py:4923:16: error[invalid-return-type] Return type does not match returned value: expected `Self@analytic_func`, found `Self@analytic_func | T2'return@call_highest_priority | T1'return@call_highest_priority | Unknown`
+ sympy/matrices/matrixbase.py:4922:13: error[unsupported-operator] Operator `*=` is not supported between objects of type `T2'return@call_highest_priority` and `Self@analytic_func`
+ sympy/matrices/matrixbase.py:4922:13: error[unsupported-operator] Operator `*=` is not supported between objects of type `T1'return@call_highest_priority` and `Self@analytic_func`
- sympy/matrices/matrixbase.py:5073:28: error[invalid-argument-type] Argument is incorrect: Expected `Self@log`, found `MatrixBase | Expr | Unknown`
- sympy/matrices/matrixbase.py:5078:16: error[invalid-return-type] Return type does not match returned value: expected `Self@log`, found `MatrixBase | Expr | Unknown`
+ sympy/matrices/matrixbase.py:5073:28: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `Self@log`
+ sympy/matrices/matrixbase.py:5076:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `Self@log`
- sympy/matrices/repmatrix.py:321:17: error[unsupported-operator] Operator `-` is not supported between two objects of type `Self@_eval_is_symmetric`
- sympy/matrices/solvers.py:741:12: error[invalid-return-type] Return type does not match returned value: expected `Tmat@_pinv_solve`, found `T2'return@call_highest_priority | T1'return@call_highest_priority`
- sympy/matrices/solvers.py:976:16: error[unresolved-attribute] Attribute `solve` is not defined on `Expr` in union `MatrixBase | Expr`
+ sympy/matrices/solvers.py:976:16: error[unresolved-attribute] Attribute `solve` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/solvers.py:976:30: error[invalid-argument-type] Argument to bound method `solve` is incorrect: Argument type `MatrixBase | Expr` does not satisfy upper bound `MatrixBase` of type variable `Self`
+ sympy/matrices/solvers.py:976:30: error[invalid-argument-type] Argument to bound method `solve` is incorrect: Argument type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` does not satisfy upper bound `MatrixBase` of type variable `Self`
- sympy/matrices/solvers.py:976:30: error[invalid-argument-type] Argument to bound method `solve` is incorrect: Expected `MatrixBase`, found `MatrixBase | Expr`
+ sympy/matrices/solvers.py:976:30: error[invalid-argument-type] Argument to bound method `solve` is incorrect: Expected `MatrixBase`, found `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/sparse.py:417:16: error[unresolved-attribute] Attribute `inv` is not defined on `Expr` in union `MatrixBase | Expr`
+ sympy/matrices/sparse.py:417:16: error[unresolved-attribute] Attribute `inv` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_commonmatrix.py:1249:31: error[unsupported-operator] Operator `+` is not supported between objects of type `MutableDenseMatrix` and `ImmutableDenseNDimArray`
- sympy/matrices/tests/test_decompositions.py:23:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `Expr` in union `MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:23:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:32:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `Expr` in union `MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:32:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:42:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `Expr` in union `MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:42:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:51:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `Expr` in union `MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:51:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:57:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `Expr` in union `MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:57:12: error[unresolved-attribute] Attribute `permute_rows` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:77:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:84:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:90:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:103:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:110:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:123:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:131:12: error[no-matching-overload] No overload of function `simplify` matches arguments
+ sympy/matrices/tests/test_decompositions.py:131:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:288:10: error[unresolved-attribute] Attribute `applyfunc` is not defined on `Expr` in union `MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:288:10: error[unresolved-attribute] Attribute `applyfunc` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:393:16: error[no-matching-overload] No overload of function `simplify` matches arguments
- sympy/matrices/tests/test_decompositions.py:394:16: error[no-matching-overload] No overload of function `simplify` matches arguments
+ sympy/matrices/tests/test_decompositions.py:290:13: error[unsupported-operator] Operator `-` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:345:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:348:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:355:23: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:393:25: error[unsupported-operator] Operator `*` is not supported between objects of type `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `Unknown | MutableDenseMatrix`
+ sympy/matrices/tests/test_decompositions.py:394:25: error[unsupported-operator] Operator `*` is not supported between objects of type `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:395:16: error[unresolved-attribute] Attribute `H` is not defined on `Expr` in union `Unknown | MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:395:16: error[unresolved-attribute] Attribute `H` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:396:16: error[unresolved-attribute] Attribute `H` is not defined on `Expr` in union `Unknown | MatrixBase | Expr`
+ sympy/matrices/tests/test_decompositions.py:396:16: error[unresolved-attribute] Attribute `H` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_decompositions.py:439:13: error[no-matching-overload] No overload of function `simplify` matches arguments
+ sympy/matrices/tests/test_decompositions.py:439:22: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:451:12: error[no-matching-overload] No overload of function `simplify` matches arguments
+ sympy/matrices/tests/test_decompositions.py:451:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:464:12: error[no-matching-overload] No overload of function `simplify` matches arguments
+ sympy/matrices/tests/test_decompositions.py:464:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:475:12: error[no-matching-overload] No overload of function `simplify` matches arguments
+ sympy/matrices/tests/test_decompositions.py:475:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_decompositions.py:488:12: error[no-matching-overload] No overload of function `simplify` matches arguments
+ sympy/matrices/tests/test_decompositions.py:488:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_eigen.py:406:20: error[invalid-argument-type] Argument to function `max` is incorrect: Expected `Iterable[Unknown]`, found `MatrixBase | Unknown`
- sympy/matrices/tests/test_eigen.py:477:12: error[no-matching-overload] No overload of function `simplify` matches arguments
- sympy/matrices/tests/test_eigen.py:492:12: error[unresolved-attribute] Attribute `applyfunc` is not defined on `Expr` in union `MatrixBase | Expr | Unknown`
+ sympy/matrices/tests/test_eigen.py:257:16: error[unresolved-attribute] Attribute `n` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_eigen.py:306:14: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `ImmutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:307:14: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:322:15: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `ImmutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:323:15: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:364:14: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `ImmutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:365:14: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:380:15: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `ImmutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:381:15: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:405:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:477:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:492:13: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_eigen.py:793:19: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_immutable.py:105:23: error[unsupported-operator] Operator `+` is not supported between two objects of type `ImmutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:121:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:123:32: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:141:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:201:12: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:201:12: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:202:12: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:202:12: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:203:12: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:203:12: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:204:12: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:204:12: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:205:12: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:205:12: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:206:12: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:206:12: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:213:16: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:213:16: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:214:16: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:214:16: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:215:16: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:215:16: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:216:16: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:216:16: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:217:16: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:217:16: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:218:16: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrices.py:218:16: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
- sympy/matrices/tests/test_matrices.py:221:40: error[invalid-argument-type] Argument to bound method `multiply_elementwise` is incorrect: Expected `MatrixBase`, found `MatrixBase | Expr`
+ sympy/matrices/tests/test_matrices.py:221:40: error[invalid-argument-type] Argument to bound method `multiply_elementwise` is incorrect: Expected `MatrixBase`, found `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
+ sympy/matrices/tests/test_matrices.py:394:16: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:1739:12: error[no-matching-overload] No overload of function `simplify` matches arguments
+ sympy/matrices/tests/test_matrices.py:1581:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:1587:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:1594:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:1599:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:1607:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:1616:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:1739:21: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2179:22: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2207:26: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:2557:12: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2680:16: error[no-matching-overload] No overload of function `simplify` matches arguments
- sympy/matrices/tests/test_matrices.py:2681:16: error[no-matching-overload] No overload of function `simplify` matches arguments
+ sympy/matrices/tests/test_matrices.py:2680:25: error[unsupported-operator] Operator `*` is not supported between objects of type `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `Unknown | MutableDenseMatrix`
+ sympy/matrices/tests/test_matrices.py:2681:25: error[unsupported-operator] Operator `*` is not supported between objects of type `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2682:16: error[unresolved-attribute] Attribute `H` is not defined on `Expr` in union `Unknown | MatrixBase | Expr`
+ sympy/matrices/tests/test_matrices.py:2682:16: error[unresolved-attribute] Attribute `H` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_matrices.py:2683:16: error[unresolved-attribute] Attribute `H` is not defined on `Expr` in union `Unknown | MatrixBase | Expr`
+ sympy/matrices/tests/test_matrices.py:2683:16: error[unresolved-attribute] Attribute `H` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_matrices.py:2728:16: error[unresolved-attribute] Attribute `H` is not defined on `Expr` in union `Unknown | MatrixBase | Expr`
+ sympy/matrices/tests/test_matrices.py:2728:16: error[unresolved-attribute] Attribute `H` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_matrices.py:2746:25: error[unresolved-attribute] Attribute `H` is not defined on `Expr` in union `Unknown | MatrixBase | Expr`
+ sympy/matrices/tests/test_matrices.py:2746:25: error[unresolved-attribute] Attribute `H` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `Unknown | T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_matrices.py:2908:21: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2921:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2936:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2937:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2948:14: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:3055:33: error[unresolved-attribute] Attribute `analytic_func` is not defined on `Expr` in union `MatrixBase | Expr`
+ sympy/matrices/tests/test_matrices.py:3055:33: error[unresolved-attribute] Attribute `analytic_func` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_matrices.py:3071:60: error[unresolved-attribute] Attribute `exp` is not defined on `Expr` in union `MatrixBase | Expr`
+ sympy/matrices/tests/test_matrices.py:3071:60: error[unresolved-attribute] Attribute `exp` is not defined on `T1'return@call_highest_priority`, `T2'return@call_highest_priority`, `Expr` in union `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr`
- sympy/matrices/tests/test_matrices.py:3471:21: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:3478:12: error[unresolved-attribute] Attribute `rank` is not defined on `MatrixExpr` in union `MatrixBase | MatrixExpr | Unknown`
- sympy/matrices/tests/test_matrices.py:3479:12: error[unresolved-attribute] Attribute `rank` is not defined on `MatrixExpr` in union `MatrixBase | MatrixExpr | Unknown`
- sympy/matrices/tests/test_matrixbase.py:491:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:493:32: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:544:12: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:823:31: error[unsupported-operator] Operator `+` is not supported between objects of type `MutableDenseMatrix` and `ImmutableDenseNDimArray`
- sympy/matrices/tests/test_matrixbase.py:876:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:878:32: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:900:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
+ sympy/matrices/tests/test_matrixbase.py:963:12: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrixbase.py:963:12: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrixbase.py:964:12: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrixbase.py:964:12: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrixbase.py:965:12: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrixbase.py:965:12: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrixbase.py:966:12: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrixbase.py:966:12: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrixbase.py:967:12: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrixbase.py:967:12: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrixbase.py:968:12: error[not-subscriptable] Cannot subscript object of type `T2'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrixbase.py:968:12: error[not-subscriptable] Cannot subscript object of type `T1'return@call_highest_priority` with no `__getitem__` method
+ sympy/matrices/tests/test_matrixbase.py:1148:16: error[unsupported-operator] Operator `*` is not supported between objects of type `T1'return@call_highest_priority | T2'return@call_highest_priority | MatrixBase | Expr` and `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:2497:12: error[no-matching-overload] No overload of function `simplify` matches arguments
+ sympy/ma

... (truncated 305 lines) ...

@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 23, 2026

Memory usage report

Memory usage unchanged ✅

reveal_type(invalid_dict1) # revealed: dict[Unknown, str]
reveal_type(invalid_dict2) # revealed: dict[str, Unknown]
reveal_type(dict_too_few_args) # revealed: dict[str, Unknown]
reveal_type(dict_too_few_args) # revealed: dict[Unknown, Unknown]
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is the only change in behaviour from this PR, which comes as a result of unifying the parsing of stdlib aliases between infer/builder.rs and infer/builder/type_expression.rs so that they now share a common implementation. Either the answer we give on main or the new answer seem fine to me, since this is an invalid type expression, but I can look into it if anybody strongly prefers the answer we have on main

@AlexWaygood
Copy link
Member Author

I've been sitting on this branch for a while, uncertain if it was worth it... but seeing that we had to make this distinction yet again in #23444 inspired me to get Claude to rebase it

@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 23, 2026

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-argument-type 0 1 0
Total 0 1 0

Full report with detailed diff (timing results)

@AlexWaygood AlexWaygood marked this pull request as ready for review February 23, 2026 13:05
@sharkdp
Copy link
Contributor

sharkdp commented Feb 23, 2026

Haven't reviewed the code, but the idea seems very appealing to me!

This PR adds a SpecialFormType::kind() method, which returns a more fine-grained SpecialFormCategory enumeration of subcategories of special forms.

Have you considered using a nested structure for the SpecialFormType enum itself (as opposed to mapping to a new enum that duplicates part of the structure)?

@AlexWaygood
Copy link
Member Author

This PR adds a SpecialFormType::kind() method, which returns a more fine-grained SpecialFormCategory enumeration of subcategories of special forms.

Have you considered using a nested structure for the SpecialFormType enum itself (as opposed to mapping to a new enum that duplicates part of the structure)?

Hmm, yeah, that might be interesting... I'll ask Claude to try that out and see how it looks by comparison!

AlexWaygood pushed a commit that referenced this pull request Feb 23, 2026
Instead of having a flat SpecialFormType enum with a separate
SpecialFormCategory enum that duplicates part of the structure via a
kind() method, embed the subcategories directly into SpecialFormType
itself as nested enum variants:

- SpecialFormType::LegacyStdlibAlias(LegacyStdlibAlias)
- SpecialFormType::TypeQualifier(TypeQualifier)

This eliminates SpecialFormCategory, MiscSpecialForm, and the kind()
mapping method, along with several From impls that existed only to
convert between the parallel structures. Callers now match directly
on SpecialFormType variants instead of calling .kind() first.

This is an alternative to the SpecialFormCategory approach, as
suggested in #23513 (comment)

https://claude.ai/code/session_01AgLYCKoBuLEDsmkn1cnmvZ
AlexWaygood pushed a commit that referenced this pull request Feb 23, 2026
Instead of having a flat SpecialFormType enum with a separate
SpecialFormCategory enum that duplicates part of the structure via a
kind() method, embed the subcategories directly into SpecialFormType
itself as nested enum variants:

- SpecialFormType::LegacyStdlibAlias(LegacyStdlibAlias)
- SpecialFormType::TypeQualifier(TypeQualifier)

This eliminates SpecialFormCategory, MiscSpecialForm, and the kind()
mapping method, along with several From impls that existed only to
convert between the parallel structures. Callers now match directly
on SpecialFormType variants instead of calling .kind() first.

This is an alternative to the SpecialFormCategory approach, as
suggested in #23513 (comment)

https://claude.ai/code/session_01AgLYCKoBuLEDsmkn1cnmvZ
AlexWaygood pushed a commit that referenced this pull request Feb 23, 2026
Instead of having a flat SpecialFormType enum with a separate
SpecialFormCategory enum that duplicates part of the structure via a
kind() method, embed the subcategories directly into SpecialFormType
itself as nested enum variants:

- SpecialFormType::LegacyStdlibAlias(LegacyStdlibAlias)
- SpecialFormType::TypeQualifier(TypeQualifier)

This eliminates SpecialFormCategory, MiscSpecialForm, and the kind()
mapping method, along with several From impls that existed only to
convert between the parallel structures. Callers now match directly
on SpecialFormType variants instead of calling .kind() first.

This is an alternative to the SpecialFormCategory approach, as
suggested in #23513 (comment)

https://claude.ai/code/session_01AgLYCKoBuLEDsmkn1cnmvZ
AlexWaygood pushed a commit that referenced this pull request Feb 23, 2026
Instead of having a flat SpecialFormType enum with a separate
SpecialFormCategory enum that duplicates part of the structure via a
kind() method, embed the subcategories directly into SpecialFormType
itself as nested enum variants:

- SpecialFormType::LegacyStdlibAlias(LegacyStdlibAlias)
- SpecialFormType::TypeQualifier(TypeQualifier)

This eliminates SpecialFormCategory, MiscSpecialForm, and the kind()
mapping method, along with several From impls that existed only to
convert between the parallel structures. Callers now match directly
on SpecialFormType variants instead of calling .kind() first.

This is an alternative to the SpecialFormCategory approach, as
suggested in #23513 (comment)

https://claude.ai/code/session_01AgLYCKoBuLEDsmkn1cnmvZ
AlexWaygood pushed a commit that referenced this pull request Feb 23, 2026
Instead of having a flat SpecialFormType enum with a separate
SpecialFormCategory enum that duplicates part of the structure via a
kind() method, embed the subcategories directly into SpecialFormType
itself as nested enum variants:

- SpecialFormType::LegacyStdlibAlias(LegacyStdlibAlias)
- SpecialFormType::TypeQualifier(TypeQualifier)

This eliminates SpecialFormCategory, MiscSpecialForm, and the kind()
mapping method, along with several From impls that existed only to
convert between the parallel structures. Callers now match directly
on SpecialFormType variants instead of calling .kind() first.

This is an alternative to the SpecialFormCategory approach, as
suggested in #23513 (comment)

https://claude.ai/code/session_01AgLYCKoBuLEDsmkn1cnmvZ
AlexWaygood pushed a commit that referenced this pull request Feb 23, 2026
Instead of having a flat SpecialFormType enum with a separate
SpecialFormCategory enum that duplicates part of the structure via a
kind() method, embed the subcategories directly into SpecialFormType
itself as nested enum variants:

- SpecialFormType::LegacyStdlibAlias(LegacyStdlibAlias)
- SpecialFormType::TypeQualifier(TypeQualifier)

This eliminates SpecialFormCategory, MiscSpecialForm, and the kind()
mapping method, along with several From impls that existed only to
convert between the parallel structures. Callers now match directly
on SpecialFormType variants instead of calling .kind() first.

This is an alternative to the SpecialFormCategory approach, as
suggested in #23513 (comment)

https://claude.ai/code/session_01AgLYCKoBuLEDsmkn1cnmvZ
AlexWaygood pushed a commit that referenced this pull request Feb 23, 2026
Instead of having a flat SpecialFormType enum with a separate
SpecialFormCategory enum that duplicates part of the structure via a
kind() method, embed the subcategories directly into SpecialFormType
itself as nested enum variants:

- SpecialFormType::LegacyStdlibAlias(LegacyStdlibAlias)
- SpecialFormType::TypeQualifier(TypeQualifier)

This eliminates SpecialFormCategory, MiscSpecialForm, and the kind()
mapping method, along with several From impls that existed only to
convert between the parallel structures. Callers now match directly
on SpecialFormType variants instead of calling .kind() first.

This is an alternative to the SpecialFormCategory approach, as
suggested in #23513 (comment)

https://claude.ai/code/session_01AgLYCKoBuLEDsmkn1cnmvZ
AlexWaygood pushed a commit that referenced this pull request Feb 23, 2026
Instead of having a flat SpecialFormType enum with a separate
SpecialFormCategory enum that duplicates part of the structure via a
kind() method, embed the subcategories directly into SpecialFormType
itself as nested enum variants:

- SpecialFormType::LegacyStdlibAlias(LegacyStdlibAlias)
- SpecialFormType::TypeQualifier(TypeQualifier)

This eliminates SpecialFormCategory, MiscSpecialForm, and the kind()
mapping method, along with several From impls that existed only to
convert between the parallel structures. Callers now match directly
on SpecialFormType variants instead of calling .kind() first.

This is an alternative to the SpecialFormCategory approach, as
suggested in #23513 (comment)

https://claude.ai/code/session_01AgLYCKoBuLEDsmkn1cnmvZ
AlexWaygood pushed a commit that referenced this pull request Feb 23, 2026
Instead of having a flat SpecialFormType enum with a separate
SpecialFormCategory enum that duplicates part of the structure via a
kind() method, embed the subcategories directly into SpecialFormType
itself as nested enum variants:

- SpecialFormType::LegacyStdlibAlias(LegacyStdlibAlias)
- SpecialFormType::TypeQualifier(TypeQualifier)

This eliminates SpecialFormCategory, MiscSpecialForm, and the kind()
mapping method, along with several From impls that existed only to
convert between the parallel structures. Callers now match directly
on SpecialFormType variants instead of calling .kind() first.

This is an alternative to the SpecialFormCategory approach, as
suggested in #23513 (comment)

https://claude.ai/code/session_01AgLYCKoBuLEDsmkn1cnmvZ
AlexWaygood pushed a commit that referenced this pull request Feb 23, 2026
Instead of having a flat SpecialFormType enum with a separate
SpecialFormCategory enum that duplicates part of the structure via a
kind() method, embed the subcategories directly into SpecialFormType
itself as nested enum variants:

- SpecialFormType::LegacyStdlibAlias(LegacyStdlibAlias)
- SpecialFormType::TypeQualifier(TypeQualifier)

This eliminates SpecialFormCategory, MiscSpecialForm, and the kind()
mapping method, along with several From impls that existed only to
convert between the parallel structures. Callers now match directly
on SpecialFormType variants instead of calling .kind() first.

This is an alternative to the SpecialFormCategory approach, as
suggested in #23513 (comment)

https://claude.ai/code/session_01AgLYCKoBuLEDsmkn1cnmvZ
@AlexWaygood AlexWaygood marked this pull request as draft February 23, 2026 17:04
@AlexWaygood
Copy link
Member Author

Closing in favour of #23517

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

Labels

ecosystem-analyzer internal An internal refactor or improvement ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants