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

Allow casting bools to integers (and vice-versa) #278

Merged
merged 6 commits into from
Jul 18, 2022
Merged

Allow casting bools to integers (and vice-versa) #278

merged 6 commits into from
Jul 18, 2022

Conversation

jfecher
Copy link
Contributor

@jfecher jfecher commented Jul 14, 2022

Fixes #277.

It also turns out we never parsed the bool type either, so I added support for parsing it.

Bool was also the only primitive type not to have constness tracked so I added that as well. Previously if you had a constant and casted it to a boolean and back the compiler would treat it as non-const. Now it will correctly recognize it as still const and allow it to be used as an index.

Copy link
Contributor

@kevaundray kevaundray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some changes to be made

vezenovm
vezenovm previously approved these changes Jul 14, 2022
Copy link
Contributor

@vezenovm vezenovm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks to work functionally. Made a basic Noir example using this branch's nargo build that follows the one Kev wrote in issue #277

@vezenovm vezenovm mentioned this pull request Jul 14, 2022
* cast bool example

* remove proofs folder in example, accidentally committed
@guipublic
Copy link
Contributor

It's OK for me, I let @kevaundray validate it because it's mostly frontend.

@jfecher jfecher merged commit 2458478 into master Jul 18, 2022
@jfecher jfecher deleted the jf/bools branch July 18, 2022 19:43
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.

Allow casting from a boolean to an integer
4 participants