[Bug 29586] New: [XQ31] 2.5.6.2 The judgement subtype-itemtype(Ai, Bi)

https://www.w3.org/Bugs/Public/show_bug.cgi?id=29586

            Bug ID: 29586
           Summary: [XQ31] 2.5.6.2 The judgement subtype-itemtype(Ai, Bi)
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Hardware: PC
               URL: https://www.w3.org/XML/Group/qtspecs/specifications/xq
                    uery-31/html/xquery-31.html#id-itemtype-subtype
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery 3.1
          Assignee: jonathan.robie@gmail.com
          Reporter: tim@cbcl.co.uk
        QA Contact: public-qt-comments@w3.org
  Target Milestone: ---

In 2.5.6.2 The judgement subtype-itemtype(Ai, Bi) we read:

Bi is AnnotationsB function(Ba_1, Ba_2, ... Ba_N) as Br, Ai is AnnotationsA
function(Aa_1, Aa_2, ... Aa_M) as Ar, where [AnnotationsB] and [AnnotationsA]
are optional lists of one or more annotations; N (arity of Bi) equals M (arity
of Ai); subtype(Ar, Br); for values of I between 1 and N, subtype(Ba_I, Aa_I) ;
and subtype-assertions(AnnotationsA, AnnotationsB).

so if

Ai = function(xs:decima) as xs:integer
Bi = function(xs:integer) as xs:decimal

subtype(xs:integer, xs:decimal) and so 

subtype-itemtype(function(xs:decima) as xs:integer, function(xs:integer) as
xs:decimal) 

holds.



Later it reads,

Ai is map(Ka, Va) and Bi is map(Kb, Vb), where subtype-itemtype(Ka, Kb) and
subtype(Va, Vb).


Suppose Ai is map(xs:decimal, xs:integer) and Bi is map(xs:integer,
xs:decimal).  So

Ka = xs:decimal
Va = xs:integer
Kb = xs:integer
Vb = xs:decimal

The judgement says:

subtype-itemtype(map(xs:decimal, xs:integer), map(xs:integer, xs:decimal))

does not hold because

subtype-itemtype(xs:integer, xs:decima) (true) and
subtype(xs:decimal, xs:integer) (false)

I think the rule is incorrect, and doesn't exhibit the covariance of function
types.

I think the correct rule is

Ai is map(Ka, Va) and Bi is map(Kb, Vb), where subtype-itemtype(Ka, Kb) and
subtype(Vb, Va).


I also wonder why there are no judgements relating map(Ka, Va) to function(Ka)
as Va and array(Va) to function(xs:integer) as Va.  e.g.

Ai is map(Ka, Va) and Bi is function(Kb) as Vb, where subtype-itemtype(Ka, Kb)
and subtype(Vb, Va).

Ai is array(Va) and Bi is function(xs:integer) as Vb, where subtype(Vb, Va).

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Friday, 22 April 2016 10:07:17 UTC