Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions crates/bevy_scene/macros/src/bsn/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ impl<const ALLOW_FLAT: bool> Bsn<ALLOW_FLAT> {
/// Converts to tokens and performs validation checks.
/// Accumulates errors in [`BsnCodegenCtx`].
pub fn try_to_tokens(&self, ctx: &mut BsnCodegenCtx) -> syn::Result<TokenStream> {
let bevy_scene = ctx.bevy_scene;
let entries: Vec<_> = self
.entries
.iter()
Expand All @@ -110,8 +111,7 @@ impl<const ALLOW_FLAT: bool> Bsn<ALLOW_FLAT> {
.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 {
Expand Down Expand Up @@ -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();
Expand Down
20 changes: 20 additions & 0 deletions crates/bevy_scene/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}
}