未验证 提交 e8a68c4f 编写于 作者: M msftbot[bot] 提交者: GitHub

Merge pull request #41683 from dotnet/merges/release/dev16.5-to-master

Merge release/dev16.5 to master
......@@ -368,7 +368,8 @@ private int ComputeHashCode()
// (e.g, ignoring nullability) and want to retain the same hashcode. As such, consider only
// the original definition for the hashcode when we know equality is possible
var containingHashCode = _containingType.GetHashCode();
if (containingHashCode == this.OriginalDefinition.ContainingType.GetHashCode())
if (containingHashCode == this.OriginalDefinition.ContainingType.GetHashCode() &&
wasConstructedForAnnotations(this))
{
return code;
}
......@@ -402,6 +403,24 @@ private int ComputeHashCode()
}
return code;
static bool wasConstructedForAnnotations(SubstitutedMethodSymbol method)
{
var typeArguments = method.TypeArgumentsWithAnnotations;
var typeParameters = method.OriginalDefinition.TypeParameters;
for (int i = 0; i < typeArguments.Length; i++)
{
if (!typeParameters[i].Equals(
typeArguments[i].Type,
TypeCompareKind.ConsiderEverything))
{
return false;
}
}
return true;
}
}
public sealed override bool Equals(Symbol obj, TypeCompareKind compareKind)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册