X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fcross-type.lisp;h=0ac13c9d52e46e120b36f20372daca42a1c0d46c;hb=25fe91bf63fd473d9316675b0e0ca9be0079e9eb;hp=79b8cd13771aba2cffd4ccd1c2ceb3cf4c3fd765;hpb=0aecc2b20142e08068c3434273500131cb13fe2d;p=sbcl.git diff --git a/src/code/cross-type.lisp b/src/code/cross-type.lisp index 79b8cd1..0ac13c9 100644 --- a/src/code/cross-type.lisp +++ b/src/code/cross-type.lisp @@ -341,10 +341,23 @@ ;;; cross-compile time only. (defun ctypep (obj ctype) (check-type ctype ctype) - (let (;; the Common Lisp type specifier corresponding to CTYPE - (type (type-specifier ctype))) - (check-type type (or symbol cons)) - (cross-typep obj type))) + ;; There is at least one possible endless recursion in the + ;; cross-compiler type system: (SUBTYPEP NULL (OR UNKOWN0 UNKNOWN1) + ;; runs out of stack. The right way would probably be to not + ;; implement CTYPEP in terms of TYPE-SPECIFIER (:UNPARSE, that may + ;; call TYPE=, that in turn may call CTYPEP). Until then, pick a few + ;; cherries off. + (cond ((member-type-p ctype) + (if (member obj (member-type-members ctype)) + (values t t) + (values nil t))) + ((union-type-p ctype) + (any/type #'ctypep obj (union-type-types ctype))) + (t + (let ( ;; the Common Lisp type specifier corresponding to CTYPE + (type (type-specifier ctype))) + (check-type type (or symbol cons)) + (cross-typep obj type))))) (defun ctype-of (x) (typecase x