I'm getting surprising behavior when passing an empty sequence to a function when the function signature doesn't allow it. Example in Query Console:
declare function local:test($in as xs:string) { "Tested" };
local:test( () )
This returns an empty sequence instead of the string "Tested" as if the function didn't actually run at all. Shouldn't the XQuery processor throw an error because the function signature specifies exactly one xs:string value? By contrast, if I add a question mark to make xs:string zero or one, the function returns "Tested" as expected:
declare function local:test($in as xs:string?) { "Tested" };
local:test( () )
Why isn't the function signature being enforced in the first code example?