-
Notifications
You must be signed in to change notification settings - Fork 192
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
Issue 341 #458
base: main
Are you sure you want to change the base?
Issue 341 #458
Conversation
Isn't this pretty important? Afaik any transformer might produce logically different code. Is there a simple "workaround" I don't see? thank you for libcst! |
@notEvil I have a quick a dirty work around in the linked issue. #341 (comment) You could probably do something more clever by incorporating the logic I use here in the transformer. |
Thanks, I've seen it but don't want to introduce parentheses.
I just did, * eventually, after I recognized the relevance of |
Looks amazing! Prevents tricky issues. |
I'm happy to review this if someone's willing to resurrect and rebase |
Summary
resolves #341
Adds
_PrecedenceNode
as a helper class to automatically parenthesize child nodes when necessaryTest Plan
Adds basic unit tests for implicit parens and extends fuzz testing.
Notes
I had originally tried to allow
MaybeSentinel
in{l,r}par
attrs but this proved difficulty to get right. It would require numerous changes to the parser to ensure proper construction of_BaseParenthesizableNode
as they are often explicitly constructed with emptylpar
andrpar
attributes.