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
It isn't possible to pass a mutable reference from a constrained function into an unconstrained one since any mutations performed on it wouldn't be reflected back in the constrained function. For this reason, passing a mutable reference through this boundary is banned, although we should issue a compiler error rather than panic here.
# Description
## Problem\*
Resolves#4245
## Summary\*
This adds a type check for call expressions to check the arguments of a
call to an unconstrained function from a constrained function. As we
have two different runtime environments this makes type checking a bit
more complicated. As a followup to this PR we could try and catch the
error added here (#4280) sooner.
However, if the unconstrained function uses generics we must still fall
back to the "type check" in SSA/ACIR gen from PR #4280.
This PR now errors for the snippet in issue with the below using `nargo
check`:
<img width="900" alt="Screenshot 2024-02-06 at 3 36 27 PM"
src="https://github.com/noir-lang/noir/assets/43554004/6c037458-3182-4ea4-8470-050a1734b875">
## Additional Context
## Documentation\*
Check one:
- [ ] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[Exceptional Case]** Documentation to be submitted in a separate
PR.
# PR Checklist\*
- [ ] I have tested the changes locally.
- [ ] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
Aim
Trying to work around #4244
Code:
Expected Behavior
no crash. Sad face.
Bug
compiler crashes
To Reproduce
Installation Method
None
Nargo Version
0.23.0
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: