Skip to content

Fix/complex value object collections - #33

Merged
kieronlanning merged 3 commits into
mainfrom
fix/complex-value-object-collections
Nov 25, 2026
Merged

kieronlanning merged 3 commits into
mainfrom
fix/complex-value-object-collections

Conversation

@kieronlanning

Copy link
Copy Markdown
Contributor

No description provided.

Generated equality, hashing and comparison now compare array and
IEnumerable<T> members by contents through the new runtime
ValueObjectEquality helper. Sets and dictionaries compare without regard
to order, nested collections recurse, dictionary collection values
recurse, null never equals empty, and CompareTo has a defined total order
instead of throwing.

A record now receives the generated Equals(TSelf): the compiler-
synthesized record equality compared collection members by reference. A
derived record delegates to base.Equals and includes base.GetHashCode(),
and its inherited public record members are included in Create, Hydrate,
hooks, the constructor and JSON serialization, so it round-trips with its
base state.

Also fixes CS0121 for a complex value object with a single value-type
member by typing the generated parameterless constructor argument, and
adds C# 15 support: concrete cases of closed hierarchies can be value
objects, unions work as member types, and VO1032/VO1033 reject
closed/abstract types and union declarations. Bumps the package to 2.0.1.
@kieronlanning
kieronlanning merged commit 7bdb1b1 into main Nov 25, 2026
2 checks passed
@kieronlanning
kieronlanning deleted the fix/complex-value-object-collections branch November 25, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant