-
Notifications
You must be signed in to change notification settings - Fork 790
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
fix for net7 regression for UMX #12892
Conversation
This is ready |
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.
Nice
Note testing for |
So, in worst case scenario, for any Edit: it's also probably worth it to add such tests to https://github.com/dotnet/performance. |
// | ||
// This rule is conservative and only applies to IComparable and IEquatable interfaces. | ||
// | ||
// This rule may in future be extended to rewrite the "trait" interfaces associated with .NET 7. |
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.
Yeah, we'll probably want to revisit what are we looing for, once it's stabilized in .NET7+
Given these growing interface lists, I think the best precautionary mitigation (not just for this issue, but in general) will be to add an As a general point, the @vzarytovskii @KevinRansom Might make a good thing to pair-program |
* fix net7 regression * fix test
Fix the core problem with #12881
As background, unit-annotated versions of primitive types are defined by:
This is primarily used on FSharp.Core to define
float<'m>
,int64<'m>
and so on, but can also be used for unit-annotated versions of primitives like GUID - this is done in the UMX library.For these types, the logic of the F# compiler must report which interfaces are implemented by the unitized versions of this type.
In general we preserve the interfaces of the underlying representation type unchanged, however there is an exception: we want the unitized types to support comparison and equality with corresponding unitized values.
So the unitized version of the type is considered to support the following interfaces. The adjustment in this PR is shown in bold
IComparable<SomeType<'m>>
IEquatable<SomeType<'m>>
SomeType
except those derived fromIComparable<_>
orIEquatable<_>
This fixes #12881.