Skip to content

Conversation

@hauntsaninja
Copy link
Collaborator

@hauntsaninja hauntsaninja commented Feb 8, 2026

Fixes #20733

I might make this type munging look a little nicer in a future refactor

This introduces new errors in two primer projects

@github-actions
Copy link
Contributor

github-actions bot commented Feb 8, 2026

Diff from mypy_primer, showing the effect of this PR on open source code:

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/ext/csgo/state.py:213: error: Argument 1 to "__delitem__" of "dict" has incompatible type "int"; expected "AssetID"  [arg-type]
+ steam/ext/csgo/state.py:214: error: Argument 1 to "__delitem__" of "dict" has incompatible type "int"; expected "AssetID"  [arg-type]

rotki (https://github.com/rotki/rotki)
- rotkehlchen/chain/evm/decoding/zerox/decoder.py:146: error: Unused "type: ignore" comment  [unused-ignore]
- rotkehlchen/chain/ethereum/modules/sky/decoder.py:147: error: Unused "type: ignore" comment  [unused-ignore]

@hauntsaninja
Copy link
Collaborator Author

rotki was fixed in #20492 and is regressed here
steam was fixed in #20602 and is regressed here

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Are you planning to address the regressions in this PR, or should we merge this as is, since this fixes a more important regression?


def f2(whatever: object, uid: UserId | Other):
if whatever == uid:
reveal_type(whatever) # N: Revealed type is "builtins.int | __main__.Other"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a bit questionable, since whatever could be float or another numeric type that happens to compare equal to int (not directly related to the changes in this PR).

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.

Regression: Type of literal narrowed when asserting equality to a NewType

2 participants