Skip to content

Commit

Permalink
Merge pull request #78 from oliverzick/#77
Browse files Browse the repository at this point in the history
Resolve #77: Enable equality matches to use default equality comparison and drop constraint that value to match must be equatable
  • Loading branch information
oliverzick committed Dec 30, 2020
2 parents ec0e694 + 9ea9628 commit 7185666
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.2.0] - 2020-12-30
### Changed
- Enable equality matches to use default equality comparison and drop constraint that value to match must be equatable [[#77](https://github.com/oliverzick/Delizious-Toolkit/issues/77)]

## [1.1.0] - 2020-12-16
### Added
- `Transform` match [[#74](https://github.com/oliverzick/Delizious-Toolkit/issues/74)]
Expand Down
6 changes: 3 additions & 3 deletions src/Delizious.Toolkit/Delizious.Toolkit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
<Nullable>enable</Nullable>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Company />
<AssemblyVersion>1.1.0</AssemblyVersion>
<FileVersion>1.1.0.2</FileVersion>
<AssemblyVersion>1.2.0</AssemblyVersion>
<FileVersion>1.2.0.3</FileVersion>
<PackageId>Delizious-Toolkit</PackageId>
<Product>Delizious Toolkit</Product>
<PackageTags>.net dotnet csharp delizious match matching filtering immutable immutability object-oriented object-functional</PackageTags>
<Description>An easy to use .NET libary that provides matching of values.</Description>
<Version>1.1.0</Version>
<Version>1.2.0</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
7 changes: 2 additions & 5 deletions src/Delizious.Toolkit/Match.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public bool Matches(T value)
/// Creates a <see cref="Match{T}"/> instance that matches successfully when a value to match equals the specified <paramref name="reference"/> value.
/// </summary>
/// <typeparam name="T">
/// The type of the value to match that must implement the <see cref="IEquatable{T}"/> interface.
/// The type of the value to match.
/// </typeparam>
/// <param name="reference">
/// The reference value a value to match must equal to match successfully.
Expand All @@ -202,7 +202,6 @@ public bool Matches(T value)
/// <paramref name="reference"/> is <c>null</c>. When matching an instance to be a <c>null</c> reference use <see cref="Null{T}"/> instead.
/// </exception>
public static Match<T> Equal<T>([NotNull] T reference)
where T : IEquatable<T>
{
if (ReferenceEquals(reference, null))
{
Expand All @@ -216,7 +215,7 @@ public static Match<T> Equal<T>([NotNull] T reference)
/// Creates a <see cref="Match{T}"/> instance that matches successfully when a value to match does not equal the specified <paramref name="reference"/> value.
/// </summary>
/// <typeparam name="T">
/// The type of the value to match that must implement the <see cref="IEquatable{T}"/> interface.
/// The type of the value to match.
/// </typeparam>
/// <param name="reference">
/// The reference value a value to match must not equal to match successfully.
Expand All @@ -228,7 +227,6 @@ public static Match<T> Equal<T>([NotNull] T reference)
/// <paramref name="reference"/> is <c>null</c>. When matching an instance to be a non-<c>null</c> reference use <see cref="NotNull{T}"/> instead.
/// </exception>
public static Match<T> NotEqual<T>([NotNull] T reference)
where T : IEquatable<T>
{
if (ReferenceEquals(reference, null))
{
Expand All @@ -239,7 +237,6 @@ public static Match<T> NotEqual<T>([NotNull] T reference)
}

private sealed class EqualityMatch<T> : IMatch<T>
where T : IEquatable<T>
{
private readonly T reference;

Expand Down

0 comments on commit 7185666

Please sign in to comment.