-
Notifications
You must be signed in to change notification settings - Fork 222
Issue 341 #458
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?
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 |
|
I've just published my recent work on parentheses and precedence at https://gitlab.com/notEvil/normcst. The tests generate ~7.5k combinations of expressions/statements/match patterns and ensure that |
Summary
resolves #341
Adds
_PrecedenceNodeas 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
MaybeSentinelin{l,r}parattrs but this proved difficulty to get right. It would require numerous changes to the parser to ensure proper construction of_BaseParenthesizableNodeas they are often explicitly constructed with emptylparandrparattributes.