You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first example works as expected because -1 is not a valid u8 number. Rust behaves similarly.
The second example does not work either because execution is failing. However it compiles fine as you indicate.
So the issue here is that the second example compiles.
# Description
## Problem\*
Resolves#3649
## Summary\*
Forbid negation of unsigned integers
## Additional Context
## Documentation\*
Check one:
- [X] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[Exceptional Case]** Documentation to be submitted in a separate
PR.
# PR Checklist\*
- [X] I have tested the changes locally.
- [X] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
Aim
To be able to write:
Expected Behavior
That both examples compile and work in the exact same way.
Bug
Instead, a compilation error is thrown:
error: u8 cannot be used in a unary operation
Yet doing:
compiles and executes as expected with the previous code.
To Reproduce
See notes above
Installation Method
None
Nargo Version
nargo 0.19.4
Additional Context
No response
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered: