Releases: domn1995/dunet
Releases · domn1995/dunet
v1.16.2
What's Changed
- bugfix: nested unions with same name and namespace by @Rudomitori in #397
Package
https://www.nuget.org/packages/Dunet/1.16.2
New Contributors
- @Rudomitori made their first contribution in #397
Full Changelog
v1.16.1
v1.16.0
v1.15.0
What's Changed
- Binary
orpatterns are now also checked for exhaustiveness. For example:
[Union]
partial record Shape
{
partial record Circle(double Radius);
partial record Rectangle(double Length, double Width);
partial record Square(double Length);
partial record Triangle(double Base, double Height);
}
Shape? shape = null;
var sides = shape switch
{
// This is now considered as handling both the `Circle` and `null` cases.
Circle or null => 0,
// This is now considered as handling both the `Rectangle` and `Square` cases.
Rectangle or Square => 4,
Triangle t => 3,
};Package
https://www.nuget.org/packages/Dunet/1.15.0
Full Changelog
v1.14.0
What's Changed
- Some property patterns are now also checked for exhaustiveness. For example:
[Union]
partial record Shape
{
partial record Circle(double Radius);
partial record Rectangle(double Length, double Width);
partial record Triangle(double Base, double Height);
}
Shape shape = new Circle(3.14);
var area = shape switch
{
// This is now considered as handling the `Rectangle` case.
Rectangle { Length: var length, Width: var width } => length * width,
Circle(var radius) => 3.14 * radius * radius,
Triangle t => t.Base * t.Height / 2,
};
var area2 = shape switch
{
// This is now considered as handling the `Rectangle` case.
Rectangle { Length: _, Width: _ } => 0,
Circle(var radius) => 3.14 * radius * radius,
Triangle t => t.Base * t.Height / 2,
};Packages
https://www.nuget.org/packages/Dunet/1.14.0
Full Changelog
v1.13.1
What's Changed
- Fixed an issue where subsequent switch expressions in the same file were not being properly checked for exhaustiveness by @domn1995 in #364
Packages
https://www.nuget.org/packages/Dunet/1.13.1
Full Changelog
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
v1.12.0
What's Changed
[Union]
public partial record Option<T>
{
// An implicit conversion from `T` to `Some` is now generated.
public partial record Some(T Value);
public partial record None;
}Packages
https://www.nuget.org/packages/Dunet/1.12.0
Full Changelog
v1.11.4
What's Changed
- Fixes compilation issues on generated union types when there are 2 generic union types with the same name by @Dixin in #334
- Fixes compilation issues on generated extension methods when there are 2 generic union types with the same name by @domn1995 in #340
- Downgrades
Microsoft.CodeAnalysis.CSharpdependency to v4.11.0 to fix compilation issues by @domn1995 in #337
Packages
https://www.nuget.org/packages/Dunet/1.11.4
Full Changelog
New Contributors
v1.11.3
What's Changed
- Fixes namespace conflicts with System by @IchiganCS in #301
Packages
https://www.nuget.org/packages/Dunet/1.11.3