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
fnfoo<letN:u32>() -> [u8;N]{[0;N]}fnbar<letN:u32>() -> [u8;N]{foo::<N>()}
global M:u32 = 3;fnmain(){println(bar::<M>());}
Expected Behavior
Program to compile and execute successfully.
Note in the workaround that using turbofish for bar in main works.
Bug
error: expected type, found numeric generic parameter N
┌─ /Users/michaelklein/Coding/noir/bug_from_regex/src/main.nr:6:11
│
6 │ foo::<N>()
│ - not a type
│
To Reproduce
Project Impact
Blocker
Impact Context
Medium-blocker: there's a lot of code that uses numeric generics and the workarounds are fairly heavy
Workaround
Yes
Workaround Description
Phantom data that's expected to compile to () can be passed around:
…5448)
# Description
## Problem\*
Resolves#5442
## Summary\*
In #5155 we make sure that we make sure we resolve against the correct
type kind in various places such as when resolving trait bound generics
or trait impl generics. This was not done for function calls. Now when
resolving turbofish generics, rather than calling `resolve_type` in all
cases aside type expressions, we check whether the variable we are
elaborating is a function and fetch its already resolved generics and
pass that in as the expected kind.
To keep the resolution logic the simple (I just zipped together the
`direct_generics` from the function meta and the user specified
turbofish generics), as `zip` uses the shortest iterator, I also added
two checks for whether we have the correct turbofish count. We now have
multiple of these checks rather than in just `instantiate`, but I felt
it was the simplest logic and would lead to the least potential future
confusion.
I also have expanded the bug identified in the issue to also include
turbofish generics for method calls. I have also included this as part
of my test for this PR.
## Additional Context
## Documentation\*
Check one:
- [X] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** 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: jfecher <jake@aztecprotocol.com>
Aim
Expected Behavior
Program to compile and execute successfully.
Note in the workaround that using turbofish for
bar
inmain
works.Bug
To Reproduce
Project Impact
Blocker
Impact Context
Medium-blocker: there's a lot of code that uses numeric generics and the workarounds are fairly heavy
Workaround
Yes
Workaround Description
Phantom data that's expected to compile to
()
can be passed around:Additional Context
No response
Installation Method
Compiled from source
Nargo Version
nargo version = 0.31.0 noirc version = 0.31.0+b58a034a36dab6d17e10f2fcceab93e9073f53ed (git version hash: b58a034, is dirty: false)
NoirJS Version
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered: