Skip to content

Conversation

@deviousasti
Copy link
Contributor

@deviousasti deviousasti commented Jul 27, 2020

Fixes #9799 - equality comparison for StringText

This being a container for a source string, while identical StringTexts will have the same GetHashCode(), it fails for equality testing because a StringText object is compared to the other's source text, which is always false.

The comparison to string behavior is retained.

There exists no method to retrieve the original source string because the 'String' property on StringText is never exposed in ISourceText
This being a container for a source string, while identical StringTexts will  have the same GetHashCode(), it fails for equality testing because a StringText object is compared to the other's source text, which is always false.

The comparison to string behavior is retained.
@deviousasti deviousasti changed the title Fix #9799 Fix Equality comparison for StringText Jul 27, 2020
Copy link
Contributor

@KevinRansom KevinRansom left a comment

Choose a reason for hiding this comment

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

Thank you for this.

Copy link
Contributor

@cartermp cartermp left a comment

Choose a reason for hiding this comment

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

Thanks, good catch.

@cartermp cartermp merged commit de52f84 into dotnet:master Jul 27, 2020
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.

ISourceText equality comparison fails

3 participants