diff --git a/crates/bevy_reflect/bevy_reflect_derive/src/utility.rs b/crates/bevy_reflect/bevy_reflect_derive/src/utility.rs index 0cd4c88b4c..1adc5787e5 100644 --- a/crates/bevy_reflect/bevy_reflect_derive/src/utility.rs +++ b/crates/bevy_reflect/bevy_reflect_derive/src/utility.rs @@ -132,9 +132,9 @@ impl WhereClauseOptions { let custom_bounds = active_bounds(field).map(|bounds| quote!(+ #bounds)); let bounds = if is_from_reflect { - quote!(#bevy_reflect_path::FromReflect #custom_bounds) + quote!(#bevy_reflect_path::FromReflect + #bevy_reflect_path::TypePath #custom_bounds) } else { - quote!(#bevy_reflect_path::Reflect #custom_bounds) + quote!(#bevy_reflect_path::Reflect + #bevy_reflect_path::TypePath #custom_bounds) }; (ty, bounds) diff --git a/crates/bevy_reflect_compile_fail_tests/tests/reflect_derive/nested.pass.rs b/crates/bevy_reflect_compile_fail_tests/tests/reflect_derive/nested.pass.rs new file mode 100644 index 0000000000..8be4d79e41 --- /dev/null +++ b/crates/bevy_reflect_compile_fail_tests/tests/reflect_derive/nested.pass.rs @@ -0,0 +1,16 @@ +use bevy_reflect::Reflect; + +mod nested_generics { + use super::*; + + #[derive(Reflect)] + struct Foo(T); + + #[derive(Reflect)] + struct Bar(Foo); + + #[derive(Reflect)] + struct Baz(Bar>); +} + +fn main() {}