Updated TODO added another test for allowed_in_when validation.
This commit is contained in:
parent
b506dc8466
commit
ed9ef2efbb
5
TODO.md
5
TODO.md
|
@ -4,11 +4,10 @@
|
|||
|
||||
Things that must be done first because they influence the core API design that is used to do all the rest.
|
||||
|
||||
* Implement validation for inherit overrides changing captured properties.
|
||||
* Change capture-only in widget declaration to need type tokens in a tt group, improve validation after doing this.
|
||||
* What to do with capture-only in mix-ins?
|
||||
* Replace the `implicit_mixin` with a `base_widget`?
|
||||
* Custom default property values, `#[property(context, default <see macro_design.rs>)]`.
|
||||
* Improve property allowed_in_when validation for generics, generate a `new` like call for each
|
||||
argument, instead of all at once.
|
||||
* Test `#[cfg(..)]` support in widget declarations.
|
||||
* Use something like this [https://docs.rs/crate/xss-probe/0.2.0/source/build.rs] to patch docs.
|
||||
* Link property declaration to their source-code point.
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
use zero_ui::core::{property, var::IntoVar, UiNode};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct MyType;
|
||||
impl IntoVar<bool> for MyType {
|
||||
type Var = zero_ui::core::var::OwnedVar<bool>;
|
||||
|
||||
fn into_var(self) -> Self::Var {
|
||||
zero_ui::core::var::OwnedVar(true)
|
||||
}
|
||||
}
|
||||
|
||||
#[property(context)]
|
||||
pub fn invalid(child: impl UiNode, value: MyType) -> impl UiNode {
|
||||
let _ = value;
|
||||
// for allowed_in_when, the arg type needs to be IntoVar AND accept the resulting var back.
|
||||
child
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,8 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/allowed_in_when_validation_back_to_args.rs:14:43
|
||||
|
|
||||
14 | pub fn invalid(child: impl UiNode, value: MyType) -> impl UiNode {
|
||||
| ^^^^^^ expected struct `MyType`, found struct `OwnedVar`
|
||||
|
|
||||
= note: expected struct `MyType`
|
||||
found struct `OwnedVar<bool>`
|
Loading…
Reference in New Issue