Markos Zaharioudakis has proposed merging 
lp:~zorba-coders/zorba/cast-to-simple-type into lp:zorba.

Commit message:
fixed bug #107640

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/cast-to-simple-type/+merge/141449

fixed bug #107640
-- 
https://code.launchpad.net/~zorba-coders/zorba/cast-to-simple-type/+merge/141449
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/diagnostics/diagnostic_en.xml'
--- src/diagnostics/diagnostic_en.xml	2012-12-21 22:05:39 +0000
+++ src/diagnostics/diagnostic_en.xml	2012-12-29 06:49:22 +0000
@@ -265,6 +265,10 @@
         <value>Cannot cast node to xs:QName</value>
       </entry>
 
+      <entry key="NotationParam_23">
+        <value>$2 can not be promoted to parameter type xs:NOTATION of function $3()</value>
+      </entry>
+
     </diagnostic>
 
     <diagnostic code="XQTY0024">

=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
--- src/diagnostics/pregenerated/dict_en.cpp	2012-12-21 22:05:39 +0000
+++ src/diagnostics/pregenerated/dict_en.cpp	2012-12-29 06:49:22 +0000
@@ -895,6 +895,7 @@
   { "~XPTY0004_NoTreatAs_23", "$2 can not be treated as type $3" },
   { "~XPTY0004_NoTypePromote_23", "$2 can not be promoted to type $3" },
   { "~XPTY0117_NodeCast", "Cannot cast node to xs:QName" },
+  { "~XPTY0117_NotationParam_23", "$2 can not be promoted to parameter type xs:NOTATION of function $3()" },
   { "~XQST0106_CONFLICTING", "conflicting" },
   { "~XQST0106_THE_SAME", "the same" },
   { "~XUDY0021_AttributeName", "\"$3\": attribute with the same name already exists" },

=== modified file 'src/diagnostics/pregenerated/dict_zed_keys.h'
--- src/diagnostics/pregenerated/dict_zed_keys.h	2012-12-21 22:05:39 +0000
+++ src/diagnostics/pregenerated/dict_zed_keys.h	2012-12-29 06:49:22 +0000
@@ -42,6 +42,7 @@
 #define ZED_XPTY0004_JSONIQ_SELECTOR "~XPTY0004_JSONIQ_SELECTOR"
 #define ZED_XPTY0004_MultiValuedGroupingKey "~XPTY0004_MultiValuedGroupingKey"
 #define ZED_XPTY0117_NodeCast "~XPTY0117_NodeCast"
+#define ZED_XPTY0117_NotationParam_23 "~XPTY0117_NotationParam_23"
 #define ZED_XQST0106_THE_SAME "~XQST0106_THE_SAME"
 #define ZED_XQST0106_CONFLICTING "~XQST0106_CONFLICTING"
 #define ZED_FTST0009_BadStopWordsLang "~FTST0009_BadStopWordsLang"

=== modified file 'src/runtime/core/sequencetypes.cpp'
--- src/runtime/core/sequencetypes.cpp	2012-12-28 11:53:57 +0000
+++ src/runtime/core/sequencetypes.cpp	2012-12-29 06:49:22 +0000
@@ -493,6 +493,16 @@
   {
     assert(theQName != NULL);
 
+    if (TypeOps::is_equal(theSctx->get_typemanager(),
+                          *thePromoteType,
+                          *GENV_TYPESYSTEM.NOTATION_TYPE_ONE,
+                          loc))
+    {
+      RAISE_ERROR(err::XPTY0117, loc,
+      ERROR_PARAMS(ZED(XPTY0117_NotationParam_23),
+                   valueType, theQName->getStringValue()));
+    }
+
     RAISE_ERROR(err::XPTY0004, loc, 
     ERROR_PARAMS(ZED(XPTY0004_NoParamTypePromote_234),
                  valueType, targetType, theQName->getStringValue()));

=== modified file 'src/types/casting.cpp'
--- src/types/casting.cpp	2012-12-28 11:53:57 +0000
+++ src/types/casting.cpp	2012-12-29 06:49:22 +0000
@@ -2896,9 +2896,14 @@
     return result != NULL;
   }
 
-  if (TypeOps::is_subtype(itemType, store::XS_UNTYPED_ATOMIC) &&
-      ! TypeOps::is_subtype(targetType, store::XS_QNAME))
+  if (TypeOps::is_subtype(itemType, store::XS_UNTYPED_ATOMIC))
   {
+    if (TypeOps::is_subtype(targetType, store::XS_QNAME) ||
+        TypeOps::is_subtype(targetType, store::XS_NOTATION))
+    {
+      return false;
+    }
+
     // untyped --> target type
     castToBuiltinAtomic(result, item, targetType, NULL, loc);
     return true;

=== modified file 'src/types/typeimpl.cpp'
--- src/types/typeimpl.cpp	2012-12-28 10:24:59 +0000
+++ src/types/typeimpl.cpp	2012-12-29 06:49:22 +0000
@@ -106,7 +106,7 @@
   "xs:ID",
   "xs:IDREF",
   "xs:ENTITY",
-  "UNTYPED_ATOMIC",
+  "xs:untypedAtomic",
   "xs:dateTime",
   "xs:date",
   "xs:time",

-- 
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