This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 3450 - Some positive K-* tests are not Static typing savvy (round 2)
Summary: Some positive K-* tests are not Static typing savvy (round 2)
Status: CLOSED FIXED
Alias: None
Product: XML Query Test Suite
Classification: Unclassified
Component: XML Query Test Suite (show other bugs)
Version: unspecified
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Frans Englich
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-13 11:37 UTC by Tom Brosens
Modified: 2006-07-17 10:29 UTC (History)
1 user (show)

See Also:


Attachments

Description Tom Brosens 2006-07-13 11:37:47 UTC
In bug#3345 a list of tests was given that had problems with static typing. By far most of these have been resolved in XQTS_current.zip v1.10. However, some of the current queries still have problems. I guess most of these can be solved by adding (or moving) a 'treat as' clause as was also done for the queries in bug#3345. This is the new list:

K-EncodeURIfunc-6.xq
K-EscapeHTMLURIFunc-6.xq
K-CondExpr-4.xq
K-LogicExpr-27.xq
K-GenCompEq-34.xq
K-GenCompEq-35.xq
K-FilterExpr-51.xq
K-FilterExpr-52.xq
K-SeqInsertBeforeFunc-17.xq
K-SeqInsertBeforeFunc-18.xq
K-SeqInsertBeforeFunc-19.xq
K-SeqInsertBeforeFunc-20.xq
K2-FunctionProlog-8.xq

Thanks,
Tom.
Comment 1 Frans Englich 2006-07-13 12:35:34 UTC
Hi Tom,

Could you elaborate on what's wrong with K2-FunctionProlog-8?

Things might have gotten out of sync, so I post here the query that I associate  K2-FunctionProlog-8 with:

---------------------------------------------------------
declare function local:myFunction($arg)
{
        if($arg eq 1)
        then $arg
        else local:myFunction3($arg - 1)
};
declare function local:myFunction2($arg)
{
        local:myFunction($arg)
};
declare function local:myFunction3($arg)
{
        local:myFunction2($arg)
};
local:myFunction3(3) eq 1
---------------------------------------------------------
Comment 2 Tom Brosens 2006-07-13 12:59:49 UTC
Hi Frans,

The problem is that the input and output parameters of the user defined functions are not typed explicitely. Therefor they become item()* and we get the error:

Error at line 21, column 25. Static type error. Types 'item()*' and 'xs:integer' are invalid argument types for binary operator 'eq'

Since the query tests 'recursive function stretching through several function calls' I guess you don't harm the purpose of the test by adding type declarations explicitely. The following query resolves the problem and gives 'true' as result:


declare function local:myFunction($arg as xs:integer) as xs:integer
{
        if($arg eq 1)
        then $arg
        else local:myFunction3($arg - 1)
};
declare function local:myFunction2($arg as xs:integer) as xs:integer
{
        local:myFunction($arg)
};
declare function local:myFunction3($arg as xs:integer) as xs:integer
{
        local:myFunction2($arg)
};
local:myFunction3(3) eq 1


Hope this helps...

Thanks,
Tom.
Comment 3 Frans Englich 2006-07-13 13:11:07 UTC
Ok, thanks for the clarification.

* AdditionalFiles/submission-frans.zip contains fixes(or rather, attempts) for the K-* tests
* AdditionalFiles/submission-frans2.zip contains K2-FunctionProlog-8 altered as suggested.

Note that XQTS_current.zip doesn't contain these changes. I'm resolving this bug, and we'll see if any further fixes are necessary.


Frans
Comment 4 Tom Brosens 2006-07-14 15:12:33 UTC
Frans,

I just checked XQTS_current.zip v1.12 and two items remain for this bug:

1) K2-FunctionProlog-8:
-----------------------
The query was changed into:

declare function local:myFunction($arg) as xs:integer
{
        if($arg eq 1)
        then $arg
        else local:myFunction3($arg - 1)
};
declare function local:myFunction2($arg) as xs:integer
{
        local:myFunction($arg)
};
declare function local:myFunction3($arg) as xs:integer
{
        local:myFunction2($arg)
};
local:myFunction3(3) eq 1

As you can see the function arguments are still not typed resulting in a Static Type error. Is it possible to add the type declarations as suggested before to the arguments too?

2) K-GenCompEq-34:
------------------
Still has a Static Typing issue. Can it be changed similar to K-GenCompEq-35 by adding XPST0004 as expected result?


The rest of the list is OK! I hope I'm not too late to get this into XQTS 1.0.

Thanks,
Tom.
Comment 5 Frans Englich 2006-07-14 15:32:39 UTC
Yupp, sorry about my sloppiness.

Fixed in CVS. I think it will go into 1.0, we're just wrapping it.


So, let's make a new attempt at closing this one!


Frans
Comment 6 Tom Brosens 2006-07-17 10:29:37 UTC
Fixes were verified and everything is OK now (XQTS_current.zip v1.14)! Closing.