diff --git a/crates/cgp-macro-lib/src/check_components/derive.rs b/crates/cgp-macro-lib/src/check_components/derive.rs index 91ce6dc2..bc1bbb16 100644 --- a/crates/cgp-macro-lib/src/check_components/derive.rs +++ b/crates/cgp-macro-lib/src/check_components/derive.rs @@ -1,12 +1,14 @@ use quote::quote; +use syn::punctuated::Punctuated; +use syn::token::Comma; use syn::{ItemImpl, ItemTrait, Type, parse2}; use crate::check_components::override_span; use crate::parse::{CheckComponents, CheckEntry}; pub fn derive_check_components(spec: &CheckComponents) -> syn::Result<(ItemTrait, Vec)> { - if let Some(providers) = &spec.check_provider { - return derive_check_provider(spec, providers); + if let Some(check_providers) = &spec.check_providers { + return derive_check_provider(spec, check_providers); } let mut item_impls = Vec::new(); @@ -49,7 +51,7 @@ pub fn derive_check_components(spec: &CheckComponents) -> syn::Result<(ItemTrait pub fn derive_check_provider( spec: &CheckComponents, - providers: &[Type], + providers: &Punctuated, ) -> syn::Result<(ItemTrait, Vec)> { let mut item_impls = Vec::new(); let unit: Type = parse2(quote!(()))?; diff --git a/crates/cgp-macro-lib/src/entrypoints/delegate_and_check_components.rs b/crates/cgp-macro-lib/src/entrypoints/delegate_and_check_components.rs index 00ca7393..7a8fcd07 100644 --- a/crates/cgp-macro-lib/src/entrypoints/delegate_and_check_components.rs +++ b/crates/cgp-macro-lib/src/entrypoints/delegate_and_check_components.rs @@ -9,7 +9,7 @@ use crate::check_components::derive_check_components; use crate::delegate_components::impl_delegate_components; use crate::parse::{ CheckComponents, CheckEntries, CheckEntry, DelegateAndCheckSpec, DelegateEntry, DelegateKey, - DelegateValue, ImplGenerics, + ImplGenerics, }; pub fn delegate_and_check_components(body: TokenStream) -> syn::Result { @@ -19,13 +19,24 @@ pub fn delegate_and_check_components(body: TokenStream) -> syn::Result check_params + .iter() + .map(|generic| CheckEntry { + component_type: component_type.clone(), + component_params: Some(generic.clone()), + span, + }) + .collect::>(), + None => vec![CheckEntry { + component_type: component_type.clone(), + component_params: None, + span, + }], } }) }) @@ -38,27 +49,25 @@ pub fn delegate_and_check_components(body: TokenStream) -> syn::Result, } pub struct CheckComponents { - pub check_provider: Option>, + pub check_providers: Option>, pub impl_generics: ImplGenerics, pub trait_name: Ident, pub context_type: Type, @@ -49,29 +50,38 @@ impl Parse for CheckComponentsSpecs { impl Parse for CheckComponents { fn parse(input: ParseStream) -> syn::Result { - let check_provider = if input.peek(Pound) { - let _: Pound = input.parse()?; - - let content; - bracketed!(content in input); - - let command: Ident = content.parse()?; - if command != "check_providers" { - return Err(syn::Error::new( - command.span(), - "expected `check_providers` attribute", - )); + let mut check_providers: Option> = None; + let mut m_check_trait_name: Option = None; + + if input.peek(Pound) { + let attributes = input.call(Attribute::parse_outer)?; + + for attribute in attributes { + if attribute.path().is_ident("check_providers") { + let provider_types: Punctuated = + attribute.parse_args_with(Punctuated::parse_terminated)?; + + check_providers + .get_or_insert_default() + .extend(provider_types); + } else if attribute.path().is_ident("check_trait") { + let check_trait_name: Ident = attribute.parse_args()?; + + if m_check_trait_name.is_some() { + return Err(syn::Error::new( + attribute.span(), + "Multiple `#[check_trait]` attributes found. Expected at most one.", + )); + } + + m_check_trait_name = Some(check_trait_name); + } else { + return Err(syn::Error::new( + attribute.span(), + format!("Invalid attribute {}", attribute.to_token_stream()), + )); + } } - - let raw_providers; - parenthesized!(raw_providers in content); - - let provider_types: Punctuated = - Punctuated::parse_terminated(&raw_providers)?; - - Some(provider_types.into_iter().collect()) - } else { - None }; let impl_generics = if input.peek(Lt) { @@ -80,11 +90,18 @@ impl Parse for CheckComponents { Default::default() }; - let trait_name = input.parse()?; + let context_type: Type = input.parse()?; - let _: For = input.parse()?; + let trait_name = if let Some(check_trait_name) = m_check_trait_name { + check_trait_name + } else { + let context_type: SimpleType = parse2(context_type.to_token_stream())?; - let context_type: Type = input.parse()?; + Ident::new( + &format!("__CanUse{}", context_type.name), + context_type.span(), + ) + }; let where_clause = if input.peek(Where) { input.parse()? @@ -101,7 +118,7 @@ impl Parse for CheckComponents { let entries: CheckEntries = content.parse()?; Ok(Self { - check_provider, + check_providers, impl_generics, trait_name, context_type, diff --git a/crates/cgp-macro-lib/src/parse/delegate_and_check_components.rs b/crates/cgp-macro-lib/src/parse/delegate_and_check_components.rs index 7e63ed6d..118d0f5e 100644 --- a/crates/cgp-macro-lib/src/parse/delegate_and_check_components.rs +++ b/crates/cgp-macro-lib/src/parse/delegate_and_check_components.rs @@ -1,25 +1,32 @@ use core::iter; +use quote::ToTokens; use syn::parse::{Parse, ParseStream}; use syn::punctuated::Punctuated; -use syn::token::{Bracket, Comma, For, Lt, Semi}; -use syn::{Ident, Type, braced, bracketed}; +use syn::spanned::Spanned; +use syn::token::{Bracket, Comma, Lt, Pound}; +use syn::{Attribute, Ident, Type, braced, bracketed, parse2}; -use crate::parse::{DelegateMode, ImplGenerics}; +use crate::parse::{DelegateMode, DelegateValue, ImplGenerics, SimpleType}; pub struct DelegateAndCheckSpec { pub impl_generics: ImplGenerics, pub trait_name: Ident, pub context_type: Type, - pub provider_type: Type, pub entries: Punctuated, } #[derive(Clone)] pub struct DelegateAndCheckEntry { - pub keys: Punctuated, + pub keys: Punctuated, pub mode: DelegateMode, - pub value: Type, + pub value: DelegateValue, +} + +#[derive(Clone)] +pub struct DelegateAndCheckKey { + pub component_type: Type, + pub check_params: Option>, } impl Parse for DelegateAndCheckSpec { @@ -30,15 +37,20 @@ impl Parse for DelegateAndCheckSpec { Default::default() }; - let trait_name = input.parse()?; - - let _: For = input.parse()?; + let m_trait_name = parse_check_trait_name(input)?; - let context_type = input.parse()?; + let context_type: Type = input.parse()?; - let _: Semi = input.parse()?; - - let provider_type = input.parse()?; + let trait_name = match m_trait_name { + Some(ident) => ident, + None => { + let context_type: SimpleType = parse2(context_type.to_token_stream())?; + Ident::new( + &format!("__CanUse{}", context_type.name), + context_type.span(), + ) + } + }; let entries = { let body; @@ -50,7 +62,6 @@ impl Parse for DelegateAndCheckSpec { impl_generics, trait_name, context_type, - provider_type, entries, }) } @@ -58,15 +69,25 @@ impl Parse for DelegateAndCheckSpec { impl Parse for DelegateAndCheckEntry { fn parse(input: ParseStream) -> syn::Result { - let keys = if input.peek(Bracket) { + let check_params = parse_check_params(input)?; + + let mut keys = if input.peek(Bracket) { let body; bracketed!(body in input); Punctuated::parse_terminated(&body)? } else { - let key: Type = input.parse()?; + let key: DelegateAndCheckKey = input.parse()?; Punctuated::from_iter(iter::once(key)) }; + if let Some(check_params) = check_params { + for key in &mut keys { + key.check_params + .get_or_insert_default() + .extend(check_params.clone()); + } + } + let mode = input.parse()?; let value = input.parse()?; @@ -74,3 +95,62 @@ impl Parse for DelegateAndCheckEntry { Ok(Self { keys, mode, value }) } } + +impl Parse for DelegateAndCheckKey { + fn parse(input: ParseStream) -> syn::Result { + let check_params = parse_check_params(input)?; + + let component_type: Type = input.parse()?; + Ok(Self { + component_type, + check_params, + }) + } +} + +pub fn parse_check_trait_name(input: ParseStream) -> syn::Result> { + if input.peek(Pound) { + let attributes = input.call(Attribute::parse_outer)?; + + let [attribute]: [Attribute; 1] = attributes + .try_into() + .map_err(|_| input.error("Expected exactly one attribute for the check trait name"))?; + + if !attribute.path().is_ident("check_trait") { + return Err(syn::Error::new( + attribute.span(), + "Expected `#[check_trait]` attribute for specifying the check trait name", + )); + } + + let ident: Ident = attribute.parse_args()?; + Ok(Some(ident)) + } else { + Ok(None) + } +} + +pub fn parse_check_params(input: ParseStream) -> syn::Result>> { + if input.peek(Pound) { + let attributes = input.call(Attribute::parse_outer)?; + + let [attribute]: [Attribute; 1] = attributes + .try_into() + .map_err(|_| input.error("Expected exactly one key attribute"))?; + + let check_params = if attribute.path().is_ident("check_params") { + attribute.parse_args_with(Punctuated::parse_terminated)? + } else if attribute.path().is_ident("skip_check") { + Punctuated::new() + } else { + return Err(syn::Error::new( + attribute.span(), + "Expected either `#[skip_check]` or `#[check_params]` attribute for specifying the check generics", + )); + }; + + Ok(Some(check_params)) + } else { + Ok(None) + } +} diff --git a/crates/cgp-tests/src/tests/check_components.rs b/crates/cgp-tests/src/tests/check_components.rs index 7bd60ba1..f32036d1 100644 --- a/crates/cgp-tests/src/tests/check_components.rs +++ b/crates/cgp-tests/src/tests/check_components.rs @@ -36,15 +36,29 @@ pub fn test_basic_check_components() { pub extra_dummy: (), } - delegate_components! { + delegate_and_check_components! { Context { [ FooTypeProviderComponent, BarTypeProviderComponent, ]: UseType<()>, + + #[check_params( + (Index<5>, Index<6>), + (Index<7>, Index<8>), + )] [ + #[check_params( + Index<0>, + Index<1>, + )] FooGetterAtComponent, + + #[check_params( + (Index<0>, Index<1>), + (Index<1>, Index<0>), + )] BarGetterAtComponent, ]: UseField, @@ -52,7 +66,8 @@ pub fn test_basic_check_components() { } check_components! { - CanUseContext for Context { + #[check_trait(CanUseContext)] + Context { FooTypeProviderComponent, BarTypeProviderComponent, FooGetterAtComponent: [ @@ -63,7 +78,8 @@ pub fn test_basic_check_components() { Index<3>, } - CanUseContext2 for Context { + #[check_trait(CanUseContext2)] + Context { BarGetterAtComponent: [ (Index<0>, Index<1>), (Index<1>, Index<0>), @@ -79,11 +95,12 @@ pub fn test_basic_check_components() { ] } + #[check_trait(CanUseDummyField)] #[check_providers( UseField, UseField, )] - CanUseDummyField for Context { + Context { FooGetterAtComponent: [ Index<0>, Index<1>, @@ -155,8 +172,7 @@ pub fn test_generic_check_components() { } check_components! { - <'a, I> - CanUseContext for Context + <'a, I> Context where I: Clone, { diff --git a/crates/cgp-tests/src/tests/delegate_and_check_components.rs b/crates/cgp-tests/src/tests/delegate_and_check_components.rs index e737e034..b43e2827 100644 --- a/crates/cgp-tests/src/tests/delegate_and_check_components.rs +++ b/crates/cgp-tests/src/tests/delegate_and_check_components.rs @@ -19,7 +19,7 @@ pub fn test_basic_delegate_and_check_components() { } delegate_and_check_components! { - CanUseMyContext for MyContext; + #[check_trait(CheckMyContext)] MyContext { NameTypeProviderComponent: UseType, NameGetterComponent: UseField, @@ -45,7 +45,6 @@ pub fn test_generic_delegate_and_check_components() { delegate_and_check_components! { - CanUseMyContext for MyContext; MyContext { NameTypeProviderComponent: UseType, NameGetterComponent: UseField, diff --git a/crates/cgp-tests/src/tests/has_field/chain.rs b/crates/cgp-tests/src/tests/has_field/chain.rs index 51fb47c8..2d6119d9 100644 --- a/crates/cgp-tests/src/tests/has_field/chain.rs +++ b/crates/cgp-tests/src/tests/has_field/chain.rs @@ -109,7 +109,6 @@ fn test_deeply_nested_getter() { } delegate_and_check_components! { - CanUseMyContext for MyContext; MyContext { NameGetterComponent: WithProvider< ChainGetters, Index<0>), + (Index<0>, Index<1>), + )] FooTypeProviderAtComponent: UseDelegate< new FooTypes { Index<1>: UseType, Index<0>: UseType, } >, + + #[check_params( + (Index<1>, Index<0>), + (Index<0>, Index<1>), + )] FooGetterAtComponent: UseDelegate< new FooGetters { Index<1>: UseField, @@ -52,7 +61,8 @@ pub fn test_derive_delegate() { } check_components! { - CanUseMyContext for MyContext { + #[check_trait(CanUseMyContext)] + MyContext { FooGetterAtComponent: [ (Index<1>, Index<0>), (Index<0>, Index<1>), @@ -95,7 +105,7 @@ pub fn test_derive_delegate2() { } check_components! { - CanUseMyContext for MyContext { + MyContext { FooGetterAtComponent: [ (Index<1>, Index<0>), (Index<0>, Index<1>), diff --git a/crates/cgp-tests/tests/component_tests/abstract_types/basic.rs b/crates/cgp-tests/tests/component_tests/abstract_types/basic.rs index cf0a495a..e7c28fa2 100644 --- a/crates/cgp-tests/tests/component_tests/abstract_types/basic.rs +++ b/crates/cgp-tests/tests/component_tests/abstract_types/basic.rs @@ -33,7 +33,6 @@ pub struct Rectangle { } delegate_and_check_components! { - CanUseRectangle for Rectangle; Rectangle { ErrorTypeProviderComponent: UseType, diff --git a/crates/cgp-tests/tests/component_tests/abstract_types/extend.rs b/crates/cgp-tests/tests/component_tests/abstract_types/extend.rs index 5c275841..33f00d79 100644 --- a/crates/cgp-tests/tests/component_tests/abstract_types/extend.rs +++ b/crates/cgp-tests/tests/component_tests/abstract_types/extend.rs @@ -37,7 +37,6 @@ pub struct Rectangle { } delegate_and_check_components! { - CanUseRectangle for Rectangle; Rectangle { ErrorTypeProviderComponent: UseType, diff --git a/crates/cgp-tests/tests/component_tests/abstract_types/foreign.rs b/crates/cgp-tests/tests/component_tests/abstract_types/foreign.rs index 7fe7bbde..2818e32d 100644 --- a/crates/cgp-tests/tests/component_tests/abstract_types/foreign.rs +++ b/crates/cgp-tests/tests/component_tests/abstract_types/foreign.rs @@ -48,7 +48,7 @@ delegate_components! { } check_components! { - CanUseRectangle for Rectangle { + Rectangle { AreaCalculatorComponent: Types, } } diff --git a/crates/cgp-tests/tests/component_tests/abstract_types/self_referential.rs b/crates/cgp-tests/tests/component_tests/abstract_types/self_referential.rs index ee7112b4..ee96d510 100644 --- a/crates/cgp-tests/tests/component_tests/abstract_types/self_referential.rs +++ b/crates/cgp-tests/tests/component_tests/abstract_types/self_referential.rs @@ -17,7 +17,7 @@ delegate_components! { } check_components! { - CanUseApp for App { + App { ScalarTypeProviderComponent, } } diff --git a/crates/cgp-tests/tests/component_tests/cgp_component/constant.rs b/crates/cgp-tests/tests/component_tests/cgp_component/constant.rs index 2e018066..1f8e018c 100644 --- a/crates/cgp-tests/tests/component_tests/cgp_component/constant.rs +++ b/crates/cgp-tests/tests/component_tests/cgp_component/constant.rs @@ -16,7 +16,6 @@ pub fn test_component_with_const() { pub struct MyContext; delegate_and_check_components! { - CanUseMyContext for MyContext; MyContext { ConstantGetterComponent: UseConstant<42>, } @@ -56,7 +55,7 @@ pub fn test_component_with_generic_const() { } check_components! { - CanUseMyContext for MyContext { + MyContext { ConstantGetterComponent, } } diff --git a/crates/cgp-tests/tests/component_tests/cgp_component/lifetime.rs b/crates/cgp-tests/tests/component_tests/cgp_component/lifetime.rs index e3730a6f..af0e4439 100644 --- a/crates/cgp-tests/tests/component_tests/cgp_component/lifetime.rs +++ b/crates/cgp-tests/tests/component_tests/cgp_component/lifetime.rs @@ -34,7 +34,7 @@ delegate_components! { } check_components! { - <'a> CanUseApp for App<'a> { + <'a> App<'a> { ReferenceGetterComponent: (Life<'a>, str), } diff --git a/crates/cgp-tests/tests/component_tests/cgp_impl/implicit_args/basic.rs b/crates/cgp-tests/tests/component_tests/cgp_impl/implicit_args/basic.rs index a80440a0..99d88075 100644 --- a/crates/cgp-tests/tests/component_tests/cgp_impl/implicit_args/basic.rs +++ b/crates/cgp-tests/tests/component_tests/cgp_impl/implicit_args/basic.rs @@ -19,7 +19,6 @@ pub struct Rectangle { } delegate_and_check_components! { - CanUseRectangle for Rectangle; Rectangle { AreaCalculatorComponent: RectangleArea, diff --git a/crates/cgp-tests/tests/component_tests/cgp_impl/implicit_args/generics.rs b/crates/cgp-tests/tests/component_tests/cgp_impl/implicit_args/generics.rs index 2eb47f51..52709142 100644 --- a/crates/cgp-tests/tests/component_tests/cgp_impl/implicit_args/generics.rs +++ b/crates/cgp-tests/tests/component_tests/cgp_impl/implicit_args/generics.rs @@ -31,7 +31,7 @@ delegate_components! { } check_components! { - CanUseRectangle for Rectangle { + Rectangle { AreaCalculatorComponent: f64, } } diff --git a/crates/cgp-tests/tests/component_tests/cgp_impl/implicit_args/import.rs b/crates/cgp-tests/tests/component_tests/cgp_impl/implicit_args/import.rs index d7692e2e..c946e12a 100644 --- a/crates/cgp-tests/tests/component_tests/cgp_impl/implicit_args/import.rs +++ b/crates/cgp-tests/tests/component_tests/cgp_impl/implicit_args/import.rs @@ -25,7 +25,6 @@ pub struct Rectangle { } delegate_and_check_components! { - CanUseRectangle for Rectangle; Rectangle { AreaCalculatorComponent: RectangleAreaCalculator, diff --git a/crates/cgp-tests/tests/extensible_data_tests/variants/shape.rs b/crates/cgp-tests/tests/extensible_data_tests/variants/shape.rs index 252f8739..83c07bb5 100644 --- a/crates/cgp-tests/tests/extensible_data_tests/variants/shape.rs +++ b/crates/cgp-tests/tests/extensible_data_tests/variants/shape.rs @@ -205,7 +205,7 @@ delegate_components! { } check_components! { - CanUseApp for App { + App { ComputerComponent: [ ((), Shape), ((), ShapePlus), diff --git a/crates/cgp-tests/tests/handler_tests/pipe.rs b/crates/cgp-tests/tests/handler_tests/pipe.rs index 538d661b..29fb2a97 100644 --- a/crates/cgp-tests/tests/handler_tests/pipe.rs +++ b/crates/cgp-tests/tests/handler_tests/pipe.rs @@ -57,7 +57,7 @@ pub fn test_pipe_computers() { check_components! { - CanUseMyContext for MyContext { + MyContext { ComputerComponent: (Tag, u64), } } @@ -126,7 +126,7 @@ pub fn test_pipe_handlers() { check_components! { - CanUseMyContext for MyContext { + MyContext { HandlerComponent: (Tag, u64), } } diff --git a/crates/cgp-tests/tests/preset_tests/basic/consumer_delegate.rs b/crates/cgp-tests/tests/preset_tests/basic/consumer_delegate.rs index 396d18f6..12130a7f 100644 --- a/crates/cgp-tests/tests/preset_tests/basic/consumer_delegate.rs +++ b/crates/cgp-tests/tests/preset_tests/basic/consumer_delegate.rs @@ -19,7 +19,7 @@ impl HasBar for MyContext { } check_components! { - CanUseMyContext for MyContext { + MyContext { FooTypeProviderComponent, BarTypeProviderComponent, FooGetterComponent, diff --git a/crates/cgp-tests/tests/preset_tests/basic/contexts.rs b/crates/cgp-tests/tests/preset_tests/basic/contexts.rs index 56e222af..e9a03f01 100644 --- a/crates/cgp-tests/tests/preset_tests/basic/contexts.rs +++ b/crates/cgp-tests/tests/preset_tests/basic/contexts.rs @@ -19,7 +19,7 @@ delegate_components! { } check_components! { - CanUseMyContext for MyContext { + MyContext { FooTypeProviderComponent, BarTypeProviderComponent, FooGetterComponent, diff --git a/crates/cgp-tests/tests/preset_tests/generics/consumer_delegate.rs b/crates/cgp-tests/tests/preset_tests/generics/consumer_delegate.rs index 06eae6e4..55bd3295 100644 --- a/crates/cgp-tests/tests/preset_tests/generics/consumer_delegate.rs +++ b/crates/cgp-tests/tests/preset_tests/generics/consumer_delegate.rs @@ -13,7 +13,8 @@ pub struct MyContext { } check_components! { - CanUseMyContext for MyContext { + #[check_trait(CanUseMyContext)] + MyContext { FooTypeProviderComponent, BarTypeProviderComponent, BarGetterComponent, @@ -21,8 +22,8 @@ check_components! { } check_components! { - - CanUseFooGetter for MyContext { + #[check_trait(CanUseFooGetter)] + MyContext { FooGetterComponent>: Index, } } diff --git a/crates/cgp-tests/tests/preset_tests/generics/contexts.rs b/crates/cgp-tests/tests/preset_tests/generics/contexts.rs index 06eae6e4..55bd3295 100644 --- a/crates/cgp-tests/tests/preset_tests/generics/contexts.rs +++ b/crates/cgp-tests/tests/preset_tests/generics/contexts.rs @@ -13,7 +13,8 @@ pub struct MyContext { } check_components! { - CanUseMyContext for MyContext { + #[check_trait(CanUseMyContext)] + MyContext { FooTypeProviderComponent, BarTypeProviderComponent, BarGetterComponent, @@ -21,8 +22,8 @@ check_components! { } check_components! { - - CanUseFooGetter for MyContext { + #[check_trait(CanUseFooGetter)] + MyContext { FooGetterComponent>: Index, } } diff --git a/crates/cgp-tests/tests/preset_tests/generics_inheritance/contexts.rs b/crates/cgp-tests/tests/preset_tests/generics_inheritance/contexts.rs index d6548df8..84248ef6 100644 --- a/crates/cgp-tests/tests/preset_tests/generics_inheritance/contexts.rs +++ b/crates/cgp-tests/tests/preset_tests/generics_inheritance/contexts.rs @@ -13,15 +13,15 @@ pub struct MyContext { } check_components! { - CanUseMyContext for MyContext { + MyContext { FooTypeProviderComponent, BarTypeProviderComponent, } } check_components! { - - CanUseFooGetter for MyContext { + #[check_trait(CanUseFooGetter)] + MyContext { [ FooGetterComponent, BarGetterComponent, diff --git a/crates/cgp-tests/tests/preset_tests/inheritance/contexts.rs b/crates/cgp-tests/tests/preset_tests/inheritance/contexts.rs index a7c994db..cda5816c 100644 --- a/crates/cgp-tests/tests/preset_tests/inheritance/contexts.rs +++ b/crates/cgp-tests/tests/preset_tests/inheritance/contexts.rs @@ -13,7 +13,7 @@ pub struct MyContext { } check_components! { - CanUseMyContext for MyContext { + MyContext { FooTypeProviderComponent, BarTypeProviderComponent, FooGetterComponent, diff --git a/crates/cgp-tests/tests/preset_tests/nested_inheritance/contexts.rs b/crates/cgp-tests/tests/preset_tests/nested_inheritance/contexts.rs index 5cca37b7..da718ab4 100644 --- a/crates/cgp-tests/tests/preset_tests/nested_inheritance/contexts.rs +++ b/crates/cgp-tests/tests/preset_tests/nested_inheritance/contexts.rs @@ -15,7 +15,7 @@ pub struct MyContext { } check_components! { - CanUseMyContext for MyContext { + MyContext { FooTypeProviderComponent, BarTypeProviderComponent, FooGetterComponent, diff --git a/crates/cgp-tests/tests/preset_tests/wrapped/context.rs b/crates/cgp-tests/tests/preset_tests/wrapped/context.rs index 93f0bec2..c6ea5526 100644 --- a/crates/cgp-tests/tests/preset_tests/wrapped/context.rs +++ b/crates/cgp-tests/tests/preset_tests/wrapped/context.rs @@ -17,7 +17,7 @@ delegate_components! { } check_components! { - CanUseMyContext for MyContext { + MyContext { ErrorRaiserComponent: [ BoxError, Infallible,