-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Convert fast path of ValueType.GetHashCode to managed #97590
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
Changes from 1 commit
ade6628
246168c
580f969
99b4ad9
6fa4666
6d54f40
5a5da06
ce7f636
7091fb0
a0a1e32
808ceb4
9a8de4c
83e49b7
4303b3c
8dd42ff
e519b2b
9c80cd4
9cd9166
946967e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -299,6 +299,21 @@ public static void StructContainsPointerCompareTest() | |||||||||
| Assert.True(obj1.Equals(obj2)); | ||||||||||
| Assert.Equal(obj1.GetHashCode(), obj2.GetHashCode()); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| [Fact] | ||||||||||
| public static void StructContainsPointerNestedCompareTest() | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because these two values are not the same the fact they aren't equal makes sense. We should also have a test where they are equal to validate the other direction.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well all the other tests are only testing the equal case. Returning different hash code is just an implementation detail. The test should be reversed and only test equal case instead. |
||||||||||
| { | ||||||||||
| StructContainsPointerNested obj1 = new StructContainsPointerNested(); | ||||||||||
| obj1.o = null; | ||||||||||
| obj1.value.value = 1; | ||||||||||
|
|
||||||||||
| StructContainsPointerNested obj2 = new StructContainsPointerNested(); | ||||||||||
| obj1.o = null; | ||||||||||
| obj1.value.value = 2; | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I assume? |
||||||||||
|
|
||||||||||
| Assert.False(obj1.Equals(obj2)); | ||||||||||
| Assert.NotEqual(obj1.GetHashCode(), obj2.GetHashCode()); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public struct S | ||||||||||
| { | ||||||||||
|
|
@@ -392,5 +407,11 @@ public struct StructContainsPointer | |||||||||
| public double value1; | ||||||||||
| public double value2; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public struct StructContainsPointerNested | ||||||||||
| { | ||||||||||
| public object o; | ||||||||||
| public StructNonOverriddenEqualsOrGetHasCode value; | ||||||||||
| } | ||||||||||
| } | ||||||||||
| } | ||||||||||
Uh oh!
There was an error while loading. Please reload this page.