(declare (ignore type1 type2))
(values nil nil))
-(!define-type-method (hairy :simple-intersection2 :complex-intersection2)
+(!define-type-method (hairy :simple-intersection2)
(type1 type2)
(if (type= type1 type2)
type1
nil))
+(!define-type-method (hairy :complex-intersection2)
+ (type1 type2)
+ (aver (hairy-type-p type2))
+ (let ((hairy-type-spec (type-specifier type2)))
+ (if (and (consp hairy-type-spec)
+ (eq (car hairy-type-spec) 'not))
+ (if (csubtypep type1 (specifier-type (cadr hairy-type-spec)))
+ *empty-type*
+ nil)
+ nil)))
+
(!define-type-method (hairy :simple-=) (type1 type2)
(if (equal (hairy-type-specifier type1)
(hairy-type-specifier type2))
(!define-type-class cons)
(!def-type-translator cons (&optional (car-type-spec '*) (cdr-type-spec '*))
- (make-cons-type (specifier-type car-type-spec)
- (specifier-type cdr-type-spec)))
+ (let ((car-type (specifier-type car-type-spec))
+ (cdr-type (specifier-type cdr-type-spec)))
+ (if (or (eq car-type *empty-type*)
+ (eq cdr-type *empty-type*))
+ *empty-type*
+ (make-cons-type car-type cdr-type))))
(!define-type-method (cons :unparse) (type)
(let ((car-eltype (type-specifier (cons-type-car-type type)))
;;; SINGLE-FLOAT DOUBLE-FLOAT RATIONAL)". We ideally want all of the
;;; defined-by-ANSI types to unparse as themselves or at least
;;; something similar (e.g. CHARACTER can unparse to BASE-CHAR, since
-;;; the types are equivalent in current SBCL).
+;;; the types are equivalent in current SBCL, and EXTENDED-CHAR can
+;;; unparse to NIL, since there are no EXTENDED-CHARs currently).
(let ((standard-types '(;; from table 4-2 in section 4.2.3 in the
;; CLHS.
arithmetic-error
error
readtable
two-way-stream
- ;; This one's hard: (AND BASE-CHAR (NOT BASE-CHAR))
- ;;
- ;; This is because it looks like
- ;; (AND CHARACTER (NOT BASE-CHAR))
- ;; but CHARACTER is equivalent to
- ;; BASE-CHAR. So if we fix intersection of
- ;; obviously disjoint types and then do (the
- ;; extended-char foo), we'll get back FOO is
- ;; not a NIL. -- CSR, 2002-09-16.
- ;;
- ;; extended-char
+ extended-char
real
type-error
file-error