Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[ty] Validate type variable defaults don't reference later type parameters or type parameters out of scope#23623

Merged
AlexWaygood merged 13 commits intomainfrom
claude/fix-type-variable-ordering-LHT8Z
Feb 28, 2026
Merged

[ty] Validate type variable defaults don't reference later type parameters or type parameters out of scope#23623
AlexWaygood merged 13 commits intomainfrom
claude/fix-type-variable-ordering-LHT8Z

Conversation

@AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Feb 27, 2026

Summary

Add validation to ensure that type variable defaults cannot reference type variables that appear later in the type parameter list, or type parameters that are out of scope. This is a restriction in both PEP 695 and legacy generic syntax.

For example, in class Bad[S = T, T = int], the default for S references T which comes after it, which is invalid. However, class Good[T, U = T] is valid since U's default references T which comes before it.

Test Plan

mdtests and snapshots

claude and others added 6 commits February 27, 2026 22:28
…variables

Type variable defaults can reference earlier type variables in the
parameter list (PEP 696), but not later ones. For example,
`class C[T, U = T]` is valid, but `class C[S = T, T = int]` is not
because S's default references T which is defined after S.

This adds a check in class body inference that walks PEP 695 type
parameter defaults and reports `invalid-generic-class` if any default
references a type variable that appears later in the parameter list.

https://claude.ai/code/session_01CmptNs5MMq5fsoQr7Ahqai
The verbose message is a general statement about the rule; the concise
message (used with --output-format=concise) names the specific type
parameters involved.

https://claude.ai/code/session_01CmptNs5MMq5fsoQr7Ahqai
Drop the separate concise message; the single message is short enough
to work in both modes.

https://claude.ai/code/session_01CmptNs5MMq5fsoQr7Ahqai
The existing check that type variable defaults don't reference later type
parameters only applied to PEP 695 generic contexts. This extends it to
legacy `Generic[...]` contexts as well, so that e.g.
`class Foo(Generic[T2, T1])` where `T2 = TypeVar("T2", default=T1)`
correctly emits an error.

https://claude.ai/code/session_01CmptNs5MMq5fsoQr7Ahqai
@AlexWaygood AlexWaygood added ty Multi-file analysis & type inference ecosystem-analyzer labels Feb 27, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 27, 2026

Typing conformance results improved 🎉

The percentage of diagnostics emitted that were expected errors increased from 85.39% to 85.42%. The percentage of expected errors that received a diagnostic increased from 76.01% to 76.19%.

Summary

Metric Old New Diff Outcome
True Positives 830 832 +2 ⏫ (✅)
False Positives 142 142 +0
False Negatives 262 260 -2 ⏬ (✅)
Total Diagnostics 972 974 +2
Precision 85.39% 85.42% +0.03% ⏫ (✅)
Recall 76.01% 76.19% +0.18% ⏫ (✅)

True positives added

Details
Location Name Message
generics_defaults_referential.py:53:7 invalid-generic-class Default of Start2T cannot reference out-of-scope type variable StopT
generics_defaults_referential.py:60:11 invalid-generic-class Default of S2 cannot reference out-of-scope type variable S1

@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 27, 2026

mypy_primer results

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

spack (https://github.com/spack/spack)
- lib/spack/spack/detection/path.py:169:33: error[invalid-argument-type] Argument to function `dedupe_paths` is incorrect: Expected `list[str]`, found `Unknown | list[Unknown | int | str | ... omitted 3 union elements]`
+ lib/spack/spack/detection/path.py:169:33: error[invalid-argument-type] Argument to function `dedupe_paths` is incorrect: Expected `list[str]`, found `Unknown | list[str | bytes | PathLike[str] | ... omitted 3 union elements]`
- lib/spack/spack/llnl/util/filesystem.py:1668:35: error[invalid-argument-type] Argument to function `exists` is incorrect: Expected `int | str | bytes | PathLike[str] | PathLike[bytes]`, found `Sized | Unknown`
+ lib/spack/spack/llnl/util/filesystem.py:1668:35: error[invalid-argument-type] Argument to function `exists` is incorrect: Expected `int | str | bytes | PathLike[str] | PathLike[bytes]`, found `Unknown | Sized`
- lib/spack/spack/llnl/util/filesystem.py:1674:25: error[invalid-argument-type] Argument to function `move` is incorrect: Expected `str | PathLike[str]`, found `Sized | Unknown`
+ lib/spack/spack/llnl/util/filesystem.py:1674:25: error[invalid-argument-type] Argument to function `move` is incorrect: Expected `str | PathLike[str]`, found `Unknown | Sized`

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`

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

porcupine (https://github.com/Akuli/porcupine)
- porcupine/pluginmanager.py:133:49: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[Never]`, found `Unknown | str`
- Found 25 diagnostics
+ Found 24 diagnostics

vision (https://github.com/pytorch/vision)
- test/test_transforms_v2.py:1551: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:1551: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:1551: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:1551: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:1551: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:1551: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:1551: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:1551: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:1551: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:1551: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:1605: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:1605: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:1605: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:1605: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:1605: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:1605: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:1692: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:1692: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:1692: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:1692: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:1692: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:1692: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:1692: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:1692: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:1747: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:1747: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:1747: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:1747: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:1747: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:1747: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:1747: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:1747: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]`

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 57 diagnostics
+ Found 58 diagnostics

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/deployments/runner.py:1017:70: error[unresolved-attribute] Attribute `__name__` is not defined on `(...) -> Any` in union `Unknown | ((...) -> Any)`
+ src/prefect/deployments/runner.py:1017:70: error[unresolved-attribute] Attribute `__name__` is not defined on `((...) -> Any) & ((*args: object, **kwargs: object) -> object)` in union `Unknown | (((...) -> Any) & ((*args: object, **kwargs: object) -> object))`
- src/prefect/flow_engine.py:1004:32: error[invalid-await] `Unknown | R@FlowRunEngine | Coroutine[Any, Any, R@FlowRunEngine]` is not awaitable
- src/prefect/flow_engine.py:1610:24: error[invalid-await] `Unknown | R@AsyncFlowRunEngine | Coroutine[Any, Any, R@AsyncFlowRunEngine]` is not awaitable
- src/prefect/flows.py:286:34: error[unresolved-attribute] Object of type `(**P@Flow) -> R@Flow` has no attribute `__name__`
+ src/prefect/flows.py:286:34: error[unresolved-attribute] Object of type `((**P@Flow) -> R@Flow) & ((*args: object, **kwargs: object) -> object)` has no attribute `__name__`
- src/prefect/flows.py:404:68: error[unresolved-attribute] Object of type `(**P@Flow) -> R@Flow` has no attribute `__name__`
+ src/prefect/flows.py:404:68: error[unresolved-attribute] Object of type `((**P@Flow) -> R@Flow) & ((*args: object, **kwargs: object) -> object)` has no attribute `__name__`
- src/prefect/utilities/asyncutils.py:198:16: error[invalid-return-type] Return type does not match returned value: expected `R@run_coro_as_sync | None`, found `CoroutineType[Any, Any, R@run_coro_as_sync | None] | R@run_coro_as_sync | None`
- src/prefect/utilities/asyncutils.py:207:20: error[invalid-return-type] Return type does not match returned value: expected `R@run_coro_as_sync | None`, found `CoroutineType[Any, Any, R@run_coro_as_sync | None] | R@run_coro_as_sync | None`
- Found 5786 diagnostics
+ Found 5782 diagnostics

dd-trace-py (https://github.com/DataDog/dd-trace-py)
- ddtrace/debugging/_redaction.py:16:5: error[unsupported-operator] Operator `|` is not supported between objects of type `frozenset[Unknown | str]` and `Unknown | EnvVariable[set[Unknown]]`
+ ddtrace/debugging/_redaction.py:16:5: error[unsupported-operator] Operator `|` is not supported between objects of type `frozenset[str | Unknown]` and `Unknown | EnvVariable[set[Unknown]]`
- tests/tracer/test_span.py:193:29: error[invalid-argument-type] Argument to bound method `set_metric` is incorrect: Expected `int | float`, found `int | float | complex | ... omitted 6 union elements`
+ tests/tracer/test_span.py:193:29: error[invalid-argument-type] Argument to bound method `set_metric` is incorrect: Expected `int | float`, found `Unknown | None | dict[Unknown, Unknown] | ... omitted 6 union elements`

openlibrary (https://github.com/internetarchive/openlibrary)
- openlibrary/catalog/utils/__init__.py:132:17: error[unresolved-attribute] Attribute `search` is not defined on `str` in union `Unknown | str`
+ openlibrary/catalog/utils/__init__.py:132:17: error[unresolved-attribute] Attribute `search` is not defined on `str` in union `str | Unknown`

sympy (https://github.com/sympy/sympy)
- sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic | int | float | complex | Any` is not assignable to `Expr | int | float | complex`
+ sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic` is not assignable to `Expr | int | float | complex`
- sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic | int | float | complex | Any` is not assignable to `Expr | int | float | complex`
+ sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic` is not assignable to `Expr | int | float | complex`
- sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic | int | float | complex | Any` is not assignable to `Expr | int | float | complex`
+ sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic` is not assignable to `Expr | int | float | complex`
- sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic | int | float | complex | Any` is not assignable to `Expr | int | float | complex`
+ sympy/algebras/quaternion.py:132:22: error[invalid-assignment] Object of type `Basic` is not assignable to `Expr | int | float | complex`
- sympy/algebras/tests/test_quaternion.py:423:33: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/codegen/tests/test_matrix_nodes.py:28:21: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/functions/combinatorial/factorials.py:967:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/functions/combinatorial/factorials.py:967:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
- sympy/functions/combinatorial/factorials.py:968:29: error[unresolved-attribute] Attribute `is_nonnegative` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/functions/combinatorial/factorials.py:968:47: error[unresolved-attribute] Attribute `is_integer` is not defined on `int`, `complex` in union `Basic | int | float | complex | Any`
- sympy/functions/combinatorial/factorials.py:969:12: error[unresolved-attribute] Attribute `is_zero` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/functions/combinatorial/factorials.py:972:13: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[1]`
+ sympy/functions/combinatorial/factorials.py:972:13: error[unsupported-operator] Operator `-` is not supported between objects of type `Basic` and `Literal[1]`
- sympy/functions/combinatorial/factorials.py:975:12: error[unresolved-attribute] Attribute `is_integer` is not defined on `int`, `complex` in union `Basic | int | float | complex | Any`
- sympy/functions/combinatorial/factorials.py:976:16: error[unresolved-attribute] Attribute `is_negative` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/functions/combinatorial/factorials.py:978:18: error[unresolved-attribute] Attribute `is_number` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/functions/combinatorial/factorials.py:984:14: error[unresolved-attribute] Attribute `is_number` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/functions/combinatorial/factorials.py:986:26: error[unsupported-operator] Operator `+` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[1]`
+ sympy/functions/combinatorial/factorials.py:986:26: error[unsupported-operator] Operator `+` is not supported between objects of type `Basic` and `Literal[1]`
- sympy/functions/combinatorial/factorials.py:986:40: error[unsupported-operator] Operator `+` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[1]`
+ sympy/functions/combinatorial/factorials.py:986:40: error[unsupported-operator] Operator `+` is not supported between objects of type `Basic` and `Literal[1]`
- sympy/functions/combinatorial/factorials.py:986:53: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/functions/combinatorial/factorials.py:986:53: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
- sympy/geometry/polygon.py:1501:12: error[unresolved-attribute] Attribute `is_Number` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/geometry/polygon.py:1502:20: error[invalid-argument-type] Argument to function `as_int` is incorrect: Expected `SupportsIndex`, found `Basic | int | float | complex | Any`
+ sympy/geometry/polygon.py:1502:20: error[invalid-argument-type] Argument to function `as_int` is incorrect: Expected `SupportsIndex`, found `Basic`
- sympy/geometry/polygon.py:1503:16: error[unsupported-operator] Operator `<` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[3]`
+ sympy/geometry/polygon.py:1503:16: error[unsupported-operator] Operator `<` is not supported between objects of type `Basic` and `Literal[3]`
- sympy/geometry/polygon.py:1510:40: error[unresolved-attribute] Attribute `is_number` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/geometry/tests/test_util.py:129:55: error[invalid-argument-type] Argument to function `subsets` is incorrect: Expected `Sequence[Unknown]`, found `set[Unknown | Point2D]`
+ sympy/geometry/tests/test_util.py:129:55: error[invalid-argument-type] Argument to function `subsets` is incorrect: Expected `Sequence[Unknown]`, found `set[Point2D | Unknown]`
- sympy/integrals/prde.py:90:11: error[unresolved-attribute] Attribute `as_poly` is not defined on `int` in union `Unknown | int`
+ sympy/integrals/prde.py:90:11: error[unresolved-attribute] Attribute `as_poly` is not defined on `int` in union `int | Unknown`
- sympy/integrals/prde.py:90:61: error[unresolved-attribute] Attribute `as_poly` is not defined on `int` in union `Unknown | int`
+ sympy/integrals/prde.py:90:61: error[unresolved-attribute] Attribute `as_poly` is not defined on `int` in union `int | Unknown`
- sympy/integrals/prde.py:91:10: error[unresolved-attribute] Attribute `as_poly` is not defined on `int` in union `Unknown | int`
+ sympy/integrals/prde.py:91:10: error[unresolved-attribute] Attribute `as_poly` is not defined on `int` in union `int | Unknown`
- sympy/matrices/expressions/hadamard.py:82: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:82:22: error[invalid-argument-type] Argument to function `validate_matadd_integer` is incorrect: Expected `MatrixExpr`, found `Basic`
- sympy/matrices/expressions/kronecker.py:110: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:111: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:16: error[unresolved-attribute] Object of type `Basic` has no attribute `is_Identity`
+ sympy/matrices/expressions/kronecker.py:111:33: error[unresolved-attribute] Object of type `Basic` has no attribute `rows`
- sympy/matrices/expressions/matadd.py:61: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:61:22: error[invalid-argument-type] Argument to function `validate_matadd_integer` is incorrect: Expected `MatrixExpr`, found `Unknown | Basic`
- sympy/matrices/expressions/tests/test_blockmatrix.py:236:13: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/expressions/tests/test_blockmatrix.py:236:33: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/expressions/tests/test_blockmatrix.py:236:53: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/expressions/tests/test_blockmatrix.py:460:12: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/expressions/tests/test_derivatives.py:552:26: error[unsupported-operator] Operator `+` is not supported between two objects of type `MatrixBase | Expr`
- sympy/matrices/expressions/tests/test_matadd.py:37:12: error[unsupported-operator] Operator `+` is not supported between objects of type `MatrixBase` and `MatrixBase | Expr`
- sympy/matrices/expressions/tests/test_matpow.py:125:47: error[unsupported-operator] Operator `+` is not supported between two objects of type `ImmutableDenseMatrix`
- sympy/matrices/inverse.py:385:11: error[unsupported-operator] Operator `-` is not supported between objects of type `MatrixBase` and `MatrixBase | Expr | Unknown`
- sympy/matrices/inverse.py:393:11: error[unsupported-operator] Operator `+` is not supported between objects of type `MatrixBase` and `MatrixBase | Expr | Unknown`
- sympy/matrices/matrixbase.py:979:18: error[unsupported-operator] Operator `+` is not supported between two objects of type `Self@_eval_wilkinson`
- sympy/matrices/matrixbase.py:3256:16: error[invalid-return-type] Return type does not match returned value: expected `MatrixBase`, found `T1'return@call_highest_priority | T2'return@call_highest_priority`
- sympy/matrices/matrixbase.py:3256:29: error[invalid-argument-type] Argument is incorrect: Expected `T1'return@call_highest_priority | T2'return@call_highest_priority`, found `MatrixBase`
- sympy/matrices/matrixbase.py:3310:16: error[unsupported-operator] Operator `+` is not supported between two objects of type `MatrixBase`
- sympy/matrices/matrixbase.py:3314:16: error[invalid-return-type] Return type does not match returned value: expected `Tmat@__sub__`, found `MatrixBase`
- sympy/matrices/matrixbase.py:4386:16: error[unsupported-operator] Operator `+` is not supported between two objects of type `Self@add`
- sympy/matrices/repmatrix.py:321:17: error[unsupported-operator] Operator `-` is not supported between two objects of type `Self@_eval_is_symmetric`
- sympy/matrices/tests/test_commonmatrix.py:1250:31: error[unsupported-operator] Operator `+` is not supported between objects of type `MutableDenseMatrix` and `ImmutableDenseNDimArray`
- sympy/matrices/tests/test_eigen.py:407:20: error[invalid-argument-type] Argument to function `max` is incorrect: Expected `Iterable[Unknown]`, found `MatrixBase | Unknown`
- sympy/matrices/tests/test_immutable.py:106:23: error[unsupported-operator] Operator `+` is not supported between two objects of type `ImmutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:122:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:124:32: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:142:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2180:22: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2208:26: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2909:21: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2922: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:2938:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2949:14: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:3472:21: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- 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_matrices.py:3480:12: error[unresolved-attribute] Attribute `rank` is not defined on `MatrixExpr` in union `MatrixBase | MatrixExpr | Unknown`
- sympy/matrices/tests/test_matrixbase.py:492:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:494:32: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:545:12: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:824:31: error[unsupported-operator] Operator `+` is not supported between objects of type `MutableDenseMatrix` and `ImmutableDenseNDimArray`
- sympy/matrices/tests/test_matrixbase.py:877:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:879:32: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:901:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:2932:22: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:2960:26: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:3611:21: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:3625:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:3640:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:3641:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:3653:14: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_reductions.py:378:21: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_reductions.py:385:12: error[unresolved-attribute] Attribute `rank` is not defined on `MatrixExpr` in union `MatrixBase | MatrixExpr | Unknown`
- sympy/matrices/tests/test_reductions.py:386:12: error[unresolved-attribute] Attribute `rank` is not defined on `MatrixExpr` in union `MatrixBase | MatrixExpr | Unknown`
- sympy/matrices/tests/test_solvers.py:69:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_sparse.py:574:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableSparseMatrix`
- sympy/matrices/tests/test_sparse.py:578:52: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableSparseMatrix`
- sympy/matrices/tests/test_sparse.py:594:17: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableSparseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:13:6: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:16:38: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:16:84: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:16:131: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:21:44: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:21:90: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:21:137: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:25:37: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:25:83: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:25:130: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/mathematica.py:692:38: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[Never]`, found `Unknown | list[Unknown | str]`
- sympy/physics/control/tests/test_lti.py:3778:31: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/physics/control/tests/test_lti.py:3778:38: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/physics/mechanics/lagrange.py:223:23: error[unsupported-operator] Operator `-` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/physics/mechanics/lagrange.py:347:17: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/physics/mechanics/linearize.py:218:28: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/physics/mechanics/linearize.py:230:29: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/physics/mechanics/linearize.py:242:29: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/physics/mechanics/tests/test_jointsmethod.py:248:17: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/physics/mechanics/tests/test_jointsmethod.py:250:17: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/physics/optics/gaussopt.py:264:56: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:264:56: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/physics/optics/gaussopt.py:299:54: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:299:54: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
- sympy/physics/optics/gaussopt.py:299:69: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:299:69: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/physics/optics/gaussopt.py:708:12: error[unsupported-operator] Operator `**` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[2]`
+ sympy/physics/optics/gaussopt.py:708:12: error[unsupported-operator] Operator `**` is not supported between objects of type `Basic` and `Literal[2]`
- sympy/physics/optics/gaussopt.py:757:8: error[unresolved-attribute] Attribute `is_infinite` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:757:25: error[unresolved-attribute] Attribute `is_infinite` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:758:21: error[unresolved-attribute] Attribute `is_infinite` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/physics/optics/gaussopt.py:760:16: error[unsupported-operator] Operator `*` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:760:16: error[unsupported-operator] Operator `*` is not supported between two objects of type `Basic`
- sympy/physics/optics/gaussopt.py:760:21: error[unsupported-operator] Operator `+` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:760:21: error[unsupported-operator] Operator `+` is not supported between two objects of type `Basic`
- sympy/physics/optics/gaussopt.py:791:34: error[unsupported-operator] Unary operator `-` is not supported for object of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:791:34: error[unsupported-operator] Unary operator `-` is not supported for object of type `Basic`
- sympy/physics/optics/gaussopt.py:838:30: error[unsupported-operator] Operator `**` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[2]`
+ sympy/physics/optics/gaussopt.py:838:30: error[unsupported-operator] Operator `**` is not supported between objects of type `Basic` and `Literal[2]`
- sympy/physics/optics/gaussopt.py:838:41: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:838:41: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
- sympy/physics/optics/gaussopt.py:838:54: error[unsupported-operator] Operator `/` is not supported between objects of type `Literal[1]` and `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:838:54: error[unsupported-operator] Operator `/` is not supported between objects of type `Literal[1]` and `Basic`
- sympy/physics/optics/gaussopt.py:839:22: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:839:22: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/physics/optics/gaussopt.py:839:37: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:839:37: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/physics/optics/gaussopt.py:840:31: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:840:31: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/physics/optics/gaussopt.py:840:46: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:840:46: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/physics/optics/gaussopt.py:888:9: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/physics/optics/gaussopt.py:888:9: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/physics/quantum/cg.py:84:34: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Basic`, found `Basic | int | float | complex | Any`
- sympy/physics/quantum/cg.py:259:34: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Basic`, found `Basic | int | float | complex | Any`
- sympy/physics/quantum/cg.py:348:34: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Basic`, found `Basic | int | float | complex | Any`
- sympy/physics/quantum/tests/test_represent.py:90:17: error[unsupported-operator] Operator `+` is not supported between objects of type `MatrixBase | Expr` and `MatrixBase`
- sympy/physics/quantum/tests/test_represent.py:92:24: error[unsupported-operator] Operator `-` is not supported between two objects of type `MatrixBase | Expr`
- sympy/physics/quantum/tests/test_represent.py:94:28: error[unsupported-operator] Operator `+` is not supported between two objects of type `MatrixBase | Expr`
- sympy/physics/vector/functions.py:381:21: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `MatrixBase | Unknown`
- sympy/polys/fields.py:101:24: error[unresolved-attribute] Attribute `as_numer_denom` is not defined on `Basic`, `int`, `float`, `complex` in union `Any | Basic | int | float | complex`
+ sympy/polys/fields.py:101:24: error[unresolved-attribute] Object of type `Basic` has no attribute `as_numer_denom`
- sympy/polys/polyoptions.py:472:61: error[invalid-argument-type] Argument to bound method `poly_ring` is incorrect: Expected `str | Expr`, found `Any | Basic | int | float | complex`
+ sympy/polys/polyoptions.py:472:61: error[invalid-argument-type] Argument to bound method `poly_ring` is incorrect: Expected `str | Expr`, found `Basic`
- sympy/polys/polyoptions.py:474:61: error[invalid-argument-type] Argument to bound method `poly_ring` is incorrect: Expected `str | Expr`, found `Any | Basic | int | float | complex`
+ sympy/polys/polyoptions.py:474:61: error[invalid-argument-type] Argument to bound method `poly_ring` is incorrect: Expected `str | Expr`, found `Basic`
- sympy/polys/polyoptions.py:476:61: error[invalid-argument-type] Argument to bound method `poly_ring` is incorrect: Expected `str | Expr`, found `Any | Basic | int | float | complex`
+ sympy/polys/polyoptions.py:476:61: error[invalid-argument-type] Argument to bound method `poly_ring` is incorrect: Expected `str | Expr`, found `Basic`
- sympy/polys/polyoptions.py:478:63: error[invalid-argument-type] Argument to bound method `poly_ring` is incorrect: Expected `str | Expr`, found `Any | Basic | int | float | complex`
+ sympy/polys/polyoptions.py:478:63: error[invalid-argument-type] Argument to bound method `poly_ring` is incorrect: Expected `str | Expr`, found `Basic`
- sympy/polys/polyoptions.py:480:63: error[invalid-argument-type] Argument to bound method `poly_ring` is incorrect: Expected `str | Expr`, found `Any | Basic | int | float | complex`
+ sympy/polys/polyoptions.py:480:63: error[invalid-argument-type] Argument to bound method `poly_ring` is incorrect: Expected `str | Expr`, found `Basic`
- sympy/polys/polyoptions.py:482:61: error[invalid-argument-type] Argument to bound method `poly_ring` is incorrect: Expected `str | Expr`, found `Any | Basic | int | float | complex`
+ sympy/polys/polyoptions.py:482:61: error[invalid-argument-type] Argument to bound method `poly_ring` is incorrect: Expected `str | Expr`, found `Basic`
- sympy/polys/polyoptions.py:492:62: error[invalid-argument-type] Argument to bound method `frac_field` is incorrect: Expected `str | Expr`, found `Any | Basic | int | float | complex`
+ sympy/polys/polyoptions.py:492:62: error[invalid-argument-type] Argument to bound method `frac_field` is incorrect: Expected `str | Expr`, found `Basic`
- sympy/polys/polyoptions.py:494:62: error[invalid-argument-type] Argument to bound method `frac_field` is incorrect: Expected `str | Expr`, found `Any | Basic | int | float | complex`
+ sympy/polys/polyoptions.py:494:62: error[invalid-argument-type] Argument to bound method `frac_field` is incorrect: Expected `str | Expr`, found `Basic`
- sympy/polys/polytools.py:6008:12: error[unresolved-attribute] Attribute `is_algebraic` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/polys/polytools.py:6008:31: error[unresolved-attribute] Attribute `is_irrational` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/polys/polytools.py:6008:51: error[unresolved-attribute] Attribute `is_algebraic` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/polys/polytools.py:6008:70: error[unresolved-attribute] Attribute `is_irrational` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/polys/polytools.py:6009:20: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/polys/polytools.py:6009:20: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/polys/polytools.py:6138:12: error[unresolved-attribute] Attribute `is_algebraic` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/polys/polytools.py:6138:31: error[unresolved-attribute] Attribute `is_irrational` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/polys/polytools.py:6138:51: error[unresolved-attribute] Attribute `is_algebraic` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/polys/polytools.py:6138:70: error[unresolved-attribute] Attribute `is_irrational` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/polys/polytools.py:6139:20: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/polys/polytools.py:6139:20: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/series/formal.py:988:34: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Basic`, found `Basic | int | float | complex | Any`
- sympy/series/fourier.py:147:34: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Basic`, found `Basic | int | float | complex | Any`
- sympy/series/order.py:154:20: error[unresolved-attribute] Attribute `is_symbol` is not defined on `int`, `float`, `complex` in union `Unknown | Basic | int | float | complex`
- sympy/series/order.py:189:28: error[unsupported-operator] Operator `/` is not supported between objects of type `Literal[1]` and `Unknown | Basic | int | float | complex`
+ sympy/series/order.py:189:28: error[unsupported-operator] Operator `/` is not supported between objects of type `Literal[1]` and `Unknown | Basic`
- sympy/series/order.py:193:29: error[unsupported-operator] Operator `/` is not supported between objects of type `Literal[-1]` and `Unknown | Basic | int | float | complex`
+ sympy/series/order.py:193:29: error[unsupported-operator] Operator `/` is not supported between objects of type `Literal[-1]` and `Unknown | Basic`
- sympy/series/order.py:270:52: error[invalid-argument-type] Argument to bound method `as_independent` is incorrect: Expected `Basic | type[Basic]`, found `Any | Basic | int | float | complex`
- sympy/series/order.py:270:52: error[invalid-argument-type] Argument to bound method `as_independent` is incorrect: Expected `Basic | type[Basic]`, found `Any | Basic | int | float | complex`
- sympy/series/order.py:270:52: error[invalid-argument-type] Argument to bound method `as_independent` is incorrect: Expected `Basic | type[Basic]`, found `Any | Basic | int | float | complex`
- sympy/series/order.py:288:45: error[unsupported-operator] Unary operator `-` is not supported for object of type `Any | Basic | int | float | complex`
+ sympy/series/order.py:288:45: error[unsupported-operator] Unary operator `-` is not supported for object of type `Unknown | Basic`
- sympy/series/order.py:289:48: error[unsupported-operator] Operator `**` is not supported between objects of type `Any | Basic | int | float | complex` and `Basic`
+ sympy/series/order.py:289:48: error[unsupported-operator] Operator `**` is not supported between objects of type `Unknown | Basic` and `Basic`
- sympy/series/order.py:292:49: error[unsupported-operator] Unary operator `-` is not supported for object of type `Any | Basic | int | float | complex`
+ sympy/series/order.py:292:49: error[unsupported-operator] Unary operator `-` is not supported for object of type `Unknown | Basic`
- sympy/series/order.py:298:53: error[unsupported-operator] Unary operator `-` is not supported for object of type `Any | Basic | int | float | complex`
+ sympy/series/order.py:298:53: error[unsupported-operator] Unary operator `-` is not supported for object of type `Unknown | Basic`
- sympy/simplify/hyperexpand.py:1047:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1047:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic`
- sympy/simplify/hyperexpand.py:1048:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1048:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic`
- sympy/simplify/hyperexpand.py:1049:21: error[invalid-argument-type] Argument to bound method `pop` is incorrect: Expected `SupportsIndex`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1049:21: error[invalid-argument-type] Argument to bound method `pop` is incorrect: Expected `SupportsIndex`, found `Basic`
- sympy/simplify/hyperexpand.py:1088:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1088:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic`
- sympy/simplify/hyperexpand.py:1089:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1089:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic`
- sympy/simplify/hyperexpand.py:1090:21: error[invalid-argument-type] Argument to bound method `pop` is incorrect: Expected `SupportsIndex`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1090:21: error[invalid-argument-type] Argument to bound method `pop` is incorrect: Expected `SupportsIndex`, found `Basic`
- sympy/simplify/hyperexpand.py:1176:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1176:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic`
- sympy/simplify/hyperexpand.py:1177:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1177:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic`
- sympy/simplify/hyperexpand.py:1178:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1178:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic`
- sympy/simplify/hyperexpand.py:1179:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1179:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic`
- sympy/simplify/hyperexpand.py:1180:21: error[invalid-argument-type] Argument to bound method `pop` is incorrect: Expected `SupportsIndex`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1180:21: error[invalid-argument-type] Argument to bound method `pop` is incorrect: Expected `SupportsIndex`, found `Basic`
- sympy/simplify/hyperexpand.py:1214:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1214:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic`
- sympy/simplify/hyperexpand.py:1215:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1215:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic`
- sympy/simplify/hyperexpand.py:1216:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1216:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic`
- sympy/simplify/hyperexpand.py:1217:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1217:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic`
- sympy/simplify/hyperexpand.py:1218:21: error[invalid-argument-type] Argument to bound method `pop` is incorrect: Expected `SupportsIndex`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1218:21: error[invalid-argument-type] Argument to bound method `pop` is incorrect: Expected `SupportsIndex`, found `Basic`
- sympy/simplify/hyperexpand.py:1266:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1266:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic`
- sympy/simplify/hyperexpand.py:1267:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1267:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic`
- sympy/simplify/hyperexpand.py:1268:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1268:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic`
- sympy/simplify/hyperexpand.py:1269:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1269:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic`
- sympy/simplify/hyperexpand.py:1270:21: error[invalid-argument-type] Argument to bound method `pop` is incorrect: Expected `SupportsIndex`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1270:21: error[invalid-argument-type] Argument to bound method `pop` is incorrect: Expected `SupportsIndex`, found `Basic`
- sympy/simplify/hyperexpand.py:1314:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1314:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic`
- sympy/simplify/hyperexpand.py:1315:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1315:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic`
- sympy/simplify/hyperexpand.py:1316:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1316:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic`
- sympy/simplify/hyperexpand.py:1317:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1317:19: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `Basic`
- sympy/simplify/hyperexpand.py:1318:21: error[invalid-argument-type] Argument to bound method `pop` is incorrect: Expected `SupportsIndex`, found `Any | Basic | int | float | complex`
+ sympy/simplify/hyperexpand.py:1318:21: error[invalid-argument-type] Argument to bound method `pop` is incorrect: Expected `SupportsIndex`, found `Basic`
- sympy/simplify/simplify.py:357:10: error[unsupported-operator] Operator `/` is not supported between two objects of type `Any | Basic | int | float | complex`
+ sympy/simplify/simplify.py:357:10: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/simplify/sqrtdenest.py:431:25: error[unresolved-attribute] Attribute `subs` is not defined on `int`, `float`, `complex` in union `Basic | int | float | complex | Any`
- sympy/solvers/recurr.py:418:9: error[unresolved-attribute] Attribute `subs` is not defined on `int`, `float`, `complex` in union `Any | Basic | int | float | complex`
- sympy/solvers/recurr.py:418:9: error[unresolved-attribute] Attribute `expand` is not defined on `Basic` in union `Any | Basic`
+ sympy/solvers/recurr.py:418:9: error[unresolved-attribute] Object of type `Basic` has no attribute `expand`
- sympy/solvers/recurr.py:422:24: error[unresolved-attribute] Attribute `subs` is not defined on `int`, `float`, `complex` in union `Any | Basic | int | float | complex`
- sympy/solvers/recurr.py:437:24: error[unresolved-attribute] Attribute `subs` is not defined on `int`, `float`, `complex` in union `Any | Basic | int | float | complex`
- sympy/solvers/recurr.py:590:23: error[unresolved-attribute] Attribute `subs` is not defined on `int`, `float`, `complex` in union `Any | Basic | int | float | complex`
- sympy/solvers/tests/test_numeric.py:138:11: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/solvers/tests/test_solvers.py:723:19: error[unsupported-operator] Operator `-` is not supported between two objects of type `MatrixBase | Expr`
- sympy/solvers/tests/test_solvers.py:724:19: error[unsupported-operator] Operator `-` is not supported between two objects of type `MatrixBase | Expr`
- sympy/solvers/tests/test_solvers.py:725:19: error[unsupported-operator] Operator `-` is not supported between two objects of type `MatrixBase | Expr`
- sympy/solvers/tests/test_solvers.py:725:30: error[unsupported-operator] Operator `-` is not supported between two objects of type `MatrixBase | Expr`
- sympy/stats/tests/test_finite_rv.py:358:31: error[unsupported-operator] Operator `+` is not supported between objects of type `int | Basic | float | complex | Any` and `Literal[1]`
+ sympy/stats/tests/test_finite_rv.py:358:31: error[unsupported-operator] Operator `+` is not supported between objects of type `int | Basic` and `Literal[1]`
- sympy/stats/tests/test_finite_rv.py:362:32: error[unsupported-operator] Operator `*` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/stats/tests/test_finite_rv.py:362:32: error[unsupported-operator] Operator `*` is not supported between two objects of type `Basic`
- sympy/stats/tests/test_finite_rv.py:363:20: error[unsupported-operator] Operator `>` is not supported between objects of type `Basic | int | float | complex | Any` and `Literal[1]`
+ sympy/stats/tests/test_finite_rv.py:363:20: error[unsupported-operator] Operator `>` is not supported between objects of type `Basic` and `Literal[1]`
- sympy/stats/tests/test_finite_rv.py:364:46: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/stats/tests/test_finite_rv.py:364:46: error[unsupported-operator] Operator `/` is not supported between two objects of type `Basic`
- sympy/stats/tests/test_finite_rv.py:364:52: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | float | complex | Any`
+ sympy/stats/tests/test_finite_rv.py:364:52: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic`
- sympy/stats/tests/test_finite_rv.py:364:62: error[unsupported-operator] Operator `-` is not supported between two objects of type `Basic | int | 

... (truncated 108 lines) ...

@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 27, 2026

Memory usage report

Memory usage unchanged ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 27, 2026

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-await 0 40 0
invalid-return-type 0 1 0
type-assertion-failure 1 0 0
Total 1 41 0

Full report with detailed diff (timing results)

…type parameter list

Previously, the check for invalid typevar default references only looked for
typevars appearing *later* in the same type parameter list. This missed the case
where a typevar's default references a typevar that isn't in the list at all.

For example, `class Bad(Generic[Start2T, Stop2T, StepT])` where `Start2T`'s
default is `StopT` (a different typevar not in the class's parameter list) was
not flagged.

The fix replaces `contains_typevar` (checking specific later typevars) with
`find_typevar_not_in` (finding any typevar not in the set of earlier typevars).
This catches both later-in-list and not-in-list cases.

https://claude.ai/code/session_01CmptNs5MMq5fsoQr7Ahqai
… out of scope

When the referenced type variable is totally out of scope (not in the
class's type parameter list at all), we only show the secondary annotation
for the typevar with the bad default, not the out-of-scope one.

https://claude.ai/code/session_01CmptNs5MMq5fsoQr7Ahqai
@AlexWaygood AlexWaygood changed the title [ty] Validate type variable defaults don't reference later type parameters [ty] Validate type variable defaults don't reference later type parameters or type parameters out of scope Feb 27, 2026
@AlexWaygood AlexWaygood marked this pull request as ready for review February 27, 2026 23:32
@carljm carljm removed their request for review February 27, 2026 23:46
@AlexWaygood AlexWaygood merged commit 7015ea7 into main Feb 28, 2026
50 checks passed
@AlexWaygood AlexWaygood deleted the claude/fix-type-variable-ordering-LHT8Z branch February 28, 2026 14:27
AlexWaygood pushed a commit that referenced this pull request Feb 28, 2026
PR #23623 added class-level validation for type variable defaults
referencing out-of-scope type parameters. Remove the overlapping
class-specific code and tests from this branch, keeping only the
function and type alias scope checks.

https://claude.ai/code/session_018eEiLxueUR7nji1dChCRrm
AlexWaygood pushed a commit that referenced this pull request Feb 28, 2026
PR #23623 added class-level validation for type variable defaults
referencing out-of-scope type parameters. Remove the overlapping
class-specific code and tests from this branch, keeping only the
function and type alias scope checks.

https://claude.ai/code/session_018eEiLxueUR7nji1dChCRrm
carljm added a commit that referenced this pull request Mar 2, 2026
* main:
  [ty] Move binary expression logic out of `builder.rs` (#23649)
  [ty] Limit recursion depth when displaying self-referential function types (#23647)
  [ty] Move comparison logic out of `builder.rs` (#23646)
  Avoid inserting redundant `None` elements in UP045 (#23459)
  [ty] Add more ParamSpec validation for `P.args` and `P.kwargs` (#23640)
  [ty] Sync vendored typeshed stubs (#23642)
  [ty] Fix inference of `t.__mro__` if `t` is an instance of `type[Any]` (#23632)
  [ty] Detect inconsistent generic base class specializations (#23615)
  [ty] Validate type variable defaults don't reference later type parameters or type parameters out of scope (#23623)
  [ty] Ban nested `Required`/`NotRequired`, and ban them both outside of `TypedDict` fields (#23627)
  [ty] Reject generic metaclasses parameterized by type variables (#23628)
  Update default Python version examples (#23605)
  fix binops with NewType of float and Unknown (#23620)
  [ty] Reject functions with PEP-695 type parameters that shadow type parameters from enclosing scopes (#23619)
  [ty] Reject ellipsis literals in odd places in type/annotation expressions (#23611)
  [ty] hash-cons `UseDefMap` fields (#23283)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ecosystem-analyzer ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants