Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Releases: domn1995/dunet

v1.15.0

29 Jan 05:43
3a7914a

Choose a tag to compare

What's Changed

  • Binary or 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 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...v1.15.0

v1.14.0

27 Jan 08:05
21ec33b

Choose a tag to compare

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...v1.14.0

v1.13.1

25 Jan 07:51
03a2411

Choose a tag to compare

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...v1.13.1

v1.13.0

25 Jan 03:02
6605a7d

Choose a tag to compare

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...v1.13.0

v1.12.0

19 Jan 20:34
3cc3c59

Choose a tag to compare

What's Changed

  • Empty variants are now ignored when generating implicit conversions @domn1995 in #353
[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...v1.12.0

v1.11.4

17 Jan 20:43
afc0bab

Choose a tag to compare

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.CSharp dependency to v4.11.0 to fix compilation issues by @domn1995 in #337

Packages

https://www.nuget.org/packages/Dunet/1.11.4

Full Changelog

v1.11.3...v1.11.4

New Contributors

v1.11.3

13 Jun 00:28
85247de

Choose a tag to compare

What's Changed

Packages

https://www.nuget.org/packages/Dunet/1.11.3

Full Changelog

v1.11.2...v1.11.3

v1.11.2

29 Jan 02:31
019328e

Choose a tag to compare

What's Changed

Packages

https://www.nuget.org/packages/Dunet/1.11.2

Full Changelog

v1.11.1...v1.11.2

v1.11.1

27 Jan 02:22
cd444fb

Choose a tag to compare

What's Changed

Packages

https://www.nuget.org/packages/Dunet/1.11.1

Full Changelog

v1.11.0...v1.11.1

v1.11.0

04 Jan 04:39
93c3e1d

Choose a tag to compare

What's Changed

Migrating to v1.11.0

The following dunet package reference in .csproj files will now fail to build:

<PackageReference Include="dunet" Version="1.11.0">
    <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    <PrivateAssets>all</PrivateAssets>
</PackageReference>

When upgrading to v1.11.0, you will need to simplify it to this:

<PackageReference Include="dunet" Version="1.11.0" />

Packages

https://www.nuget.org/packages/Dunet/1.11.0

New Contributors

Full Changelog

v1.10.0...v1.11.0