Project

Profile

Help

Bug #5095

closed

Tracing with -T fails on overriden global variable (AssertionError: no select expression for global variable)

Added by Michael Kay over 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XSLT 3.0 packages
Sprint/Milestone:
-
Start date:
2021-09-16
Due date:
% Done:

100%

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

Description

Running test case accept-040 with the -T option fails with the error

AssertionError: no select expression for global variable

With -T, we attempt early evaluation of global variables (so that the trace makes more sense), and it's probably this that's causing the failure. The variable in question is declared in one package and overridden in another.

Actions #1

Updated by Michael Kay over 2 years ago

We're trying to evaluate a variable $v1 that has visibility="abstract" which of course is not possible.

It's easy enough to eliminate abstract variables from the pre-evaluation logic in Controller.preEvaluateGlobals(). The problem is that the variable is being evaluated by virtue of a reference from another global variable ($v1-proxy). This should be evaluating the overriding variable, but the logic to achieve this in the pre-evaluation pass seems to be absent.

Actions #2

Updated by Michael Kay over 2 years ago

The only solution I've been able to find for this is to abandon the attempt to pre-evaluate global variables when tracing.

It was always a bit questionable anyway - there's an argument that tracing should change the execution plan as little as possible.

The reason it's tricky is that the bindings from a global variable to other components depend on where it was called from. In the language of the spec, a global variable V in a used package results in a corresponding global variable V' in the using package, and their values may be different if V references components that are overridden in the using package. In terms of the implementation, a global variable can only really be evaluated in the context of a global variable reference, which provides the "current component" in the context. We're doing this pre-evaluation without setting a current component, and that's essentially why it crashes.

Removing the pre-evaluation reduces the number of test failures when running the test suite with -T to 55 (many of them in test set on-empty).

Actions #3

Updated by Michael Kay over 2 years ago

  • Status changed from New to Resolved
  • Fix Committed on Branch 10, trunk added
Actions #4

Updated by Debbie Lockett about 2 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 10.7 added

Bug fix applied in the Saxon 10.7 maintenance release.

Please register to edit this issue

Also available in: Atom PDF