X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fdeftype.lisp;h=370852556b1ad7f65a10e9aa1bfa360d63a4f3ae;hb=3d544b84f2b7ecd617d220145a775079df6c7919;hp=5d204478c81519dfb7115db6ef17cde8ad5461ce;hpb=7499dd43744531513e5186d72f08efec7b8c5ff9;p=sbcl.git diff --git a/src/compiler/deftype.lisp b/src/compiler/deftype.lisp index 5d20447..3708525 100644 --- a/src/compiler/deftype.lisp +++ b/src/compiler/deftype.lisp @@ -19,11 +19,12 @@ (defun %deftype (name) (setf (classoid-cell-pcl-class (find-classoid-cell name :create t)) nil)) -(def!macro sb!xc:deftype (name lambda-list &body body) +(def!macro sb!xc:deftype (&whole form name lambda-list &body body) #!+sb-doc "Define a new type, with syntax like DEFMACRO." (unless (symbolp name) - (error "type name not a symbol: ~S" name)) + (bad-type name 'symbol "Type name is not a symbol:~% ~S" + form)) (multiple-value-bind (expander-form doc source-location-form) (multiple-value-bind (forms decls doc) (parse-body body) ;; FIXME: We could use CONSTANTP here to deal with slightly more @@ -31,7 +32,7 @@ ;; is not availble early enough. (if (and (not lambda-list) (not decls) (not (cdr forms)) (or (member (car forms) '(t nil)) - (eq 'quote (caar forms)))) + (and (consp (car forms)) (eq 'quote (caar forms))))) (values `(constant-type-expander ,(car forms)) doc '(sb!c:source-location)) (with-unique-names (whole) (multiple-value-bind (macro-body local-decs doc)