From 1fe11155d684c663a46ae6a22650aaaa49ed052b Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Wed, 27 Feb 2013 13:47:05 -0600 Subject: [PATCH] IEqualityComparer is not covariant before .NET 4 --- .../CSharp/Antlr4.Runtime.Test/TestGraphNodes.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/runtime/CSharp/Antlr4.Runtime.Test/TestGraphNodes.cs b/runtime/CSharp/Antlr4.Runtime.Test/TestGraphNodes.cs index 5f0bc1015..41acd1eb0 100644 --- a/runtime/CSharp/Antlr4.Runtime.Test/TestGraphNodes.cs +++ b/runtime/CSharp/Antlr4.Runtime.Test/TestGraphNodes.cs @@ -1014,16 +1014,17 @@ namespace Antlr4.Runtime.Test where TKey : class { public IdentityHashMap() - : base(IdentityEqualityComparer.Default) + : base(IdentityEqualityComparer.Default) { } } - private class IdentityEqualityComparer : IEqualityComparer + private class IdentityEqualityComparer : IEqualityComparer + where T : class { - private static readonly IdentityEqualityComparer _default = new IdentityEqualityComparer(); + private static readonly IdentityEqualityComparer _default = new IdentityEqualityComparer(); - public static IdentityEqualityComparer Default + public static IdentityEqualityComparer Default { get { @@ -1031,12 +1032,12 @@ namespace Antlr4.Runtime.Test } } - public new bool Equals(object x, object y) + public bool Equals(T x, T y) { return x == y; } - public int GetHashCode(object obj) + public int GetHashCode(T obj) { return RuntimeHelpers.GetHashCode(obj); }