-
Notifications
You must be signed in to change notification settings - Fork 200
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
fix: Fix methods not mutating fields #2087
Merged
Merged
Conversation
This file contains 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
6 tasks
vezenovm
approved these changes
Jul 31, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I assume you went with this approach as it was simpler than inserting implicit dereferences in some cases and not in others as you would have to track member accesses.
TomAFrench
added a commit
that referenced
this pull request
Aug 1, 2023
* master: (53 commits) chore: Update `noir-source-resolver` to v1.1.3 (#1912) chore: Document `GeneratedAcir::more_than_eq_comparison` (#2085) chore: refresh ACIR test artifacts (#2091) feat: Add `deprecated` attribute (#2041) chore(ssa refactor): Implement `acir_gen` errors (#2071) chore: use witnesses from the generated acir in the ABI (#2095) fix: Fix methods not mutating fields (#2087) chore(nargo): Use Display impl for InputValue (#1990) feat: Make arrays and slices polymorphic over each other (#2070) feat: Remove an unnecessary witness in `mul_with_witness` (#2078) chore: document truncate (#2082) fix: avoid potential panic in `two_complement` (#2081) chore: Cleanup integration tests (#2074) chore: replace `Type::TypeVariable`, `Type::PolymorphicInteger`, and … (#2065) chore!: Require package names in `Nargo.toml` files (#2056) fix: Avoid non-determinism in defunctionalization (#2069) chore: change 'unnecessary pub' error to a warning (#2064) feat!: Update to ACVM 0.21.0 (#2051) chore: Rename execute tests for an accurate description (#2063) chore: Restore lost integration test (#2062) ...
TomAFrench
added a commit
that referenced
this pull request
Aug 1, 2023
* master: (75 commits) fix: Mutating a variable no longer mutates its copy (#2057) fix: Implement `.len()` in Acir-Gen (#2077) chore: clippy fixes (#2101) chore: Update `noir-source-resolver` to v1.1.3 (#1912) chore: Document `GeneratedAcir::more_than_eq_comparison` (#2085) chore: refresh ACIR test artifacts (#2091) feat: Add `deprecated` attribute (#2041) chore(ssa refactor): Implement `acir_gen` errors (#2071) chore: use witnesses from the generated acir in the ABI (#2095) fix: Fix methods not mutating fields (#2087) chore(nargo): Use Display impl for InputValue (#1990) feat: Make arrays and slices polymorphic over each other (#2070) feat: Remove an unnecessary witness in `mul_with_witness` (#2078) chore: document truncate (#2082) fix: avoid potential panic in `two_complement` (#2081) chore: Cleanup integration tests (#2074) chore: replace `Type::TypeVariable`, `Type::PolymorphicInteger`, and … (#2065) chore!: Require package names in `Nargo.toml` files (#2056) fix: Avoid non-determinism in defunctionalization (#2069) chore: change 'unnecessary pub' error to a warning (#2064) ...
TomAFrench
added a commit
that referenced
this pull request
Aug 1, 2023
* master: (75 commits) fix: Mutating a variable no longer mutates its copy (#2057) fix: Implement `.len()` in Acir-Gen (#2077) chore: clippy fixes (#2101) chore: Update `noir-source-resolver` to v1.1.3 (#1912) chore: Document `GeneratedAcir::more_than_eq_comparison` (#2085) chore: refresh ACIR test artifacts (#2091) feat: Add `deprecated` attribute (#2041) chore(ssa refactor): Implement `acir_gen` errors (#2071) chore: use witnesses from the generated acir in the ABI (#2095) fix: Fix methods not mutating fields (#2087) chore(nargo): Use Display impl for InputValue (#1990) feat: Make arrays and slices polymorphic over each other (#2070) feat: Remove an unnecessary witness in `mul_with_witness` (#2078) chore: document truncate (#2082) fix: avoid potential panic in `two_complement` (#2081) chore: Cleanup integration tests (#2074) chore: replace `Type::TypeVariable`, `Type::PolymorphicInteger`, and … (#2065) chore!: Require package names in `Nargo.toml` files (#2056) fix: Avoid non-determinism in defunctionalization (#2069) chore: change 'unnecessary pub' error to a warning (#2064) ...
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 #1887
Summary*
This problem was conceptually difficult to fix for a few reasons since it stemmed from the otherwise desired behavior of automatically inserting dereferences when accessing a field of a struct through a mutable reference. In the end I went with the somewhat hacky approach of remembering which dereferences were implicitly inserted and removing one after the fact if needed. We must only remove implicitly inserted dereferences of course because it is valid semantics for the user to explicitly dereference and call a method as
(*foo).bar.mutate()
to explicitly work on a copy rather than mutatingfoo
.Documentation
This PR requires documentation updates when merged.
Additional Context
PR Checklist*
cargo fmt
on default settings.