fix: make SemanticVersionRange equality structural
The type was a record struct whose ==/Equals/GetHashCode were synthesized from all fields, including the _sets array, so two ranges that parse to the same constraint sets compared as unequal (reference-sensitive on the array). This also broke using ranges as dictionary keys, where lookup relies on value equality. Change the type to a plain readonly struct implementing IEquatable<SemanticVersionRange> with structural equality over the constraint sets (operation + version per comparator). The custom ToString already existed, so no display behaviour is lost. Add a failing-then-passing test.
This commit is contained in:
parent
95eb4f05a2
commit
b21bf0568e
6 changed files with 103 additions and 4 deletions
|
|
@ -17,6 +17,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
### Changed
|
||||
|
||||
- `SemanticVersion` `==`/`Equals`/`GetHashCode` now ignore build metadata, matching precedence comparison rules.
|
||||
- `SemanticVersionRange` equality (`==`, `Equals`, `GetHashCode`) is now structural and based
|
||||
on the constraint sets, so ranges that parse to the same comparators compare as equal
|
||||
(previously it was reference-sensitive on the backing array).
|
||||
|
||||
### Fixed
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue