Project

Profile

Help

Bug #2938

closed

map{x: y} instance of function(X) as Y

Added by Michael Kay about 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XPath conformance
Sprint/Milestone:
-
Start date:
2016-09-13
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.7
Fix Committed on Branch:
9.7, trunk
Fixed in Maintenance Release:
Platforms:

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

Also available in: Atom PDF