Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/tests/sourcegen_ast.rs')
-rw-r--r--crates/syntax/src/tests/sourcegen_ast.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/crates/syntax/src/tests/sourcegen_ast.rs b/crates/syntax/src/tests/sourcegen_ast.rs
index 36fedd2f0b..dcd813bbe0 100644
--- a/crates/syntax/src/tests/sourcegen_ast.rs
+++ b/crates/syntax/src/tests/sourcegen_ast.rs
@@ -81,10 +81,17 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: &AstSrc) -> String {
.map(|node| {
let name = format_ident!("{}", node.name);
let kind = format_ident!("{}", to_upper_snake_case(&node.name));
- let traits = node.traits.iter().map(|trait_name| {
- let trait_name = format_ident!("{}", trait_name);
- quote!(impl ast::#trait_name for #name {})
- });
+ let traits = node
+ .traits
+ .iter()
+ .filter(|trait_name| {
+ // For loops have two expressions so this might collide, therefor manual impl it
+ node.name != "ForExpr" || trait_name.as_str() != "HasLoopBody"
+ })
+ .map(|trait_name| {
+ let trait_name = format_ident!("{}", trait_name);
+ quote!(impl ast::#trait_name for #name {})
+ });
let methods = node.fields.iter().map(|field| {
let method_name = field.method_name();