X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fearly-type.lisp;h=53137bacba2d2b04c1ba8a13b60457c90c0f2f66;hb=020de3c04699323437f0c746fe986506b716ab97;hp=048b61a47a593caf7b3b9103acd05aa8762d0169;hpb=a64589ed34ce0298fae164476af7de14c4652909;p=sbcl.git diff --git a/src/code/early-type.lisp b/src/code/early-type.lisp index 048b61a..53137ba 100644 --- a/src/code/early-type.lisp +++ b/src/code/early-type.lisp @@ -139,8 +139,6 @@ :rest rest :allowp allowp)) -;;; FIXME: ANSI VALUES has a short form (without lambda list -;;; keywords), which should be translated into a long one. (defun make-values-type (&key (args nil argsp) required optional rest allowp) (if argsp @@ -337,7 +335,7 @@ :enumerable enumerable)) ;;; An ARRAY-TYPE is used to represent any array type, including -;;; things such as SIMPLE-STRING. +;;; things such as SIMPLE-BASE-STRING. (defstruct (array-type (:include ctype (class-info (type-class-or-lose 'array))) (:constructor %make-array-type) @@ -462,6 +460,24 @@ (eq cdr-type *empty-type*)) *empty-type* (%make-cons-type car-type cdr-type))) + +(defun cons-type-length-info (type) + (declare (type cons-type type)) + (do ((min 1 (1+ min)) + (cdr (cons-type-cdr-type type) (cons-type-cdr-type cdr))) + ((not (cons-type-p cdr)) + (cond + ((csubtypep cdr (specifier-type 'null)) + (values min t)) + ((csubtypep *universal-type* cdr) + (values min nil)) + ((type/= (type-intersection (specifier-type 'cons) cdr) *empty-type*) + (values min nil)) + ((type/= (type-intersection (specifier-type 'null) cdr) *empty-type*) + (values min t)) + (t (values min :maybe)))) + ())) + ;;;; type utilities @@ -501,8 +517,9 @@ (fun (info :type :translator (car lspec)))) (cond (fun (funcall fun lspec)) - ((or (and (consp spec) (symbolp (car spec))) - (symbolp spec)) + ((or (and (consp spec) (symbolp (car spec)) + (not (info :type :builtin (car spec)))) + (and (symbolp spec) (not (info :type :builtin spec)))) (when (and *type-system-initialized* (not (eq (info :type :kind spec) :forthcoming-defclass-type))) @@ -536,7 +553,7 @@ (let ((def (cond ((symbolp form) (info :type :expander form)) ((and (consp form) (symbolp (car form))) - (info :type :expander (car form))) + (info :type :expander (car form))) (t nil)))) (if def (type-expand (funcall def (if (consp form) form (list form))))