Bug #4804


Failure in XX compiler, incorrect type inferencing

Added by Michael Kay over 3 years ago. Updated over 3 years ago.

XPath Conformance
Start date:
Due date:
% Done:


Estimated time:
Applies to JS Branch:
Fix Committed on JS Branch:
Fixed in JS Release:
SEF Generated with:
Contact person:
Additional contact persons:


See bug #4802

When compiling the stylesheet included in that bug entry under the XX compiler, it fails:

Compiling stylesheet /Users/mike/bugs/2020/4802-Priest/webApp.xsl
Failed to compile stylesheet: Static error in XPath on line 70 in 4802-Priest/webApp.xsl {         array:for-each($cells, function ($c) {           f:swapRowCol($c, array {})         })}: 
Required type of second argument of f:swapRowCol() is array(map(*)): actual type is array(xs:error0)
Error Q{}XPTY0004 at xpath.xsl#963
    Failed to compile stylesheet

Also revealed in that bug report is that asynchronous execution complicates the diagnostics. When first run, the -master: document was not well-formed XML. The stylesheet compilation and loading of the master document happen in parallel, which means that the messages from both errors get output, which is rather confusing. I'm not sure there's much we can do about that.

Actions #1

Updated by Michael Kay over 3 years ago

The basic problem here is that an empty array is a valid instance of array{map(*)) and isn't being recognised as such.

There's a secondary problem with the way the information is given: the inferred type of the empty array should be rendered as array(empty-sequence()) rather than array(xs:error0).

Actions #2

Updated by Michael Kay over 3 years ago

  • Category set to XPath Conformance
  • Status changed from New to Resolved
  • Priority changed from Low to Normal
  • Applies to JS Branch 2.0, Trunk added
  • Fix Committed on JS Branch Trunk added

Fixed. Changes:

  • When reporting static errors in XPath expressions, do normalize-space() to make multi-line expressions presentable

  • Recognise the sequence type empty-sequence() in SequenceType.toString()

  • In TypeHierarchy.computeRelationship, recognise that the empty type is a subtype of every other type.

Actions #3

Updated by Community Admin over 3 years ago

  • Applies to JS Branch 2 added
  • Applies to JS Branch deleted (2.0, Trunk)
Actions #4

Updated by Debbie Lockett over 3 years ago

  • Fix Committed on JS Branch 2 added
  • Fix Committed on JS Branch deleted (Trunk)
Actions #5

Updated by Debbie Lockett over 3 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in JS Release set to Saxon-JS 2.1

Bug fix applied in the Saxon-JS 2.1 maintenance release.

Please register to edit this issue

Also available in: Atom PDF Tracking page