Open ryyppy opened 1 year ago
The parsing of coercion is spread out in several places. Not completely clear how to capture where parens are necessary or not.
Will need to either do on a case by case basis, or unify :>
parsing with the behaviour of other binary operators.
Also, one needs to make sure that removing parens does not make the code more difficult to understand, even if it parses OK.
After a little investigation, its not clear which one is preferable in this specific example. So I'll leave it here in case some new data / opinions emerge.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
7024 just reminded me of this one. @shulhi do you think we should add this one to #6995 to investigate (even though it is not strictly speaking a bug)?
Sure thing, I added this to #6995
Given the following example:
Playground link
When pretty-printing the code, the coercion expression will be wrapped with parentheses:
foo((v :> b))
.Expected behavior: It should print the expression the same way as it was defined; only preserve parentheses if the operation was originally wrapped in parentheses.