diff --git a/crates/bevy_scene/macros/src/bsn/codegen.rs b/crates/bevy_scene/macros/src/bsn/codegen.rs index 0134468c39c04..4bbb375f2a832 100644 --- a/crates/bevy_scene/macros/src/bsn/codegen.rs +++ b/crates/bevy_scene/macros/src/bsn/codegen.rs @@ -101,6 +101,7 @@ impl Bsn { /// Converts to tokens and performs validation checks. /// Accumulates errors in [`BsnCodegenCtx`]. pub fn try_to_tokens(&self, ctx: &mut BsnCodegenCtx) -> syn::Result { + let bevy_scene = ctx.bevy_scene; let entries: Vec<_> = self .entries .iter() @@ -110,8 +111,7 @@ impl Bsn { .unwrap_or_else(|e| e.to_compile_error()) }) .collect(); - - Ok(quote! { (#(#entries,)*) }) + Ok(quote! { #bevy_scene::auto_nest_tuple!(#(#entries),*) }) } pub fn to_tokens(&self, ctx: &mut BsnCodegenCtx) -> TokenStream { @@ -715,9 +715,8 @@ mod tests { #[test] fn bsn_root_preserves_inference_on_error() { // Arrange - let expected = "bevy_scene :: SceneScope ({ let _res = () ;".to_string() - + " :: core :: compile_error ! { \"Test Error\" }" - + " _res })"; + let expected = "bevy_scene :: SceneScope ({ let _res = bevy_scene :: auto_nest_tuple \ + ! () ; :: core :: compile_error ! { \"Test Error\" } _res })"; let mut refs = EntityRefs::default(); let paths = TestPaths::new(); diff --git a/crates/bevy_scene/src/lib.rs b/crates/bevy_scene/src/lib.rs index a7d464c17c5fa..f0928a52514c8 100644 --- a/crates/bevy_scene/src/lib.rs +++ b/crates/bevy_scene/src/lib.rs @@ -1197,4 +1197,24 @@ mod tests { } world.spawn_scene(yappy()).unwrap(); } + + #[test] + fn bsn_entry_can_surpass_tuple_limit() { + let _ = bsn! { + Name + Name + Name + Name + Name + Name + Name + Name + Name + Name + Name + Name + Name + Name + }; + } }