Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Unary operations on literals #1791
What I did
Fixed some issues with negating constants.
The following example was failing because bounds checks caught
@public def foo() -> int128: return -2**127
The following example was also failing with a clamping error:
a: constant(decimal) = 1.1 @public def foo() -> decimal: return -a
How I did it
When an unary operation is applied to a constant, return the negated value without applying bounds checks on the original value.
How to verify it
Run the tests. I added some new test cases to verify that the issue is fixed.
Cute Animal Picture