diff --git a/crates/cgp-macro-lib/src/parse/check_components.rs b/crates/cgp-macro-lib/src/parse/check_components.rs index 74d636c6..887b3b46 100644 --- a/crates/cgp-macro-lib/src/parse/check_components.rs +++ b/crates/cgp-macro-lib/src/parse/check_components.rs @@ -98,7 +98,7 @@ impl Parse for CheckComponents { let context_type: SimpleType = parse2(context_type.to_token_stream())?; Ident::new( - &format!("__CanUse{}", context_type.name), + &format!("__Check{}", context_type.name), context_type.span(), ) }; 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 52709142..5032ca21 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 @@ -23,15 +23,10 @@ pub struct Rectangle { pub height: f64, } -delegate_components! { +delegate_and_check_components! { Rectangle { + #[check_params(f64)] AreaCalculatorComponent: RectangleArea, } } - -check_components! { - Rectangle { - AreaCalculatorComponent: f64, - } -} diff --git a/crates/cgp-tests/tests/component_tests/cgp_impl/shape.rs b/crates/cgp-tests/tests/component_tests/cgp_impl/shape.rs index 85dcdfda..337f6bd7 100644 --- a/crates/cgp-tests/tests/component_tests/cgp_impl/shape.rs +++ b/crates/cgp-tests/tests/component_tests/cgp_impl/shape.rs @@ -100,7 +100,7 @@ pub struct PlainRectangle { pub height: f64, } -delegate_components! { +delegate_and_check_components! { PlainRectangle { AreaCalculatorComponent: RectangleAreaCalculator, @@ -114,7 +114,7 @@ pub struct ScaledRectangle { pub height: f64, } -delegate_components! { +delegate_and_check_components! { ScaledRectangle { AreaCalculatorComponent: ScaledAreaCalculator, @@ -126,7 +126,7 @@ pub struct PlainCircle { pub radius: f64, } -delegate_components! { +delegate_and_check_components! { PlainCircle { AreaCalculatorComponent: CircleAreaCalculator, @@ -139,13 +139,24 @@ pub struct ScaledCircle { pub radius: f64, } -delegate_components! { +delegate_and_check_components! { ScaledCircle { AreaCalculatorComponent: ScaledAreaCalculator, } } +check_components! { + #[check_trait(CheckScaledRectangleProviders)] + #[check_providers( + RectangleAreaCalculator, + ScaledAreaCalculator, + )] + ScaledRectangle { + AreaCalculatorComponent, + } +} + #[test] fn test_scaled_area() { let rectangle = PlainRectangle {