Skip to content

Incorrect literal math for bitwise inversions of >32-bit operands #10834

@correctmost

Description

@correctmost

Describe the bug
Pyright calculates incorrect values when performing bitwise inversions of ints outside of the signed 32-bit range.

Code or Screenshots

reveal_type(~2147483648)  # Type of "~2147483648" is "Literal[2147483647]"

VS Code extension or command-line
Command-line version 1.1.404

Metadata

Metadata

Assignees

No one assigned

    Labels

    addressed in next versionIssue is fixed and will appear in next published versionbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions