zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #02818
[Merge] lp:~nbrinza/zorba/bugs into lp:zorba
Nicolae Brinza has proposed merging lp:~nbrinza/zorba/bugs into lp:zorba.
Requested reviews:
Markos Zaharioudakis (markos-za)
Matthias Brantner (matthias-brantner)
Related bugs:
Bug #867256 in Zorba: ""instance of document-node(element(x))" in predicate"
https://bugs.launchpad.net/zorba/+bug/867256
For more details, see:
https://code.launchpad.net/~nbrinza/zorba/bugs/+merge/85862
Fix for lp: bug #867256 - test Steps-leading-lone-slash-8a is failing.
Indeed, the condition that Markos mentioned was not necessary, so I have removed it. Resubmitting for merge into the trunk.
--
https://code.launchpad.net/~nbrinza/zorba/bugs/+merge/85862
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog 2011-12-13 03:38:23 +0000
+++ ChangeLog 2011-12-15 13:37:29 +0000
@@ -1,5 +1,9 @@
Zorba - The XQuery Processor
+version 2.x
+
+ * Fixed bug #867256 (document-node(element(x)) types and tests were not working correctly)
+
version 2.2
* Caching of results for recursive functions with atomic parameter and return types.
=== modified file 'src/types/typeimpl.cpp'
--- src/types/typeimpl.cpp 2011-07-01 05:22:12 +0000
+++ src/types/typeimpl.cpp 2011-12-15 13:37:29 +0000
@@ -361,7 +361,7 @@
bool NodeXQType::is_subtype(
- const TypeManager* tm,
+ const TypeManager* tm,
const NodeXQType& supertype,
const QueryLoc& loc) const
{
@@ -443,7 +443,7 @@
bool NodeXQType::is_supertype(
- const TypeManager* tm,
+ const TypeManager* tm,
const store::Item* subitem,
const QueryLoc& loc) const
{
@@ -488,14 +488,29 @@
}
}
- if (m_node_kind != store::StoreConsts::elementNode &&
- m_node_kind != store::StoreConsts::attributeNode)
+ // document-node( E ) matches any document node that contains exactly one element
+ // node, optionally accompanied by one or more comment and processing instruction
+ // nodes, if E is an ElementTest or SchemaElementTest that matches the element node.
+ bool is_element_test = (
+ m_node_kind == store::StoreConsts::documentNode &&
+ m_content_type != NULL &&
+ m_content_type->type_kind() == XQType::NODE_TYPE_KIND);
+
+ if (m_node_kind != store::StoreConsts::elementNode &&
+ m_node_kind != store::StoreConsts::attributeNode &&
+ !is_element_test)
return true;
if (m_content_type == NULL ||
m_content_type->type_kind() == XQType::ANY_TYPE_KIND)
return true;
+ if (is_element_test)
+ {
+ xqtref_t documentNodeType = tm->create_value_type(subitem, loc);
+ return TypeOps::is_subtype(tm, *documentNodeType, *this);
+ }
+
xqtref_t subContentType = tm->create_named_type(subitem->getType(),
TypeConstants::QUANT_ONE,
loc,
=== modified file 'test/rbkt/Queries/CMakeLists.txt'
--- test/rbkt/Queries/CMakeLists.txt 2011-12-09 19:37:09 +0000
+++ test/rbkt/Queries/CMakeLists.txt 2011-12-15 13:37:29 +0000
@@ -210,7 +210,6 @@
####
IF (FOUND_XQTS AND NOT ZORBA_TEST_W3C_TO_SUBMIT_RESULTS)
- EXPECTED_FAILURE(test/rbkt/w3c_testsuite/XQuery/PathExpr/Steps/Steps-leading-lone-slash-8a 3408285)
EXPECTED_FAILURE(test/rbkt/w3c_testsuite/XQuery/Functions/QNameFunc/NamespaceURIForPrefixFunc/K2-NamespaceURIForPrefixFunc-2 872732)
IF(NOT ZORBA_WITH_BIG_INTEGER)
Follow ups