New
v1.13.0
What's Changed
Switch expressions on union types are now checked for exhaustiveness. For example:
using Dunet;
using static Option<int>;
[Union]
partial record Option<T>
{
partial record Some(T Value);
partial record None;
}
Option<int> option = new Some(42);
// Does not emit an exhaustiveness warning since all union variants are handled.
var message = option switch
{
Some(var value) => $"The value is {value}!",
None => "There's no value.",
};
// Emits an exhaustiveness warning because Some variant with Value != 5 is unhandled.
var message2 = option switch
{
Some(5) => "Value is 5!",
None => "There's no value.",
}
This largely makes the .Match() method unnecessary and a future version of the package may mark it as obsolete.
Packages
https://www.nuget.org/packages/Dunet/1.13.0
Full Changelog
https://github.com/domn1995/dunet/compare/v1.12.0...v1.13.0