0.8.6.39:
[sbcl.git] / src / code / sort.lisp
index 99494de..f30c67d 100644 (file)
               (sequence-type-length-mismatch-error type
                                                    (+ (length s1)
                                                       (length s2)))))
-        (if (csubtypep (specifier-type '(cons nil t)) type)
-            (if (and (null s1) (null s2))
-                (sequence-type-length-mismatch-error type 0)
-                (values (merge-lists* s1 s2 pred-fun key-fun)))
+        (if (cons-type-p type)
+            (multiple-value-bind (min exactp)
+                (sb!kernel::cons-type-length-info type)
+              (let ((length (+ (length s1) (length s2))))
+                (if exactp
+                    (unless (= length min)
+                      (sequence-type-length-mismatch-error type length))
+                    (unless (>= length min)
+                      (sequence-type-length-mismatch-error type length)))
+                (values (merge-lists* s1 s2 pred-fun key-fun))))
             (sequence-type-too-hairy result-type))))
       ((csubtypep type (specifier-type 'vector))
        (let* ((vector-1 (coerce sequence1 'vector))