Skip to content

AST visitors silently drop VARIABLE-typed children — affects FunctionInvocation::arguments(), IdInColl::collection(), ForeachClause::list() #44

Description

@arvindsh

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingkilo-auto-fixAuto-generated label by Kilokilo-triagedAuto-generated label by KilorustPull requests that update rust code

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions