0.7.10.3:
[sbcl.git] / tests / type.pure.lisp
index 9222e6a..a770835 100644 (file)
                        array
                        generic-function
                        simple-error
-                       ;; (NOT CONS)
+                       ;; so it might seem easy to change the HAIRY
+                       ;; :UNPARSE method to recognize that (NOT
+                       ;; CONS) should unparse as ATOM. However, we
+                       ;; then lose the nice (SUBTYPEP '(NOT ATOM)
+                       ;; 'CONS) => T,T behaviour that we get from
+                       ;; simplifying (NOT ATOM) -> (NOT (NOT CONS))
+                       ;; -> CONS. So, for now, we leave this
+                       ;; commented out.
+                       ;;
                        ;; atom
                        hash-table
                        simple-string              
@@ -60,8 +68,7 @@
                        single-float               
                        bit-vector
                        long-float
-                       ;; MEMBER-TYPE #\a #\b ...
-                       ;; standard-char              
+                       standard-char              
                        broadcast-stream
                        method
                        standard-class             
@@ -88,9 +95,7 @@
                        string                     
                        condition
                        pathname
-                       ;; OR STRING-INPUT-STREAM STRING-OUTPUT-STREAM
-                       ;; FILL-POINTER-OUTPUT-STREAM
-                       ;; string-stream
+                       string-stream
                        cons
                        print-not-readable
                        structure-class            
                        ;; 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
                        real
                        type-error                 
                        restart
                        unbound-slot               
                        file-stream
-                       ;; (OR CONS NULL VECTOR)
-                       ;; sequence
+                       sequence
                        unbound-variable           
                        fixnum
                        serious-condition
     (format t "~&~S~%" type)
     (assert (not (sb-kernel:unknown-type-p (sb-kernel:specifier-type type))))
     (assert (atom (sb-kernel:type-specifier (sb-kernel:specifier-type type))))))
+
+;;; a bug underlying the reported bug #221: The SB-KERNEL type code
+;;; signalled an error on this expression.
+(subtypep '(function (fixnum) (values package boolean))
+         '(function (t) (values package boolean)))
+
+;;; bug reported by Valtteri Vuorik
+(compile nil '(lambda () (member (char "foo" 0) '(#\. #\/) :test #'char=)))
+(assert (not (equal (multiple-value-list
+                     (subtypep '(function ()) '(function (&rest t))))
+                    '(nil t))))
+
+(assert (not (equal (multiple-value-list
+                     (subtypep '(function (&rest t)) '(function ())))
+                    '(t t))))
+
+(assert (subtypep '(function)
+                  '(function (&optional * &rest t))))
+(assert (equal (multiple-value-list
+                (subtypep '(function)
+                          '(function (t &rest t))))
+               '(nil t)))
+#+nil
+(assert (and (subtypep 'function '(function))
+             (subtypep '(function) 'function)))