-
Notifications
You must be signed in to change notification settings - Fork 834
Respect the return qualifier for attributes on class methods #19025
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
base: main
Are you sure you want to change the base?
Conversation
❗ Release notes required
|
30f5af1 to
41a384b
Compare
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.
Please minimise the diff. So it is easier to review.
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.
I've removed the white-space churn and also fixed a bug this introduced that caused recursive active pattern matches that return struct to fail (see test Rec struct active pattern is possible).
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.
Thanks. To fix the formatting we need to restore the dotnet tools and run dotnet fantomas .
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.
I've pushed the formatting fix. I see the AOT test is failing due to a size change. I cannot run the AOT test on my mac, so I haven't updated the expected values. Any suggestions?
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.
I normally just update the expected values and wait for the review. I think the value diff reduction is related the removal of the attributes in IlxGen.fs. Maybe @vzarytovskii can give some more insight here ?
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.
Yes, majority of codegen changes will result in size change for AOT, size check is there on purpose, so we are conscious about these sorts of changes. If it's expected, just update the size.
41a384b to
cfb0589
Compare
| let attrs = | ||
| attrs | ||
| |> List.filter (function Attrib(targetsOpt = Some flags) -> not (flags.HasFlag(AttributeTargets.ReturnValue)) | _ -> true) | ||
|
|
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.
Instead of filtering, one could partition and move the return attributes into ilReturn below. Then, all the changes to CheckExpressions.fs would not be required.
This would be the smaller change, but I feel it would continue the mis-propagation of attributes...
Description
Attributes attached to the return value of a class method (e.g.
[<return: NotNull>]) were instead being attached to the method itself. This did not happen for functions (let bind). I refactored the logic out ofTcNormalizedBinding(used byTcLetBindingand used that inAnalyzeAndMakeAndPublishRecursiveValue.Fixes #19020
Checklist