Project

Profile

Help

Bug #4619

closed

XX Compiler failure with static parameters whose type has an occurrence indicator

Added by Michael Kay over 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Category:
XX compiler
Sprint/Milestone:
-
Start date:
2020-06-28
Due date:
% Done:

100%

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

Actions #1

Updated by John Lumley over 4 years ago

This is a puzzle... certainly there are cases of the XX compiler compiling the testdriver successfully - and that certainly contains static parameters used for conditional compilation.

Sent from my iPad

On 28 Jun 2020, at 15:18, Saxonica Developer Community wrote:



Actions #2

Updated by John Lumley over 4 years ago

  • Status changed from New to In Progress
  • Applies to JS Branch Trunk added

A minimal reproduction of the problem occurs with:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="#all" version="3.0">

   <xsl:param name="xslt-uri" static="yes" as="xs:string?" select="'group-sales-sum-product.xsl'"/>

</xsl:stylesheet>

which fails in the static phase with as="xs:string?" but succeeds with as="xs:string"

Actions #3

Updated by John Lumley over 4 years ago

The strategy for handling type declarations on such static variables has been to wrap the expression in a casting function, for example:

<xsl:param name="length" as="xs:decimal" select="12+34"/>

involves an evaluation of the XPath expression 'xs:decimal(12+34)'. Unfortunately this has never been tried with a cardinality indicator, so the compiler has been trying to parse

xs:string?(.....)

which on encountering the ? operator, assumes a lookup and takes the left hand operator to be a child::xs:string term. In this case there is no context focus and hence the error.

Actions #4

Updated by John Lumley over 4 years ago

Patch committed, though there may be need to implement function conversion rules as a final solution

Actions #5

Updated by Debbie Lockett about 4 years ago

  • Assignee changed from John Lumley to Debbie Lockett
  • Applies to JS Branch deleted (Trunk)
  • Fix Committed on JS Branch 2.0 added

The code patch was committed to the saxon-js-enterprise git repo on 2020-06-29.

A test should be added (XSLT3 probably?), and then the bug can be closed.

Actions #6

Updated by Debbie Lockett about 4 years ago

  • Status changed from In Progress to Resolved

Added xslt3 test case static-031, so now closing.

Actions #7

Updated by Michael Kay about 4 years ago

  • Subject changed from XX Compiler fails to compile stylesheet containing static parameters to XX Compiler failure with static parameters whose type has an occurrence indicator
Actions #8

Updated by Community Admin almost 4 years ago

  • Applies to JS Branch 2 added
  • Applies to JS Branch deleted (2.0)
Actions #9

Updated by Community Admin almost 4 years ago

  • Fix Committed on JS Branch 2 added
  • Fix Committed on JS Branch deleted (2.0)
Actions #10

Updated by Debbie Lockett almost 4 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