Skip to content

Commit 1785e7b

Browse files
[RGen] Improve the hash code used to detect duplicate methods.
1 parent 68a62c0 commit 1785e7b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/rgen/Microsoft.Macios.Bindings.Analyzer/Validators/ClassValidator.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4+
using System;
45
using System.Collections.Generic;
56
using System.Collections.Immutable;
67
using System.Linq;
@@ -32,10 +33,11 @@ public bool Equals ((string, TypeInfo []) x, (string, TypeInfo []) y)
3233
/// </summary>
3334
public int GetHashCode ((string, TypeInfo []) obj)
3435
{
35-
int hash = obj.Item1.GetHashCode ();
36+
var hash = new HashCode ();
37+
hash.Add (obj.Item1.GetHashCode ());
3638
foreach (var t in obj.Item2)
37-
hash = hash * 31 + (t.GetHashCode ());
38-
return hash;
39+
hash.Add (t.GetHashCode ());
40+
return hash.ToHashCode ();
3941
}
4042
}
4143

0 commit comments

Comments
 (0)