-
Notifications
You must be signed in to change notification settings - Fork 66
Open
Labels
A-semaArea: semantic analysisArea: semantic analysisC-bugCategory: this is a bugCategory: this is a bug
Description
Expressions such as -1 are parsed as a UnaryOp and a positive IntLiteral.
Two directions we can go in:
- When parsing
-, we could peek and see if the next peeled literal is an integer literal, which we then construct as negative (preferred) - We remove
negativefromIntegerLiteraland resolve this later
Test cases:
contract C {
function f() public {
int8 a = -1; // negative int literal
int8 b = -(1); // should be peeled and turned into a negative int literal
int8 c = -(-1); // unary op negate, negative int literal
int8 d = -(1 + 2); // unary op negate, binop of two positive int literals
}
}mablr
Metadata
Metadata
Assignees
Labels
A-semaArea: semantic analysisArea: semantic analysisC-bugCategory: this is a bugCategory: this is a bug