Skip to content

parser: negate uint operands - #19

Merged
rameel merged 1 commit into
mainfrom
parser/negate-uint
Nov 17, 2026
Merged

rameel merged 1 commit into
mainfrom
parser/negate-uint

Conversation

@rameel

@rameel rameel commented Nov 17, 2026

Copy link
Copy Markdown
Owner

The unary minus converted a uint operand to long and returned the conversion without the negation. As a result, -1u evaluated to 1, and -3000000000, whose literal is of type uint, to 3000000000.

This PR negates the operand after the conversion, so -x for a uint operand produces a negative long, as in C#. The special cases for -2147483648 and -9223372036854775808 are not affected.

The unary minus converted a uint operand to long and returned the
conversion without the negation. As a result, '-1u' evaluated to 1,
and '-3000000000', whose literal is of type uint, to 3000000000.

Negate the operand after the conversion, so the result is a negative
long, as in C#.
@rameel
rameel merged commit 9f03e9e into main Nov 17, 2026
1 check passed
@rameel
rameel deleted the parser/negate-uint branch November 17, 2026 18:31
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.

1 participant