-
Notifications
You must be signed in to change notification settings - Fork 795
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
Pattern discard not allowed for union case that takes no data #14055
Pattern discard not allowed for union case that takes no data #14055
Conversation
…hat-takes-no-data
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Does this also cover |
…o-data' of https://github.com/edgarfgp/fsharp into pattern-discard-not-allowed-for-union-case-that-takes-no-data
Yes, it does, I have added more tests. Thanks for the review :) |
…hat-takes-no-data
Does it affect single-case unions when using them as a deconstruct syntax in functions? I.e. was it allowed before and is it now? My guess it shouldn't be affecting it, since they'll just be aliases? |
It was working before (with _ discard), and was not working before when using named arg. IMO it would be more consistent with other features it function arguments also show a warning if empty discard is used, but the opinion is not very strongly held. |
Can you give an example in code to better illustrate your question :) ? |
FYI the middle ones gives a FS0725 error (good), and it gives a fixing suggestion of replacing this with an underscore. |
@T-Gro Ok let me add a test with your code sample :)
Agreed would be good to show the new warning error to make it consistent
I guess this quick fix is not longer needed and a new/ or existing one suggesting remove the _ will be more useful Any help is appreciated ;) |
If you could just create a follow-up issue for removing exciting quick fix for this case and adding new one (remove discard) - we'll take care of it. |
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.
Hah I was scared to review this due to the number of files in the PR but then realized it's actually the analyzer fixing code in our repo :D
Thanks, great work - and especially great testing :)
Thanks, Happy to help |
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.
Sweet, thanks a ton for it, Edgar, great job as usual!
Thanks for the kind words :) . It always a pleasure to help F# to get better. I’m already looking for the next issue to contribute |
Awesome that you tackled this long standing issue! 🥳 |
My pleasure @abelbraaksma , @NinoFloris might also like this one as he raised this issue as well 😀 |
@edgarfgp sure - absolutely :) |
Fixes #13851