-
Notifications
You must be signed in to change notification settings - Fork 187
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
fix: Allow macros to change types on each iteration of a comptime loop #6105
Conversation
Changes to Brillig bytecode sizes
There are no changes in circuit sizes |
As another consequence of this, the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I also tried on the code I have in Aztec-Packages and it works fine.
…comptime loop (noir-lang/noir#6105) chore: Schnorr signature verification in Noir (noir-lang/noir#5437) feat: Implement solver for mov_registers_to_registers (noir-lang/noir#6089)
noir-lang/noir#6105) chore: Schnorr signature verification in Noir (noir-lang/noir#5437) feat: Implement solver for mov_registers_to_registers (noir-lang/noir#6089)
Automated pull of development from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE fix: Allow macros to change types on each iteration of a comptime loop (noir-lang/noir#6105) chore: Schnorr signature verification in Noir (noir-lang/noir#5437) feat: Implement solver for mov_registers_to_registers (noir-lang/noir#6089) END_COMMIT_OVERRIDE --------- Co-authored-by: sirasistant <sirasistant@gmail.com> Co-authored-by: TomAFrench <tom@tomfren.ch>
Description
Problem*
Resolves #6086 (comment)
Summary*
Allows macros to have differing result types on different loop iterations again after it was banned by the unification in #6086.
This is a difficult feature to use since users will still have to work around the type system only type checking loops once. The recommended technique found for this PR is to delay type checks by quoting the relevant function calls that need to be re-typechecked so that when they are unquoted by the interpreter they are forced to be typechecked every loop iteration.
The downside of this is that it requires some knowledge of when to do this. If we go back to the naive approach of
comptime_change_type_each_loop_iteration
before the quoting:We get a confusing error now that the unification is gone: "Non-integer array length
_
" pointing to the body offrom_signature
. The fix for this is to quote & unquote thefrom_signature
call:But there's nothing telling users this. Ideally we could warn users when a type changes like this and perhaps have them opt-in to it with a "I know what I'm doing" of some kind.
Additional Context
Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.