-
Notifications
You must be signed in to change notification settings - Fork 153
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(macro): handle patterns in inline_props component arguments #720
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #720 +/- ##
==========================================
+ Coverage 63.97% 64.01% +0.04%
==========================================
Files 52 52
Lines 7072 7087 +15
==========================================
+ Hits 4524 4537 +13
- Misses 2548 2550 +2 ☔ View full report in Codecov by Sentry. |
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.
Ah I've just realized that supporting arbitrary patterns for inline props means that we no longer know what the prop name is.
Maybe we can only support mut/ref
patterns and {xyz} @ ...
patterns so that we always have an identifier we can use (where {xyz}
is any binding, so we need to get rid of mut/ref
again).
let phantom_ident = format_ident!("__phantom{i}"); | ||
let phantom_ident = format_ident!("__phantom{}", i); |
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'm not sure why you changed this
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'm not sure why you changed this
i think that is the wrong way of formatting. format_ident!("__phantom{i}")
treats {i}
as a literal, so the identifier becomes __phantom{i}
exactly, without replacing i with its value.
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'm pretty sure the {i}
works because it generates the right code. Also format_ident!
uses std::format!
under the hood and the new format!()
syntax is supported since Rust 1.58.
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'm pretty sure the
{i}
works because it generates the right code. Alsoformat_ident!
usesstd::format!
under the hood and the newformat!()
syntax is supported since Rust 1.58.
im sorry i didnt know that 😓 ill fix it right away
Also it would be great if you could add some tests to |
sure ill get to it right away 👍🏽 |
Hi I'm wondering if you maybe forgot to push your changes to the remote or if you're still working on this. Either way is fine! |
closes #718
The fix removes pattern modifiers when generating the props struct, ensuring valid syntax
while preserving intended mutability semantics within the component function.