0.7.13.8:
authorChristophe Rhodes <csr21@cam.ac.uk>
Fri, 28 Feb 2003 15:50:28 +0000 (15:50 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Fri, 28 Feb 2003 15:50:28 +0000 (15:50 +0000)
Fix some more type system stuff
... the NEGATION type method should test for TYPE=, not EQ, with
*EMPTY-TYPE*
... install some hair to deal with more RATIONAL/INTEGER
confusion
(I can no longer construct an example that causes the type
system to get the answer wrong involving just INTEGER, RATIONAL,
AND, OR and NOT.  That's not to say that such an example doesn't
exist, only -- as Fermat didn't quite say -- that my brain is too
small to contain it)

NEWS
src/code/late-type.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index e55472f..fe3d9b2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1583,6 +1583,13 @@ changes in sbcl-0.7.13 relative to sbcl-0.7.12:
   * incremented fasl file version number due to the change in the
     DEFSTRUCT-SLOT-DESCRIPTION structure.
 
+changes in sbcl-0.7.14 relative to sbcl-0.7.13:
+  * fixed some bugs revealed by Paul Dietz' test suite:
+    ** a bug in the CONS type specifier, whereby the CAR and CDR
+       types got intertwined, has been fixed;
+    ** the type system is now able to reason about the interaction
+       between INTEGER and RATIO types more completely;
+
 planned incompatible changes in 0.7.x:
   * (not done yet, but planned:) When the profiling interface settles
     down, maybe in 0.7.x, maybe later, it might impact TRACE. They both
index 0feadf6..88eb018 100644 (file)
         (intersection2 (type-intersection2 type1
                                            complement-type2)))
     (if intersection2
-       (values (eq intersection2 *empty-type*) t)
+       ;; FIXME: if uncertain, maybe try arg1?
+       (type= intersection2 *empty-type*)
        (invoke-complex-subtypep-arg1-method type1 type2))))
 
 (!define-type-method (negation :complex-subtypep-arg1) (type1 type2)
        ((and (not (intersection-type-p type1))
              (%intersection-complex-subtypep-arg1 type2 type1))
         type1)
+       ;; KLUDGE: This special (and somewhat hairy) magic is required
+       ;; to deal with the RATIONAL/INTEGER special case.  The UNION
+       ;; of (INTEGER * -1) and (AND (RATIONAL * -1/2) (NOT INTEGER))
+       ;; should be (RATIONAL * -1/2) -- CSR, 2003-02-28
+       ((and (csubtypep type2 (specifier-type 'ratio))
+             (numeric-type-p type1)
+             (csubtypep type1 (specifier-type 'integer))
+             (csubtypep type2
+                        (make-numeric-type
+                         :class 'rational
+                         :complexp nil
+                         :low (if (null (numeric-type-low type1))
+                                  nil
+                                  (list (1- (numeric-type-low type1))))
+                         :high (if (null (numeric-type-high type1))
+                                   nil
+                                   (list (1+ (numeric-type-high type1)))))))
+        (type-union type1
+                    (apply #'type-intersection
+                           (remove (specifier-type '(not integer))
+                                   (intersection-type-types type2)
+                                   :test #'type=))))
        (t
         (let ((accumulator *universal-type*))
           (do ((t2s (intersection-type-types type2) (cdr t2s)))
index 1a95f6f..a224dcc 100644 (file)
@@ -18,4 +18,4 @@
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
 
-"0.7.13.7"
+"0.7.13.8"