Skip to content
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

Properly support patterns in inline_props #760

Merged
merged 3 commits into from
Nov 17, 2024

Conversation

lukechu10
Copy link
Member

Supersedes #720
Closes #718

This PR also adds support for sub-patterns such as:

#[component(inline_props)]
fn Foo(bar @ Bar { abc }: Bar) -> View { ... }

Note that we require at least an identifier in order to give a name to the prop.

@lukechu10 lukechu10 added C-enhancement Category: new feature or improvement to existing feature A-macro Area: macros labels Nov 17, 2024
@lukechu10 lukechu10 requested a review from Copilot November 17, 2024 14:26

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 3 out of 4 changed files in this pull request and generated no suggestions.

Files not reviewed (1)
  • packages/sycamore-macro/tests/component/inline-props-fail.stderr: Language not supported
Comments skipped due to low confidence (2)

packages/sycamore-macro/src/component.rs:288

  • The error message 'receiver cannot be a prop' could be more informative. Consider changing it to 'Function receiver cannot be used as a property in a component.'
receiver.span(), "receiver cannot be a prop",

packages/sycamore-macro/src/component.rs:302

  • The error message 'unexpected pattern, you must specify an identifier for the prop' could be more informative. Consider changing it to 'Unexpected pattern found. Please specify an identifier for the property.'
pat_type.pat.span(), "unexpected pattern, you must specify an identifier for the prop",
Copy link

codecov bot commented Nov 17, 2024

Codecov Report

Attention: Patch coverage is 51.85185% with 13 lines in your changes missing coverage. Please review.

Project coverage is 71.40%. Comparing base (1e492e2) to head (f7f79e8).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/sycamore-macro/src/component.rs 51.85% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #760      +/-   ##
==========================================
- Coverage   71.50%   71.40%   -0.10%     
==========================================
  Files          45       45              
  Lines        6632     6644      +12     
==========================================
+ Hits         4742     4744       +2     
- Misses       1890     1900      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lukechu10 lukechu10 requested a review from Copilot November 17, 2024 14:31

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 3 out of 4 changed files in this pull request and generated no suggestions.

Files not reviewed (1)
  • packages/sycamore-macro/tests/component/inline-props-fail.stderr: Language not supported
@lukechu10 lukechu10 merged commit 3b84a8b into sycamore-rs:main Nov 17, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macro Area: macros C-enhancement Category: new feature or improvement to existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inline props does not properly support patterns
1 participant