diff --git a/src/Workspaces/Core/Portable/Shared/Utilities/SymbolEquivalenceComparer.GetHashCodeVisitor.cs b/src/Workspaces/Core/Portable/Shared/Utilities/SymbolEquivalenceComparer.GetHashCodeVisitor.cs index cf12771c97023167b413dbcf7325fa182ca0f133..0965a1fb1d407731c62e31e7fa39730537d3b536 100644 --- a/src/Workspaces/Core/Portable/Shared/Utilities/SymbolEquivalenceComparer.GetHashCodeVisitor.cs +++ b/src/Workspaces/Core/Portable/Shared/Utilities/SymbolEquivalenceComparer.GetHashCodeVisitor.cs @@ -19,6 +19,7 @@ private class GetHashCodeVisitor private readonly bool _objectAndDynamicCompareEqually; private readonly Func _parameterAggregator; private readonly Func _symbolAggregator; + private readonly Func _namedTypeAggregator; public GetHashCodeVisitor( SymbolEquivalenceComparer symbolEquivalenceComparer, @@ -30,6 +31,7 @@ private class GetHashCodeVisitor _objectAndDynamicCompareEqually = objectAndDynamicCompareEqually; _parameterAggregator = (acc, sym) => Hash.Combine(symbolEquivalenceComparer.ParameterEquivalenceComparer.GetHashCode(sym), acc); _symbolAggregator = (acc, sym) => GetHashCode(sym, acc); + _namedTypeAggregator = CombineNamedTypeHashCode; } public int GetHashCode(ISymbol x, int currentHash) @@ -169,10 +171,10 @@ private int CombineHashCodes(IModuleSymbol x, int currentHash) private int CombineHashCodes(INamedTypeSymbol x, int currentHash) { - return Unwrap(x).Aggregate(currentHash, (a, n) => CombineNamedTypeHashCode(n, a)); + return Unwrap(x).Aggregate(currentHash, _namedTypeAggregator); } - private int CombineNamedTypeHashCode(INamedTypeSymbol x, int currentHash) + private int CombineNamedTypeHashCode(int currentHash, INamedTypeSymbol x) { // If we want object and dynamic to be the same, and this is 'object', then return // the same hash we do for 'dynamic'.