Matthias Brantner has proposed merging 
lp:~zorba-coders/zorba/feature-compare_null into lp:zorba.

Commit message:
allow comparison of null to any other atomic type

Requested reviews:
  Matthias Brantner (matthias-brantner)
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/feature-compare_null/+merge/155377
-- 
https://code.launchpad.net/~zorba-coders/zorba/feature-compare_null/+merge/155377
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/runtime/booleans/BooleanImpl.cpp'
--- src/runtime/booleans/BooleanImpl.cpp	2013-03-24 19:05:42 +0000
+++ src/runtime/booleans/BooleanImpl.cpp	2013-03-26 00:19:23 +0000
@@ -890,13 +890,14 @@
   }
   else
   {
-    // There are 2 cases when two types are comparable without one being a
+    // There are 3 cases when two types are comparable without one being a
     // subtype of the other: (a) they belong to different branches under of
     // the type-inheritance subtree rooted at xs:integer, (b) they belong to
     // different branches under of the type-inheritance subtree rooted at
     // xs::duration (i.e. one is xs:yearMonthDuration and the other is
     // xs:dayTimeDuration).
     // The same case happens when there are two types derived from xs:NOTATION.
+    // (c) either of the types is a subtype of NULL.
     if (TypeOps::is_subtype(type0, store::XS_INTEGER) &&
         TypeOps::is_subtype(type1, store::XS_INTEGER))
     {
@@ -912,6 +913,14 @@
     {
       return item0->equals(item1);
     }
+    else if (TypeOps::is_subtype(type0, store::JS_NULL))
+    {
+      return item0->equals(item1);
+    }
+    else if (TypeOps::is_subtype(type1, store::JS_NULL))
+    {
+      return item1->equals(item0);
+    }
     else
     {
       xqtref_t type0 = tm->create_value_type(item0.getp());

=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/null09.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsoniq/null09.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsoniq/null09.xml.res	2013-03-26 00:19:23 +0000
@@ -0,0 +1,1 @@
+false false false true

=== added file 'test/rbkt/Queries/zorba/jsoniq/null09.jq'
--- test/rbkt/Queries/zorba/jsoniq/null09.jq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsoniq/null09.jq	2013-03-26 00:19:23 +0000
@@ -0,0 +1,1 @@
+null eq 1, null eq current-dateTime(), null ne null, null ne 42

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