-
Couldn't load subscription status.
- Fork 833
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 .
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