Bug 17272 - [QT3TS] K-InternalVariablesWith-15b
[QT3TS] K-InternalVariablesWith-15b
Status: CLOSED FIXED
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 3 & XPath 3 Test Suite
Working drafts
PC Windows NT
: P2 normal
: ---
Assigned To: O'Neil Delpratt
Mailing list for public feedback on specs from XSL and XML Query WGs
:
Depends on: 15791
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-31 13:15 UTC by Tim Mills
Modified: 2012-10-05 15:59 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Mills 2012-05-31 13:15:25 UTC
This test has a couple of problems.

declare variable $var1 := $var1; true()

The expected result is XPST0054, but should be XQST0054.  However, this error code is expected to be replaced with XQDY0054 (see Bug 15791).

XQDY0054 being a dynamic error, because this test does not require evaluation of $var1, the test should also expect true().
Comment 1 Michael Kay 2012-05-31 14:05:28 UTC
I propose that we wait for the spec to settle down here as it is in flux.

The current spec contains some contradictory statements. It says (a) that a variable declaration adds a variable "to the static context" (but the static context of what?); it also says (b) "The static context for an initializing expression includes all functions, variables, and namespaces that are declared or imported anywhere in the Prolog, other than the variable being declared" (which means the variable is out of scope, which implies a static error XPST0008, regardless whether the variable is actually used), and (c) If the initializer of a variable V depends on V, a static error is raised [err:XQST0054].
Comment 2 O'Neil Delpratt 2012-10-01 14:57:00 UTC
The current spec says:

[Definition: If a variable declaration includes an expression (VarValue or VarDefaultValue), the expression is called an initializing expression. The static context for an initializing expression includes all functions, variables, and namespaces that are declared or imported anywhere in the Prolog, other than the variable being declared.]

Therefore the variable reference $var1 is not in scope. The spec says:

It is a static error [err:XPST0008] to reference a variable that is not in scope.

So we think that XPST0008 is appropriate and that there is not a cycle. To create a cycle there would have to be a link from the variable reference to the declaration and there is no such link because the variable is not in scope.
Comment 3 Tim Mills 2012-10-02 13:14:48 UTC
Agreed.
Comment 4 O'Neil Delpratt 2012-10-02 14:57:07 UTC
Error code changed and committed to cvs.