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.
1 KiB
1 KiB
Changelog
All notable changes to this project will be documented in this file.
This project adheres to Semantic Versioning.
1.0.0 - 2026-05-21
Added
- This is the initial release of the library.
Unreleased
Added
Changed
SemanticVersion==/Equals/GetHashCodenow ignore build metadata, matching precedence comparison rules.SemanticVersionRangeequality (==,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
- Reject invalid SemVer identifiers when parsing versions.
- Range exact and non-equal comparators ignore build metadata when matching versions.
- Avoid infinite recursion when formatting ranges in the short npm (
ns) form.