-
Notifications
You must be signed in to change notification settings - Fork 198
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
Incoherence of default type casting in loops #3639
Labels
bug
Something isn't working
compiler frontend
`noirc_frontend` crate
good first issue
Good for newcomers
Comments
8 tasks
github-merge-queue bot
pushed a commit
that referenced
this issue
Feb 13, 2024
# Description Add a new `TypeVariableKind` specifically for Integers: until this PR, `IntegerOrField` is used. ## Problem\* May resolve #3639, #4290 ## Summary\* Adds the new `TypeVariableKind` - [x] Unify - [x] Test - [ ] Docs ## Additional Context ## Documentation\* Check one: - [ ] No documentation needed. - [x] 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. --------- Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> Co-authored-by: jfecher <jake@aztecprotocol.com>
5 tasks
github-merge-queue bot
pushed a commit
that referenced
this issue
Feb 22, 2024
# Description ## Problem\* Resolves #3639 Resolves #4193 ## Summary\* Uses the new TypeVariableKind::Integer in for loops and bitwise operations to prevent `Field` types from being used there. Removes the old `delayed_type_checks` hack. ## 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. --------- Co-authored-by: kevaundray <kevtheappdev@gmail.com> Co-authored-by: TomAFrench <tom@tomfren.ch>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
compiler frontend
`noirc_frontend` crate
good first issue
Good for newcomers
Aim
While trying to use the loop index for a comparison, I ran into an error :
This code will not compile either with nargo 0.19.2 or an older version. The error is as follows :
Expected Behavior
We expect both loop index and hardcoded values to default to
u64
in order to seamlessly use them to do comparisons.Bug
There are 2 ways to make this code compile with Nargo:
Option 1 : explicitly declare loop indexes
i
andj
asu64
, though they are supposed to default tou64
if no other type is specified. In this situation,8
which is of typeTypeVariableKind::IntegerOrField
, seems to default to u64 only if we explicitly declarei
andj
asu64
.Option 2 : explicitly declare
8
value to a u64 type, which is supposed to default to afield
type if no other type is specified. In this situation,i
andj
are treated likeu64
by default.Installation Method
Noirup
Nargo Version
nargo 0.19.2 and older versions
Would you like to submit a PR for this Issue?
Yes
The text was updated successfully, but these errors were encountered: