Skip to content

Commit

Permalink
Merge pull request #43 from xin9le/hotfix/same-value
Browse files Browse the repository at this point in the history
Fix error in equivalence evaluation
  • Loading branch information
xin9le authored Sep 18, 2024
2 parents 1f3e691 + a47672a commit 0a2f28b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/insights/FastEnum.Sandbox/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Net;
using FastEnumUtility;
using FastEnumUtility.Sandbox;

Expand All @@ -17,8 +18,13 @@ public enum Fruits
}


[FastEnum<Fruits>]
public partial class FruitsBooster
//[FastEnum<Fruits>]
//public partial class FruitsBooster
//{ }


[FastEnum<HttpStatusCode>]
public partial class HttpStatusCodeBooster
{ }
}

4 changes: 2 additions & 2 deletions src/libs/FastEnum.Generators/FastEnumBoosterGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -439,12 +439,12 @@ private sealed class FieldSymbolComparer : IEqualityComparer<IFieldSymbol>
{
/// <inheritdoc/>
public bool Equals(IFieldSymbol x, IFieldSymbol y)
=> x.ConstantValue == y.ConstantValue;
=> EqualityComparer<object>.Default.Equals(x.ConstantValue!, y.ConstantValue!);


/// <inheritdoc/>
public int GetHashCode(IFieldSymbol obj)
=> obj.ConstantValue?.GetHashCode() ?? 0;
=> EqualityComparer<object>.Default.GetHashCode(obj.ConstantValue!);
}
#endregion
}
Expand Down

0 comments on commit 0a2f28b

Please sign in to comment.