You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: Support C# 15 union types (AreUnions / BeUnions) #520
ArchUnitNET already loads these correctly. A union shows up as a Struct with one constructor per case type and a Value property. Dependencies are found both from the union to its case types and from code that switches over the union. The only gap is that rules can't tell a union apart from an ordinary struct.
The compiler marks a union type with:
[System.Runtime.CompilerServices.UnionAttribute]
the interface System.Runtime.CompilerServices.IUnion
Proposal:
an IsUnion property on the type
the predicates AreUnions() / AreNotUnions() and the conditions BeUnions() / NotBeUnions() on types, next to AreStructs()
I'd be happy to implement this and open a PR if the proposal sounds good to you.
Use Case(s)
// Unions only in the domain modelTypes().That().AreUnions().Should().ResideInNamespace("MyApp.Domain");// Results are unions, not inheritance hierarchiesTypes().That().HaveNameEndingWith("Result").Should().BeUnions();
Activity