-
Notifications
You must be signed in to change notification settings - Fork 428
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
Don't swallow <> </>
fragments when formatting
#1963
Conversation
self#formatChildren (remaining @ children) processedRev | ||
| {pexp_desc = Pexp_construct ({txt = Lident "::"}, Some {pexp_desc = Pexp_tuple children} )} as x :: remaining -> | ||
let {jsxAttrs} = partitionAttributes x.pexp_attributes in | ||
if jsxAttrs != [] then |
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.
Another option is the pattern match on jsxAttrs
. Pattern matching is probably cheaper than physical equality checks. (Correct me if I'm wrong).
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.
Pattern matching should be safer against future changes in compiler optimizations around equality.
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 actually had a pattern match at first but decided to go with this approach given it’s used everywhere else that does the same thing.
Can you add some extra tests to verify other expressions? |
Addressed the comments in the new commits. |
Great! @chenglou, good from my part |
Thanks. Will be useful soon I think |
fixes #870