-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type bound error when instantiating signed integers at negative boundary #3394
Comments
Assigning Please vote with emojis if your project is affected by this bug. |
This is because the integer isn't We can add negative integer literals to fix this, I just wanted to explain the reason for this error. |
I have been looking into this and to add to Jake's comment, we translate -128 into 0-128. The expression 0-128 is invalid because it uses 128, although the original expression -128 is valid. |
# Description ## Problem\* Resolves #3394 ## Summary\* Add negative integer literals so that -128 becomes now a literal instead of a unary expression. ## 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
Instantiate signed integers at but not exceeding their negative type boundaries.
Expected Behavior
E.g. given
i8
's boundary goes from -128 to 127, both of the following examples should work:Bug
Proving (1) works.
While attempting to prove (2) gave:
This seems to only happen at the negative boundary, but not on the positive side.
Installation Method
Binary
Nargo Version
(Nightly)
nargo version = 0.18.0 noirc version = 0.18.0+a0985412594c5cbd35551afc7e94cb444723adb0 (git version hash: a098541, is dirty: false)
Additional Context
Discovered while drafting examples in #3393.
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: