-
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
Assert statements can only accept string literals #3113
Comments
@vezenovm this seems related to the runtime error messages we mentioned before |
5 tasks
github-merge-queue bot
pushed a commit
that referenced
this issue
Feb 1, 2024
# Description ## Problem\* Resolves #3113 ## Summary\* The first major change is a new MacroProcessor that generates an oracle and the respective unconstrained oracle wrapper for resolving assert message expressions. This was done as to prevent exposing the resolve assert message funcs in the stdlib directly. Before an assertion with a dynamic assert message we perform a foreign call out to the user with the format-string and the values to be formatted. The user must then return what the assert message should look like. This is then cached on by nargo when executing the ACVM and should the next opcode fail to execute then this error message will be returned to the user. We now require end-users (people running ACVM) to format their own assert messages. Example output for `assert_msg_runtime` test: <img width="737" alt="Screenshot 2024-01-23 at 4 07 18 PM" src="https://github.com/noir-lang/noir/assets/43554004/96879ab1-5192-4b01-b798-4a63631bd270"> Assert message still work in the stdlib as expected: <img width="780" alt="Screenshot 2024-01-23 at 4 43 47 PM" src="https://github.com/noir-lang/noir/assets/43554004/1ad0c00b-7d5f-4a3f-94d8-955589f487c2"> Output for debug logs when putting `assert(x == y, struct_string);` on line 48 immediately following `std::println(struct_string);`: <img width="1040" alt="Screenshot 2024-01-23 at 4 47 55 PM" src="https://github.com/noir-lang/noir/assets/43554004/6a8220b8-dd19-4e1b-b360-976a6952a36f"> ## 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: Tom French <tom@tomfren.ch>
github-merge-queue bot
pushed a commit
that referenced
this issue
Feb 1, 2024
# Description ## Problem\* #4101 resolves #3113 which was preventing an expect function on our Option struct. ## Summary\* This adds an `expect` method and a test inside of `compile_failure`. Here is the example for the test under `compile_failure/option_expect`: <img width="716" alt="Screenshot 2024-01-31 at 11 12 51 AM" src="https://github.com/noir-lang/noir/assets/43554004/1a84d489-bd7f-446a-96be-ebf63ae63f47"> ## 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: Tom French <tom@tomfren.ch>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Aim
Trying to write an
Option::expect
method:Expected Behavior
The function to typecheck and execute properly.
Bug
To Reproduce
Installation Method
None
Nargo Version
No response
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: