Skip to content

Commit 2be5907

Browse files
committed
Suppressed false-positive compiler warning in "HashCode.Add"
1 parent de42384 commit 2be5907

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Thinktecture.Runtime.Extensions.SourceGenerator/CodeAnalysis/ValueObjects/ValueObjectCodeGenerator.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Text;
2+
using Microsoft.CodeAnalysis;
23

34
namespace Thinktecture.CodeAnalysis.ValueObjects;
45

@@ -783,8 +784,13 @@ public override int GetHashCode()
783784
hashCode.Add(this.").Append(member.Name);
784785

785786
if (equalityComparerAccessor is not null)
787+
{
786788
_sb.Append(", ").Append(equalityComparerAccessor).Append(".EqualityComparer");
787789

790+
if (member is { IsReferenceType: true, NullableAnnotation: NullableAnnotation.Annotated })
791+
_sb.Append("!");
792+
}
793+
788794
_sb.Append(");");
789795
}
790796
}

0 commit comments

Comments
 (0)