-
Notifications
You must be signed in to change notification settings - Fork 803
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
ComparisonIdentity.Structural.Compare returns different values for Option wrapped types #576
Comments
Playing around a bit this seems to be the case only for primitives that are < 32 bits. Even more smaller probability that this affects real code... |
I don't think this is worth worrying about. It's well-documented that comparison results should only be considered for 0, < 0 or > 0. |
I agree. (For regression purposes trying to just be 100% with what is currently there so I don't have to look at any individual cases, but I would like to achieve ComparerIdentity.Structural as equal to System.Collections.Generic.Comparers.Default where they shouldn't differ - even if it is still "valid": values) |
Yes, this is not a bug, will close it as by design |
My regression tests for #513 have shown up the following inconsistency in existing f#:
Output
It is due to FSharpOption's type generic call to:
Now I doubt if anyway is using comparers in any other way than < 0 or > 0, but they may be? #513 is a potentially breaking change because it returns -1 for the Option case - i.e. matching the primitive operation (although the affects of this breaking case, to Option comparison operations being sensitive to particular return values - is almost vanishingly small I would say..)
(The good news is that if in my regression limits Compare to (sign of Compare) then I'm getting no regression errors. I'll put my regression test up soon)
The text was updated successfully, but these errors were encountered: