Skip to content

Conversation

@adamsitnik
Copy link
Member

No description provided.

@adamsitnik adamsitnik requested a review from jozkee December 13, 2022 14:32
@adamsitnik adamsitnik merged commit f449c2d into dotnet:main Dec 14, 2022
@adamsitnik adamsitnik deleted the CompletionItemMinor branch December 14, 2022 07:08
return true;
}

if (obj.GetType() != GetType())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new implementation does not check obj.GetType() != GetType(). That makes it difficult for derived classes to override the Equals methods correctly. CompletionItem is not a sealed class and should not be, as noted in #1962 (comment).

@KalleOlaviNiemitalo
Copy link

What is the rationale for this change? CompletionItem is a reference type, so implementing IEquatable<CompletionItem> does not help avoid any boxing.

@adamsitnik
Copy link
Member Author

What is the rationale for this change?

It helps to avoid casting and EqualityComparer<CompletionItem>.Default returns GenericEqualityComparer rather than ObjectEqualityComparer (better perf when used in dictionaries/hashsets).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants