Summary
Three sibling AST visitors filter out SyntaxKind::VARIABLE children
across the board when they should only skip the specific VARIABLE
node that is the iteration variable / function name. As a result, any
expression that uses a variable as a function argument or collection
silently loses that argument and surfaces downstream as either:
"<fn>() takes exactly N arguments" (the function appears to be
called with the wrong arity),
"missing collection in list comp" (the comprehension's collection
appears to be missing), or
- a silent zero-result for
FOREACH over a variable-typed list.
Affected sites
| Location |
Symptom |
src/syntax/ast/expressions.rs::FunctionInvocation::arguments() |
Every variable-reference function argument is dropped. abs(x), labels(n), size(s), head(lst), nodes(p), relationships(p), jaccard(s1, s2) all appear to be called with zero args. Literal arguments (abs(42), size([1,2,3])) survive because they are not VARIABLE nodes. |
src/syntax/ast/expressions.rs::IdInColl::collection() |
The collection in a list comprehension or IN-binding is dropped when it is a bare variable reference. [x IN s1 WHERE …] fails with internal error: missing collection in list comp. [x IN [1,2,3] WHERE …] works because the literal is not a VARIABLE. |
src/syntax/ast/clauses.rs::ForeachClause::list() |
The list expression in FOREACH (var IN someList…) is dropped when someList is a variable reference. |
Reproducer
WITH 42 AS s1 RETURN abs(s1) -- "abs() takes exactly 1 argument"
WITH [1,2,3] AS s RETURN size(s) -- "size() takes exactly 1 argument"
WITH [1,2] AS a, [2,3] AS b
RETURN jaccard(a, b) -- "jaccard() takes exactly 2 arguments"
WITH [1,2,3] AS s1, [3,4,5] AS s2
RETURN [x IN s1 WHERE x IN s2] -- "missing collection in list comp"
MATCH (n) WITH collect(n) AS ns FOREACH (m IN ns | DETACH DELETE m)
-- silently does nothing on the variable-typed list
Summary
Three sibling AST visitors filter out
SyntaxKind::VARIABLEchildrenacross the board when they should only skip the specific
VARIABLEnode that is the iteration variable / function name. As a result, any
expression that uses a variable as a function argument or collection
silently loses that argument and surfaces downstream as either:
"<fn>() takes exactly N arguments"(the function appears to becalled with the wrong arity),
"missing collection in list comp"(the comprehension's collectionappears to be missing), or
FOREACHover a variable-typed list.Affected sites
src/syntax/ast/expressions.rs::FunctionInvocation::arguments()abs(x),labels(n),size(s),head(lst),nodes(p),relationships(p),jaccard(s1, s2)all appear to be called with zero args. Literal arguments (abs(42),size([1,2,3])) survive because they are notVARIABLEnodes.src/syntax/ast/expressions.rs::IdInColl::collection()IN-binding is dropped when it is a bare variable reference.[x IN s1 WHERE …]fails withinternal error: missing collection in list comp.[x IN [1,2,3] WHERE …]works because the literal is not aVARIABLE.src/syntax/ast/clauses.rs::ForeachClause::list()FOREACH (var IN someList…)is dropped whensomeListis a variable reference.Reproducer