-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tweaks to ValueComparer nullability #24410
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
roji
force-pushed
the
ValueComparerNullability
branch
2 times, most recently
from
March 16, 2021 12:31
a29ced6
to
ecc3222
Compare
* Make Snapshot accept/receive non-nullable (nulls are sanitized externally). * Make ValueComparer<T>.GetHashCode accept non-nullable object.
roji
force-pushed
the
ValueComparerNullability
branch
from
August 19, 2021 17:00
ecc3222
to
13738fb
Compare
AndriySvyryd
approved these changes
Aug 19, 2021
Consider merging this to rc1 since it impacts public API |
roji
commented
Aug 20, 2021
public override int GetHashCode(object? instance) | ||
=> instance == null ? 0 : GetHashCode((T)instance); | ||
public override int GetHashCode(object instance) | ||
=> instance is null ? 0 : GetHashCode((T)instance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that I'm leaving a runtime nullability check despite the annotation change, for better backwards compatibility.
roji
added a commit
that referenced
this pull request
Aug 20, 2021
* Make Snapshot accept/receive non-nullable (nulls are sanitized externally). * Make ValueComparer<T>.GetHashCode accept non-nullable object.
roji
added a commit
that referenced
this pull request
Aug 20, 2021
* Make Snapshot accept/receive non-nullable (nulls are sanitized externally). * Make ValueComparer<T>.GetHashCode accept non-nullable object.
roji
added a commit
that referenced
this pull request
Aug 20, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some of this came up during annotating EFCore.PG.
The main thing is that generic Snapshot shouldn't accept/return
T?
, but rather T (just like GetHashCode).