generated from hughesjs/dotnet-8-ci-cd-template
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #68 from hughesjs/generic-constraints
feat: Added support for generic method args
- Loading branch information
Showing
8 changed files
with
52 additions
and
10 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
10 changes: 10 additions & 0 deletions
10
src/SuperFluid/Internal/Definitions/FluidGenericArgumentDefinition.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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace SuperFluid.Internal.Definitions; | ||
|
||
using System.Diagnostics; | ||
|
||
[DebuggerDisplay("{Name}")] | ||
internal record FluidGenericArgumentDefinition | ||
{ | ||
public required List<string> Constraints { get; init; } | ||
public required string Name { get; init; } | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace SuperFluid.Internal.Model; | ||
|
||
public class FluidGenericArgument | ||
{ | ||
public FluidGenericArgument(string name, IEnumerable<string> constraints) | ||
{ | ||
var enumeratedConstraints = constraints as string[] ?? constraints.ToArray(); | ||
if (enumeratedConstraints.Length == 0) | ||
{ | ||
throw new ArgumentException("Generic argument must have at least one constraint"); | ||
} | ||
|
||
Name = name; | ||
Constraints = [..enumeratedConstraints]; | ||
} | ||
|
||
internal HashSet<string> Constraints { get; init; } | ||
internal string Name { get; init; } | ||
} |
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