Skip to content

Fix truediv type-checking for ValueType2#88

Merged
NoureldinYosri merged 1 commit into
quantumlib:mainfrom
dstrain115:truediv_fix
May 6, 2026
Merged

Fix truediv type-checking for ValueType2#88
NoureldinYosri merged 1 commit into
quantumlib:mainfrom
dstrain115:truediv_fix

Conversation

@dstrain115
Copy link
Copy Markdown
Collaborator

  • ValueType2 (the generic parameter of ValueArray ) was defined as invariant.
  • This prevents FrequencyArray (which is ValueArray[Frequency]) from being compatible with ValueArray[Value].
  • As a result, mypy could not match the truediv operator on ValueArray and fell back to Value.rtruediv , which also failed.

Fixes internal bug b/507121233

- ValueType2  (the generic parameter of ValueArray ) was defined as invariant.
- This prevents FrequencyArray (which is ValueArray[Frequency]) from being
compatible with ValueArray[Value].
- As a result,  mypy could not match the  __truediv__  operator on
ValueArray  and fell back to Value.__rtruediv__ , which also failed.

Fixes internal bug b/507121233
@dstrain115 dstrain115 requested a review from NoureldinYosri May 6, 2026 16:34
@NoureldinYosri NoureldinYosri merged commit 1cad8f9 into quantumlib:main May 6, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants