Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-scratch 
into lp:zorba.

Commit message:
Fixed bug in handling the type declaration of a FOR variable that allows empty.

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/161672

Fixed bug in handling the type declaration of a FOR variable that allows empty.
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/161672
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2013-04-25 02:37:42 +0000
+++ ChangeLog	2013-04-30 18:33:35 +0000
@@ -49,6 +49,7 @@
   * Fixed bug #1124273 (xqdoc crash because of annotation literals)
   * Fixed bug #1085408 (xs:date(): casting large year values)
   * Fixed bug #867027 (XQST0059 error messages inconsistent)
+  * Fixed bug in handling the type declaration of a FOR variable that allows empty.
   * Fixed bug #1095889 (Improve error message for xml-parsing error).
   * Fixed bug #1131984 (apparently invalid regex in queries)
   * Fixed bug #1123163 (fn:format-integer failures)

=== modified file 'src/compiler/expression/flwor_expr.cpp'
--- src/compiler/expression/flwor_expr.cpp	2013-04-25 11:56:50 +0000
+++ src/compiler/expression/flwor_expr.cpp	2013-04-30 18:33:35 +0000
@@ -143,7 +143,21 @@
       if (!TypeOps::is_equal(tm, *rtm.ITEM_TYPE_STAR, *declaredType, loc))
       {
         if (kind == flwor_clause::for_clause)
-          declaredType = tm->create_type(*declaredType, domainType->get_quantifier());
+        {
+          TypeConstants::quantifier_t domQuant = domainType->get_quantifier();
+          TypeConstants::quantifier_t declQuant = declaredType->get_quantifier();
+
+          if (theAllowingEmpty &&
+              (declQuant == TypeConstants::QUANT_ONE ||
+               declQuant == TypeConstants::QUANT_PLUS))
+          {
+            declaredType = tm->create_type(*declaredType, TypeConstants::QUANT_PLUS);
+          }
+          else
+          {
+            declaredType = tm->create_type(*declaredType, domQuant);
+          }
+        }
 
         if (!TypeOps::is_subtype(tm, *domainType, *declaredType, loc))
         {

=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp	2013-04-29 20:51:57 +0000
+++ src/compiler/translator/translator.cpp	2013-04-30 18:33:35 +0000
@@ -8840,7 +8840,7 @@
   expr* e1 = pop_nodestack();
   expr* e2 = pop_nodestack();
 
-  fo_expr* e = theExprManager->create_fo_expr(theRootSctx, theUDF, loc, BUILTIN_FUNC(OP_TO_2), e2, e1);
+  fo_expr* e = CREATE(fo)(theRootSctx, theUDF, loc, BUILTIN_FUNC(OP_TO_2), e2, e1);
 
   normalize_fo(e);
 

=== modified file 'test/fots/CMakeLists.txt'
--- test/fots/CMakeLists.txt	2013-04-29 18:47:57 +0000
+++ test/fots/CMakeLists.txt	2013-04-30 18:33:35 +0000
@@ -254,7 +254,6 @@
 EXPECTED_FOTS_FAILURE (misc-Serialization K2-Serialization-11 0)
 EXPECTED_FOTS_FAILURE (misc-XMLEdition XML10-4ed-Excluded-char-1 0)
 EXPECTED_FOTS_FAILURE (misc-XMLEdition XML11-1ed-Included-char-1 0)
-EXPECTED_FOTS_FAILURE (prod-AllowingEmpty outer-013 0)
 EXPECTED_FOTS_FAILURE (prod-Annotation annotation-3 0)
 EXPECTED_FOTS_FAILURE (prod-Annotation annotation-30 0)
 EXPECTED_FOTS_FAILURE (prod-Annotation annotation-31 0)

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to