fsharp icon indicating copy to clipboard operation
fsharp copied to clipboard

Change ty1.Equals(ty2) to call static op_Equality

Open rstm-sf opened this issue 2 years ago • 1 comments

Closes https://github.com/dotnet/fsharp/issues/8447

rstm-sf avatar Apr 20 '22 22:04 rstm-sf

@rstm-sf This needs to be merged with main, can you do that please? Thank you

dsyme avatar May 19 '22 17:05 dsyme

@vzarytovskii This would a good improvement to have merged to main ?

edgarfgp avatar Sep 27 '22 10:09 edgarfgp

@vzarytovskii This would a good improvement to have merged to main ?

Would be good (uses a more fitting overload, skipping type checks when they are known). It has some conflicts since creation...

T-Gro avatar Oct 07 '22 12:10 T-Gro

Edit: Ah, I misread the issue. This is only for type equality, not value equality. Sorry for the noise.

It's worth noting that for float, double, System.Half, and potentially other types == and Equals are not the same.

In the case of the IEEE 754 floating-point types, == follows IEEE 754 semantics and so NaN != NaN, even for bitwise equivalent values. However, Equals follows .NET semantics and fits the needs around using a type in dictionaries, sets, and other collection types and so NaN.Equals(NaN), even for NaNs of differing signs or payloads.

tannergooding avatar Oct 07 '22 18:10 tannergooding