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

Encapsulate Unit return check #1438

Closed
Tracked by #1376
joss-aztec opened this issue May 30, 2023 · 6 comments
Closed
Tracked by #1376

Encapsulate Unit return check #1438

joss-aztec opened this issue May 30, 2023 · 6 comments
Labels
enhancement New feature or request refactor ssa

Comments

@joss-aztec
Copy link
Contributor

Problem

Acir gen contains a brittle check for inferring whether or not a function returns Unit, which could be overlooked if the underlying representation changed. This check should be encapsulated.

Happy Case

Kev's suggestion

Alternatives Considered

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@jfecher
Copy link
Contributor

jfecher commented Jun 8, 2023

We should remove this check entirely and instead remove all unit values from the ssa form since they will never be used in operations. This would be similar to rust's elision of zero-sized types.

@joss-aztec
Copy link
Contributor Author

So we'd instead infer the program returns no value by checking return_values.len() == 0?

@jfecher
Copy link
Contributor

jfecher commented Jun 8, 2023

Right, and I think that'd be more straightforward as well.

@jfecher
Copy link
Contributor

jfecher commented Jun 8, 2023

Looking at the check in question though, we wouldn't need it at all since the loop afterward would just loop 0 times

@joss-aztec
Copy link
Contributor Author

@jfecher, do you still hope to remove unit values?

@joss-aztec
Copy link
Contributor Author

Closing, as this has been addressed by #1646

@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor ssa
Projects
Archived in project
Development

No branches or pull requests

2 participants