Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in .copyUi() where environment objects within the UI were being shallow-copied instead of deep-copied. When environments like $meta contained nested environments (such as sigma or thetaMat), modifications to a renamed copy would inadvertently affect the original UI object.
Changes:
- Introduced recursive
.copyEnv()function to deep copy environments and their nested environment contents - Updated
.copyUi()to use.copyEnv()for environment items instead of shallow copying - Added comprehensive test case verifying that
rxRename()no longer modifies the parent UI
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| R/piping.R | Added .copyEnv() helper function for recursive environment copying and updated .copyUi() to deep copy nested environments |
| tests/testthat/test-ui-rename.R | Added test case with complex model containing nested environments to verify deep copy behavior |
| R/ui-assign-parts.R | Code style improvements: added braces to single-line if statements |
| R/ui-rename.R | Removed obsolete comment and reformatted error message for better readability |
| man/reexports.Rd | Removed %fin% and %!fin% reexports from fastmatch package |
| NEWS.md | Added entry documenting the .copyUi() bug fix |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
Author
|
@copilot open a new pull request to apply changes based on the comments in this thread |
Contributor
|
@mattfidler I've opened a new pull request, #987, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: mattfidler <514778+mattfidler@users.noreply.github.com>
Fix infinite recursion in `.copyEnv()` on circular environment references
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.
Fix the copy ui so that it does a deep copy for the $meta environment or other environments that show up.