Skip to content

[ty] Fix unary operator false-positive for constrained TypeVars#22783

Merged
charliermarsh merged 1 commit intomainfrom
charlie/con-3
Jan 23, 2026
Merged

[ty] Fix unary operator false-positive for constrained TypeVars#22783
charliermarsh merged 1 commit intomainfrom
charlie/con-3

Conversation

@charliermarsh
Copy link
Member

Summary

An extension of #22782.

@charliermarsh charliermarsh added bug Something isn't working ty Multi-file analysis & type inference labels Jan 21, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 21, 2026

Typing conformance results

No changes detected ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 21, 2026

mypy_primer results

Changes were detected when running on open source projects
sympy (https://github.com/sympy/sympy)
- sympy/polys/domains/gaussiandomains.py:73:25: error[invalid-argument-type] Argument to bound method `new` is incorrect: Argument type `MPZ | MPQ` does not satisfy constraints (`MPZ`, `MPQ`) of type variable `Tdom`
- sympy/polys/domains/gaussiandomains.py:73:25: error[unsupported-operator] Unary operator `-` is not supported for object of type `Tdom@GaussianElement`
- sympy/polys/domains/gaussiandomains.py:73:34: error[invalid-argument-type] Argument to bound method `new` is incorrect: Argument type `MPZ | MPQ` does not satisfy constraints (`MPZ`, `MPQ`) of type variable `Tdom`
- sympy/polys/domains/gaussiandomains.py:73:34: error[unsupported-operator] Unary operator `-` is not supported for object of type `Tdom@GaussianElement`
- Found 15643 diagnostics
+ Found 15639 diagnostics

rotki (https://github.com/rotki/rotki)
- rotkehlchen/chain/decoding/tools.py:96:44: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- rotkehlchen/chain/decoding/tools.py:99:13: error[invalid-argument-type] Argument to function `decode_transfer_direction` is incorrect: Expected `Sequence[A@BaseDecoderTools]`, found `Unknown | tuple[BTCAddress, ...] | tuple[ChecksumAddress, ...] | tuple[SubstrateAddress, ...] | tuple[SolanaAddress, ...]`
- rotkehlchen/chain/decoding/tools.py:100:62: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ rotkehlchen/chain/decoding/tools.py:97:13: error[invalid-argument-type] Argument to function `decode_transfer_direction` is incorrect: Expected `BTCAddress | ChecksumAddress | SubstrateAddress | SolanaAddress`, found `A@BaseDecoderTools`
+ rotkehlchen/chain/decoding/tools.py:98:13: error[invalid-argument-type] Argument to function `decode_transfer_direction` is incorrect: Expected `BTCAddress | ChecksumAddress | SubstrateAddress | SolanaAddress | None`, found `A@BaseDecoderTools | None`
- Found 2052 diagnostics
+ Found 2051 diagnostics

core (https://github.com/home-assistant/core)
+ homeassistant/util/variance.py:47:12: error[invalid-return-type] Return type does not match returned value: expected `(**_P@ignore_variance) -> _R@ignore_variance`, found `_Wrapped[_P@ignore_variance, int | _R@ignore_variance | float | datetime, _P@ignore_variance, _R@ignore_variance | int | float | datetime]`
- Found 14466 diagnostics
+ Found 14467 diagnostics

No memory usage changes detected ✅

@charliermarsh charliermarsh marked this pull request as ready for review January 23, 2026 18:49
Base automatically changed from charlie/con-2 to main January 23, 2026 20:31
@charliermarsh charliermarsh enabled auto-merge (squash) January 23, 2026 20:48
@charliermarsh charliermarsh merged commit a2b0e7a into main Jan 23, 2026
48 checks passed
@charliermarsh charliermarsh deleted the charlie/con-3 branch January 23, 2026 20:53
carljm added a commit that referenced this pull request Jan 30, 2026
* main: (62 commits)
  [`refurb`] Do not add `abc.ABC` if already present (`FURB180`) (#22234)
  [ty] Add a new `assert-type-unspellable-subtype` diagnostic (#22815)
  [ty] Avoid duplicate syntax errors for `await` outside functions (#22826)
  [ty] Fix unary operator false-positive for constrained TypeVars (#22783)
  [ty] Fix binary operator false-positive for constrained TypeVars (#22782)
  [ty] Fix false-positive `unsupported-operator` for "symmetric" TypeVars (#22756)
  [`pydocstyle`] Clarify which quote styles are allowed (`D300`) (#22825)
  [ty] Use distributed versions of AND and OR on constraint sets (#22614)
  [ty] Add support for dict literals and dict() calls as default values for parameters with TypedDict types (#22161)
  Document `-` stdin convention in CLI help text (#22817)
  [ty] Make `infer_subscript_expression_types` a method on `Type` (#22731)
  [ty] Simplify `OverloadLiteral::spans` and `OverloadLiteral::parameter_span` (#22823)
  [ty] Require both `*args` and `**kwargs` when calling a `ParamSpec` callable (#22820)
  [ty] Handle tagged errors in conformance (#22746)
  Add `--color` cli option to force colored output (#22806)
  Identify notebooks by LSP didOpen instead of `.ipynb` file extension (#22810)
  [ty] Fix docstring rendering for literal blocks after doctests (#22676)
  [ty] Update salsa to fix out-of-order query validation (#22498)
  [ty] Inline cycle initial and recovery functions (#22814)
  [ty] Pass the generic context through the decorator (#22544)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants