Project

Profile

Help

Bug #6271

Updated by Michael Kay 6 months ago

See QT3 test case FunctionCall-417 

 ``` 
          declare function local:f($x as xs:string, $y as xs:string, $z as xs:string := '1900-01-01') as xs:string { 
            concat($x, '-', $y, ' on ', $z) 
          }; 
          declare function local:g($x as xs:string, $z as function(xs:string, xs:string, xs:integer) as xs:string) { 
            $z($x, $x, 22) 
          };   
          local:g("ABC", local:f#2) 
 ``` 
 The function local:f#2 should be equivalent to `fn($x, $y){concat($x, '-', $y, ' on ', '1900-01-01')`; the call on $z should accept this arity-2 function by virtue of reduced-arity reduced-parity coercion, and the third argument (22) should be ignored. In fact we get a run-time type error because local:f expects a string, not an integer, as its third argument. 

 The effect is more noticeable when we supply something like deep-equal#2 as an argument to for-each-pair. Now that for-each-pair accepts an arity-3 callback, with the third argument being an integer position, we get a spurious failure because deep-equal has an arity-3 variant that expects a string as the third argument. (But this manifestation is not present in 12.4, because that does not yet implement the arity-3 callback on for-each-pair).

Back