-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
Consider the following test case:
let $fn := function($trigger as xs:boolean, $arg as array(*)) { if ($trigger) then ($arg[1]) else () } return $fn(true(), ())
This should (and does) throw an error XPTY0004 as the $arg argument is the empty sequence, not an array. However, now consider what happens if we set $trigger to false():
let $fn := function($trigger as xs:boolean, $arg as array(*)) { if ($trigger) then ($arg[1]) else () } return $fn(false(), ())
This technically does not use the $arg argument, so I'm not sure if it's required to throw here? Unfortunately though, the behavior is different depending on the value of the debug option. Worse, it throws only if debug is off, leading to errors that typically only occur in production setups.
With debug: true: returns "" (assuming evaluation to STRING)
With debug: false: throws Uncaught Error: XPTY0004: Multiplicity of function argument of type array(*) for dynamic-function is incorrect. Expected exactly one
Metadata
Metadata
Assignees
Labels
No labels