-
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
Fix record field and jsx props punned when with attributes #2824
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Pedro B S Lisboa <[email protected]>
Signed-off-by: Pedro B S Lisboa <[email protected]>
@@ -5239,7 +5243,8 @@ let createFormatter () = | |||
let value_has_jsx = jsxAttrs != [] in | |||
let nextAttr = | |||
match expression.pexp_desc with | |||
| Pexp_ident ident when isPunnedJsxArg lbl ident -> | |||
| Pexp_ident ident | |||
when isPunnedJsxArg lbl ident expression.pexp_attributes -> |
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.
you should use stdAttrs
from the call to partitionAttributes
above here.
@@ -5260,7 +5265,9 @@ let createFormatter () = | |||
let value_has_jsx = jsxAttrs != [] in | |||
let nextAttr = | |||
match expression.pexp_desc with | |||
| Pexp_ident ident when isPunnedJsxArg lbl ident -> atom lbl | |||
| Pexp_ident ident | |||
when isPunnedJsxArg lbl ident expression.pexp_attributes -> |
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.
same as above
(* don't turn {bar: Foo.bar, baz: 1} into {bar, baz: 1}, naturally *) | ||
| Pexp_ident { txt = Lident value; _ }, true, true | ||
when Longident.last_exn li.txt = value -> | ||
when Longident.last_exn li.txt = value && e.pexp_attributes = [] |
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.
I think we may need to partition attributes here too
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.
thanks for solving this one! almost there
Issue #2822
Description
This PR adds validation for records fields and jsx props to avoid pun them when the have attributes