3 Commits
Author SHA1 Message Date
dualfroz 61a5a03b4c Describe this repository 2026-10-22 21:04:22 +02:00
dualfroz deaab007e1 fix: keep the original error attribution for and/or operands
To allow short-circuiting, the RHS of `and`/`or` is evaluated lazily
inside evaluateBooleanExpression, so it runs inside the try block of
evaluateBinary. Every error raised while evaluating that operand was then
stamped with the operator's own token and position, hiding what actually
failed:

  1=1 and $contains([''], '')
  // Argument 1 of function "and" does not match function signature

The same expression inside a user-defined function reports "contains"
correctly, because there the operand is evaluated at the call site. The
other binary operators are unaffected: they evaluate the RHS before the
try block, so `1 + $contains([''], '')` already reports "contains".

Only claim the error for the operator when nothing else has attributed it
yet, which is the same guard already used when applying a procedure.
fn.boolean cannot throw, so an error reaching this catch always comes from
the operand. Errors that carry no token (a duplicate group key, for
example) are still reported against the operator exactly as before.

Fixes #765
2026-09-03 14:47:14 +02:00
upstream 71e11d602e Upstream jsonata-js/jsonata state of the touched files before edb1e44849 2026-09-03 14:47:14 +02:00