Skip to content

Commit

Permalink
Merge pull request #42 from Funkest/funkest/change-icomparable
Browse files Browse the repository at this point in the history
Add IComparable on 'UnitGenerateOptions.Comparable | UnitGenerateOptions.WithoutComparisonOperator'
  • Loading branch information
hadashiA authored Feb 9, 2024
2 parents dbcdaa5 + b4d34e7 commit 3774e7a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/UnitGenerator/SourceGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,13 @@ namespace {{ns}}
readonly partial struct {{unitTypeName}}
: IEquatable<{{unitTypeName}}>
""");
if (prop.HasFlag(UnitGenerateOptions.Comparable) &&
!prop.HasFlag(UnitGenerateOptions.WithoutComparisonOperator))
if (prop.HasFlag(UnitGenerateOptions.Comparable))
{
anyPlatformInterfaces.Add($"IComparable<{unitTypeName}>");
net7Interfaces.Add($"IComparisonOperators<{unitTypeName}, {unitTypeName}, bool>");
if (!prop.HasFlag(UnitGenerateOptions.WithoutComparisonOperator))
{
net7Interfaces.Add($"IComparisonOperators<{unitTypeName}, {unitTypeName}, bool>");
}
}
if (prop.HasFormattableInterface())
{
Expand Down

0 comments on commit 3774e7a

Please sign in to comment.