diff --git a/crates/postgresql-cst-parser/src/tree_sitter/convert.rs b/crates/postgresql-cst-parser/src/tree_sitter/convert.rs index 304bdb8..bbacc72 100644 --- a/crates/postgresql-cst-parser/src/tree_sitter/convert.rs +++ b/crates/postgresql-cst-parser/src/tree_sitter/convert.rs @@ -143,7 +143,8 @@ fn walk_and_build( | SyntaxKind::indirection | SyntaxKind::expr_list | SyntaxKind::func_arg_list - | SyntaxKind::when_clause_list) => { + | SyntaxKind::when_clause_list + | SyntaxKind::sortby_list) => { if parent_kind == child_kind { // [Node: Flatten] // @@ -353,5 +354,14 @@ FROM assert_no_direct_nested_kind(&new_root, SyntaxKind::when_clause_list); } + + #[test] + fn no_nested_sortby_list() { + let input = "select * from t order by a, b, c;"; + let root = cst::parse(input).unwrap(); + let (new_root, _) = get_ts_tree_and_range_map(&input, &root); + + assert_no_direct_nested_kind(&new_root, SyntaxKind::sortby_list); + } } }