fsharp
fsharp copied to clipboard
Change ty1.Equals(ty2) to call static op_Equality
Closes https://github.com/dotnet/fsharp/issues/8447
@rstm-sf This needs to be merged with main, can you do that please? Thank you
@vzarytovskii This would a good improvement to have merged to main ?
@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...
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.