-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Conversation
|
||
if (comparer == null) | ||
{ | ||
comparer = Comparer.Default; |
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.
Not sure on this, but I went with Comparer.Default
just in Array to be consistent with everything else in array uses it. However, I used Comparer<object>.Default
in Tuple and ValueTuple to be consistent with everything else in the BCL.
/cc @jcouv
@@ -118,7 +118,7 @@ public Tuple(T1 item1) | |||
|
|||
public override Boolean Equals(Object obj) | |||
{ | |||
return ((IStructuralEquatable)this).Equals(obj, EqualityComparer<Object>.Default); | |||
return ((IStructuralEquatable)this).Equals(obj, null); |
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.
null [](start = 60, length = 4)
Why now pass null
? I'm tempted to leave as before. Maybe BCL reviewers can comment. #Resolved
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.
@jnm2 Looks good to me, with one question. @stephentoub @weshaggard @AlexGhiondea for review. Thanks |
I am having an issue building corefx. I had set CoreCLROverridePath as a user env variable and rebooted, then deleted my corefx copy and recloned and ran
|
Where is your corefx repo root? Is it at It looks like we explicitly pass it at https://github.com/dotnet/corefx/blob/master/run.cmd#L43 so I'm not sure why it would be picking up a config.json not in the root of your repo. |
FYI @marek-safar |
The source is https://github.com/jnm2/corefx/tree/null_comparer_consistency. I could rebase on upstream master, but the same build was working on a different machine. |
@jnm2 can you look to see if you have this line locally https://github.com/jnm2/corefx/blob/null_comparer_consistency/run.cmd#L43? It should be telling run.exe to load the config.json file in root of your repo. |
@jcouv we pick them all automatically when they land in CoreRT repo, which means you need to fix CoreRT version of Array as well. |
@weshaggard Ah, thank you! That's my problem. Line 43 is a blank line. I don't know why |
Work in progress for the corefx PR: dotnet/corefx@master...jnm2:null_comparer_consistency I'm a little unsure how to make the Tuple and ValueTuple tests netfx-specific since they are several calls deep from the test entry point and the |
I just realized that System.Runtime is the only one that needs netfx-specific tests. System.Collections.lmmutable and System.ValueTuple tests fail if I give them netfx tests. |
No, it's just the System.ValueTuple tests. Because I fixed the corefx ValueTuple source too, I guess. |
Think everything is straightened out. Corefx PR ready at dotnet/corefx#19442 |
a080264
to
92dc74e
Compare
To keep things in sync, I just rebased both PRs on master. Otherwise unrelated tests fail. |
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.
LGTM Thanks!
@dotnet-bot test Windows_NT x64 CoreCLR Perf Tests Correctness please |
1 similar comment
@dotnet-bot test Windows_NT x64 CoreCLR Perf Tests Correctness please |
@stephentoub I saw there are discussions on the corefx sibling PR. Ok to merge this one? |
@dotnet-bot test Windows_NT x86 CoreCLR Perf Tests Correctness please |
@jnm2 Although it's painful for me to not accept a PR, because the change looks good technically and I much appreciated your effort and patience, I think it's the better course of action for those types (Tuple and ValueTuple). CC @karelz |
This is a low value change. Consistency with other comparers in the framework has some merit ... but not very much ... Most developers have learned not to not pass null, to this API, indeed I'm guessing that those that tried it saw the exception, and fixed their code straight away, with a mild curse that it didn't do what they first typed. Contrast that with a future developer who typed in a null, and it worked because he was testing on Net47 and then deployed to his customers machines a which were a mix of 4.5, 4.6 and 4.61 where it didn't work, and his customer says "Did you even test this thing?". |
@jcouv @KevinRansom I appreciate the consideration, agree with the conclusion, and have no hard feelings. I'm happy to simply facilitate the possibility of an ideal. |
@jcouv I can't imagine |
Fixes https://github.com/dotnet/corefx/issues/18528
Please wait for my PR adding tests in corefx before merging.