Preserve identifiers when reconstructing a tag which sets a value#988
Merged
jasmith-hs merged 6 commits intomasterfrom Jan 12, 2023
Merged
Preserve identifiers when reconstructing a tag which sets a value#988jasmith-hs merged 6 commits intomasterfrom
jasmith-hs merged 6 commits intomasterfrom
Conversation
… preserve identifiers when setting to an updatable value
This was referenced Jan 12, 2023
jasmith-hs
added a commit
that referenced
this pull request
Jan 17, 2023
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.
When reconstructing a tag which has the function of setting a variable to the result of an expression (both
setandfordo this), we should preserve the AstIdentifiers in the expression rather than resolving them because they may be directly referencing a value which can be modified later on. If instead, we set our variable to a serialized version of the object, then if that object is modified, the changes will not be reflected in the set value.The simplest example of this is shown in one of the new tests:
If we don't preserve the identifier for
dict, then we end up with:Which would result in
foonot having the correct value within it!I realised that this can also happen if a value is reconstructed and then later one of the elements inside of that value is updated. Such a case is much more difficult to handle. I created a separate issue for that: #987