Map not reported as an instance of map(*)
Hi, BaseX team.
Is it correct for a map not to be considered an instance of map(*)? The following query in BaseX 12.4 returns (false, true). It's not relevant that the map is empty. I get the same results in v11.1, which I happened to have around. But v10.1 returns (true, true).
xquery version "3.1";
declare function local:function-type(
$f as function(*)
) as xs:boolean
{
$f instance of map(*)
};
(
local:function-type(map{}),
map{} instance of map(*)
)However, if I change "as function(*)" to a more generic type and use "treat as function(*)" in the body of the function, then the result is (true, true), which is what I expected for both queries.
xquery version "3.1";
declare function local:function-type(
$f as item()
) as xs:boolean
{
($f treat as function(*)) instance of map(*)
};
(
local:function-type(map{}),
map{} instance of map(*)
)Is this a v4.0 change in the language? I did a quick check in the XDM 4.0 spec, but https://qt4cg.org/specifications/xpath-datamodel-40/Overview.html#types-hierarchy says, "A map item, as well as being a function, is also an instance of the generic map type map(*), of more specific map types map(K, V) defining the types of the keys and values, and perhaps of one or more record types that associate a type with specific key values.".
In case it matters, in my real use case, the "function-type" function is https://github.com/xspec/xspec/blob/6b867702d3afef38d92a6cd56dfa2a94cb24281c/src/common/report-sequence.xqm#L374-L382 and BaseX returns 'function' instead of 'map'.
Thanks, Amanda
Quoted text · Amanda Galtman · 14 lines
On 23/10/2026 20:12, Amanda Galtman via BaseX-Talk wrote: > declare function local:function-type( > $f as function(*) > ) as xs:boolean > { > $f instance of map(*) > }; > > ( > local:function-type(map{}), > map{} instance of map(*) > ) > >
The BaseX online fiddle and yesterday's snapshot of BaseX 13 return true true.
Written for BaseX 12.4. BaseX may have changed since: please check the current documentation.