-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from polyadic/tooling-updates
Tooling updates
- Loading branch information
Showing
38 changed files
with
158 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 5 additions & 8 deletions
13
Funcky.DiscriminatedUnion.SourceGeneration/SelectorComparer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
namespace Funcky.DiscriminatedUnion.SourceGeneration; | ||
|
||
internal sealed class SelectorComparer<TSource, TSelected> : IEqualityComparer<TSource> | ||
internal sealed class SelectorComparer<TSource, TSelected>(Func<TSource, TSelected> selector) | ||
: IEqualityComparer<TSource> | ||
{ | ||
private readonly Func<TSource, TSelected> _selector; | ||
public bool Equals(TSource x, TSource y) => EqualityComparer<TSelected>.Default.Equals(selector(x), selector(y)); | ||
|
||
public SelectorComparer(Func<TSource, TSelected> selector) => _selector = selector; | ||
|
||
public bool Equals(TSource x, TSource y) => EqualityComparer<TSelected>.Default.Equals(_selector(x), _selector(y)); | ||
|
||
public int GetHashCode(TSource obj) => EqualityComparer<TSelected>.Default.GetHashCode(_selector(obj)); | ||
} | ||
public int GetHashCode(TSource obj) => EqualityComparer<TSelected>.Default.GetHashCode(selector(obj)); | ||
} |
14 changes: 7 additions & 7 deletions
14
Funcky.DiscriminatedUnion.Test/Funcky.DiscriminatedUnion.Test.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
..._sourceFileName=EmptyUnion.01.verified.cs → ...DiscriminatedUnionGenerator.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
//HintName: DiscriminatedUnionGenerator.g.cs | ||
//HintName: DiscriminatedUnionGenerator.g.cs | ||
// <auto-generated/> | ||
#nullable enable | ||
|
||
partial record EmptyUnion | ||
{ | ||
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")] | ||
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "VERSION")] | ||
public abstract TResult Match<TResult>(); | ||
|
||
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")] | ||
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "VERSION")] | ||
public abstract void Switch(); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
14 changes: 7 additions & 7 deletions
14
...urceFileName=NonExhaustive.01.verified.cs → ...DiscriminatedUnionGenerator.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.