Skip to content
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

return an error instead of panicking (#419) #672

Closed
wants to merge 1 commit into from
Closed

Conversation

guipublic
Copy link
Contributor

Related issue(s)

Resolves #419

Description

Summary of changes

We return an error instead of unreachable!() when trying to compute with a non supported field operation

Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt with default settings.
  • I have linked this PR to the issue(s) that it resolves.
  • I have reviewed the changes on GitHub, line by line.
  • I have ensured all changes are covered in the description.

Additional context

Note that the error is less user-friendly than the previous panic message, this is because errors with no location do not print the secondary message.

@jfecher
Copy link
Contributor

jfecher commented Jan 23, 2023

let z: Field = 2 << 2;

I believe we've discussed previously that bitwise operations are unsupported in general on Fields and that this should be a type error. Let me know if my memory of this is correct. If so, I can put up a PR adding a more user friendly type error and suggest the user casts to an integer type beforehand as well.

@jfecher
Copy link
Contributor

jfecher commented Jan 27, 2023

This should no longer be needed now that #687 is merged. I'd expect this condition to be unreachable for bitwise operators now but haven't tested thoroughly.

@kevaundray
Copy link
Contributor

Closing as this has been handled on the frontend, so the ssa pass can assume that it won't ever happen

@kevaundray kevaundray closed this Feb 11, 2023
@kevaundray kevaundray deleted the gd/issue_419 branch February 11, 2023 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proof creation involving bit shift results in runtime error
3 participants