From 800a2438e26a475325343134a39c7a3c09ba588f Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Fri, 28 Feb 2003 15:50:28 +0000 Subject: [PATCH] 0.7.13.8: 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 | 7 +++++++ src/code/late-type.lisp | 25 ++++++++++++++++++++++++- version.lisp-expr | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index e55472f..fe3d9b2 100644 --- 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 diff --git a/src/code/late-type.lisp b/src/code/late-type.lisp index 0feadf6..88eb018 100644 --- a/src/code/late-type.lisp +++ b/src/code/late-type.lisp @@ -1145,7 +1145,8 @@ (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) @@ -2449,6 +2450,28 @@ ((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))) diff --git a/version.lisp-expr b/version.lisp-expr index 1a95f6f..a224dcc 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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" -- 1.7.10.4