fix(mir): make BackLink parent removal precise #531
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.
Describe your changes
BackLink implements PartialEq as always true so that backlink fields are ignored in derived equality and hashing. However,
remove_parent in MIR ops compared BackLink values directly:
Because of the always-true PartialEq, this predicate was always false and effectively cleared the entire parents vector instead of removing only the requested parent.
This change updates all remove_parent implementations for ops that use parents: Vec<BackLink> to compare against the upgraded Link via to_link(), keeping BackLink’s structural Eq/Hash semantics intact while making parent removal semantically correct.