ruff
a2f546b2 - [ty] Infer precise types for bit-shift operations on integer literals (#23301)

Commit
3 days ago
[ty] Infer precise types for bit-shift operations on integer literals (#23301) ## Summary Fixes https://github.com/astral-sh/ty/issues/517. This PR revives https://github.com/astral-sh/ruff/pull/18329 / https://github.com/astral-sh/ruff/pull/19281, but without the controversial bit of those PRs (the new diagnostic). Rather than adding a new diagnostic if an integer is left-shifted or right-shifted by a negative number, we just ignore that and infer `int`. We can always add a new diagnostic later, if we find consensus on it. Along the way, Claude also discovered that `reveal_type(-(-9223372036854775807 - 1))` currently reveals `Literal[-9223372036854775808]` on `main`, which is... not correct. So this PR fixes that too. ### Test Coverage mdtests Co-authored-by: Brandt Bucher <brandt@python.org>
Author
Parents
Loading