fix: remove Eq from Element and fix Struct equality#1028
Merged
Conversation
`Element`'s `Eq` impl violated reflexivity because `Value::Float` uses standard `f64` semantics where `NaN != NaN`. Remove `Eq` from `Element`, `Sequence`, `List`, `SExp`, and `Struct`. Fix `Struct`'s `PartialEq` to use `==` instead of `ion_eq` for field comparison, and fix a multiset matching bug where duplicate field values could all match the same target value. `IonEq for Struct` now independently uses `ion_eq` for field comparison.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1028 +/- ##
==========================================
+ Coverage 79.06% 79.08% +0.02%
==========================================
Files 140 140
Lines 34809 34858 +49
Branches 34809 34858 +49
==========================================
+ Hits 27520 27567 +47
- Misses 5209 5211 +2
Partials 2080 2080 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
deirdresama
approved these changes
Jun 18, 2026
deirdresama
left a comment
There was a problem hiding this comment.
LGTM. Correct fix for two real bugs, with a clean separation of PartialEq and IonEq semantics.
Minor (non-blocking): the greedy find(...) match relies on eq being a true equivalence relation; holds for both == and ion_eq, but a short comment would guard against a future non-transitive comparator.
NovemberZulu
approved these changes
Jun 19, 2026
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.
Issue #, if available:
fixes #1025
fixes #1026
Description of changes:
Element'sEqimpl violated reflexivity becauseValue::Floatuses standardf64semantics whereNaN != NaN. RemoveEqfromElement,Sequence,List,SExp, andStruct.Fix
Struct'sPartialEqto use==instead ofion_eqfor field comparison, and fix a multiset matching bug where duplicate field values could all match the same target value.IonEq for Structnow independently usesion_eqfor field comparison.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.