diff --git a/IL2C.Core/Metadata/MetadataUtilities.cs b/IL2C.Core/Metadata/MetadataUtilities.cs index 014ac45c..13acaeae 100644 --- a/IL2C.Core/Metadata/MetadataUtilities.cs +++ b/IL2C.Core/Metadata/MetadataUtilities.cs @@ -473,27 +473,31 @@ public int Compare(IMethodInformation x, IMethodInformation y) public bool Equals(IMethodInformation x, IMethodInformation y) { - var xname = x.Name; - var yname = y.Name; - - if (xname != yname) + // Try strictly matching when both class/value type member method + // and explicitly implemented interface method are same. + if (!x.DeclaringType.IsInterface && y.DeclaringType.IsInterface) { - // If it is an explicit interface implementation, we need to compare with it's full name - if (x.DeclaringType.IsInterface) + if (x.Overrides.Contains(y)) { - xname = $"{x.DeclaringType.FriendlyName}.{xname}"; - } - if (y.DeclaringType.IsInterface) - { - yname = $"{y.DeclaringType.FriendlyName}.{yname}"; + return true; } - - if (xname != yname) + } + if (x.DeclaringType.IsInterface && !y.DeclaringType.IsInterface) + { + if (y.Overrides.Contains(x)) { - return false; + return true; } } + var xname = x.Name; + var yname = y.Name; + + if (xname != yname) + { + return false; + } + var xps = x.Parameters; var yps = y.Parameters;