fix: No longer error on INT_MIN globals#7519
Merged
Conversation
asterite
reviewed
Feb 25, 2025
asterite
reviewed
Feb 25, 2025
asterite
approved these changes
Feb 25, 2025
Collaborator
asterite
left a comment
There was a problem hiding this comment.
Looks great! I left a couple of comments.
Collaborator
|
Sorry, scrolling through the page or something I clicked "Update branch" though it wasn't needed... |
AztecBot
pushed a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Feb 26, 2025
fix: No longer error on INT_MIN globals (noir-lang/noir#7519) fix: correctly format trait function with multiple where clauses (noir-lang/noir#7531) chore(ssa): Do not run passes on Brillig functions post Brillig gen (noir-lang/noir#7527)
TomAFrench
pushed a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Feb 26, 2025
Automated pull of development from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore!: bump msrv to 1.85.0 (noir-lang/noir#7530) fix: No longer error on INT_MIN globals (noir-lang/noir#7519) fix: correctly format trait function with multiple where clauses (noir-lang/noir#7531) chore(ssa): Do not run passes on Brillig functions post Brillig gen (noir-lang/noir#7527) END_COMMIT_OVERRIDE --------- Co-authored-by: guipublic <guipublic@gmail.com> Co-authored-by: guipublic <47281315+guipublic@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem*
Resolves #7506
Resolves #7324
This PR also possibly improves some error messages which previously displayed negative integer values as a negated field value (a large number) - these will now show an actual negative sign and integer value. I don't expect this to be a noticeable change however since there's a check on
FieldElement::displayto just display the value as negative if that value is smaller (in terms of string characters).Summary*
Allow INT_MIN globals by properly handling negatives by refactoring the frontend to use
SignedFieldinstead ofFieldElement, boolpairs.Additional Context
One advantage I noticed while using SignedField was that I was able to refactor several separate conversion functions we had (mostly in the interpreter) from SignedField to various signed and unsigned integer types into one place. Before we had written these conversions several times and some handled INT_MIN properly while others did not. Now there are conversion methods on
SignedFielditself.Some future improvements we could do that I did not tackle in this PR:
Type::Constantstill holds aFIeldElementrather than aSignedField. I think refactoring it to handle negatives was beyond the scope of this PR, although theoretically it should be easier in the future once we have the following point.Type::Constantalthough the later is only on Fields). This feels like something that should be on SignedField itself (sans error reporting).Documentation*
Check one:
PR Checklist*
cargo fmton default settings.