Skip to content

Commit

Permalink
fix: support to prefix in invoke expression
Browse files Browse the repository at this point in the history
  • Loading branch information
mika-f committed Mar 16, 2024
1 parent 752b3b1 commit d01e7c6
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public bool Equals(ISymbol? x, ISymbol? y)
case IPropertySymbol:
case IMethodSymbol:
case IFieldSymbol:
case IParameterSymbol:
return x.ToDisplayString(SymbolDisplayFormat) == y.ToDisplayString(SymbolDisplayFormat);
}

Expand All @@ -68,6 +69,19 @@ public int GetHashCode(ISymbol obj)
case IMethodSymbol:
case IFieldSymbol:
return obj.ToDisplayString(SymbolDisplayFormat).GetHashCode();

case IParameterSymbol parameter:
{
if (parameter.ContainingSymbol is IMethodSymbol m)
{
var a = (m.IsExtensionMethod ? m.ReducedFrom ?? m.OriginalDefinition : m).ToDisplayString(SymbolDisplayFormat);
var b = obj.ToDisplayString(SymbolDisplayFormat);

return HashCode.Combine(a, b);
}

break;
}
}

return SymbolEqualityComparer.Default.GetHashCode(obj);
Expand Down

0 comments on commit d01e7c6

Please sign in to comment.