-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
'Remove unnecessary cast' adds unnecessary parentheses #25554
Comments
This should already be checked in my PR. precedence is different here, so we would consider those parens necessary. |
I can do this if you'd like. But i don't want to step on your toes if you wanted to take this. |
I was going to go after this but then realized you might have fixed the issue inside |
So if I was going to do this I would potentially have to duplicate some of your logic and step on your toes. |
A fix for this will break a few tests I added though: #25538 (comment) that currently expect these extra parens. Depending on which PR gets merged first, soebody will have to take care of that later. But as I sad I'd be happy if you fixed this because your PR has a lot more to do with unnecessary parentheses than mine does. |
No prob. I'll make the change. Whoever goes in second will just do the fixup. |
@CyrusNajmabadi My PR was merged so you might want to fix some of those tests in your branch. Thanks for fixing this. |
Thanks! |
This is fixed in 15.8 preview 2. @CyrusNajmabadi I think you fixed this with #26523 right? |
Inside a switch case:
inside a when clause:
inside an is pattern expression:
Tagging @CyrusNajmabadi who's working on a code fix specifically to remove unnecessary parentheses. The problem is inside
ParenthesizedExpressionSyntaxExtensions.CanRemoveParentheses
. The first two cases should be trivial to fix but that's not the case insideis
, where associativity plays a role. For example it's important to add tests so that parentheses are not removed here:The text was updated successfully, but these errors were encountered: