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 generic props structs #2746
Conversation
Visit the preview URL for this PR (updated for commit b83695f): https://yew-rs-api--pr2746-prop-inheritance-zq5xlke7.web.app (expires Wed, 29 Jun 2022 20:30:53 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
@maurerdietmar if you have time to check, I think this fixes your issue. @hamza1311 aha! the issue with |
Size Comparison
✅ None of the examples has changed their size significantly. |
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.
Looks good
The comments are unrelated to this PR but should be resolved (in a future PR). I must've missed the output spans while reviewing the previous one
--> tests/html_macro/component-fail.rs:94:10 | ||
| | ||
94 | <Child ..ChildProperties { string: "hello".to_owned(), int: 5 }> | ||
| ^^^^^ unknown field |
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.
This is a bad span. Can we do better?
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 agree in principle, but don't want to block this PR with this. The errors were like this before, even before #2729 . This PR only affects the order in which errors are reported, since they emit from a non-const context again. Don't ask me why that changes the order of error reporting though, idk :)
Note that this bad span is only for field children
. Not sure what's a better span here.
27 | html! { <Comp<MissingTypeBounds> /> }; | ||
| ^^^^ the trait `yew::BaseComponent` is not implemented for `Comp<MissingTypeBounds>` |
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.
Span should reference MissingTypeBounds here
Yes, this fixes my issue. |
Description
Fixup of #2729 for generic property structs. I mistakenly converted the checks guarded by
if false
to aconst _: ()
check, which makes generic arguments from the context invisible, leading to the problemThis also for some reason changes the order in which errors are reported with trybuild.
Checklist