Skip to content

Resolve function calls consistently inside ClosedExpression binding #648

Description

@Seddryck

Bug

Function calls inside a ClosedExpression are not resolved using the same function catalog/binding context as function calls inside an OpenExpression.

Reproduction

The equivalent nested function call binds successfully when represented as an OpenExpression:

.\expressif bind 'even |or greater-than(add(17))'

Result:

OpenExpression
└─ Function: or
   ├─ Arg[0]: OpenExpression
   │  └─ Function: even
   └─ Arg[1]: OpenExpression
      └─ Function: greater-than
         └─ Arg[0]: OpenExpression
            └─ Function: add
               └─ Arg[0]: Literal = 17

But the same function call fails when it is part of a ClosedExpression:

.\expressif bind 'even |or greater-than(45 | add(17))'

Result:

Unknown function 'add'.

The parser correctly produces a ClosedExpression:

.\expressif parse 'even |or greater-than(45 | add(17))'
OpenExpression
└─ BinaryExpression
   ├─ FunctionCall: even
   ├─ BinaryOperator: OR
   └─ FunctionCall: greater-than
      └─ PositionalArgument
         └─ ClosedExpression
            ├─ NumericLiteral: 45
            └─ FunctionCall: add
               └─ PositionalArgument
                  └─ NumericLiteral: 17

Expected behavior

Function calls nested inside a ClosedExpression should be resolved through the same function catalog and binding context as function calls nested inside an OpenExpression.

The following should therefore bind successfully:

greater-than(45 | add(17))

and add should resolve to the same bound function implementation as it does in:

greater-than(add(17))

Scope

  • Ensure ClosedExpression binding carries the same function catalog/resolution context as OpenExpression binding.
  • Add regression tests covering function calls nested in closed expressions.
  • Include at least one comparison showing equivalent function resolution in open and closed expression arguments.

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 working

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions