Bug #2938
closedmap{x: y} instance of function(X) as Y
100%
Description
An instance of test in which the LHS is a map, and the RHS is a specific function type, is returning false when it should return true.
For example test case map-merge-003-hof: the following assertion should be true
map{"a", 1 to 5} instance of function(xs:anyURI) as xs:integer*
The rules here are rather technical. They are covered by the itemType-subType() judgement, specifically:
Rule 35 [A is a subtype of B if] Ai is map(K, V), and Bi is function(xs:anyAtomicType) as V?.
Rule 26 [A is a subtype of B if] Ai is function(a1) as Ar, Bi is function(b1) as Br, Br is a subtype of Ar, and b1 is a subtype of a1.
We have a map here whose values are all sequences of integers, therefore it is an instance of map(X, xs:integer*) for some X, therefore it is an instance of function(xs:anyAtomicType) as xs:integer*, therefore it is an instance of function(xs:anyURI) as xs:integer*.
Essentially a map is an instance of function(X) as Y if (a) X is a subtype of xs:anyAtomicType, and (b) all the values in the map are instances of Y.
Please register to edit this issue