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
14 lines
304 B
JSON
14 lines
304 B
JSON
{
|
|
"description": "error that nothing else has attributed is still reported against the boolean operator",
|
|
"expr": "(true and {\"k\": $.a, \"k\": $.b})",
|
|
"data": {
|
|
"a": 1,
|
|
"b": 2
|
|
},
|
|
"bindings": {},
|
|
"error": {
|
|
"code": "D1009",
|
|
"token": "and"
|
|
}
|
|
}
|