From 4bf5bfa7545d01486194f5749ee1d3f7db1ec9f4 Mon Sep 17 00:00:00 2001 From: Douglas Katzman Date: Sun, 1 Mar 2015 08:59:25 -0500 Subject: [PATCH] Express TYPEXPAND-1 more concisely. --- src/code/early-type.lisp | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/code/early-type.lisp b/src/code/early-type.lisp index ce0da439a..4994f6b00 100644 --- a/src/code/early-type.lisp +++ b/src/code/early-type.lisp @@ -921,9 +921,9 @@ Returns two values: the expansion, and a boolean that is true when expansion happened." (declare (type type-specifier type-specifier)) (declare (ignore env)) - (multiple-value-bind (expander lspec) - (let ((spec type-specifier)) - (cond ((and (symbolp spec) (info :type :builtin spec)) + (let* ((spec type-specifier) + (atom (if (listp spec) (car spec) spec)) + (expander (and (symbolp atom) (info :type :expander atom)))) ;; We do not expand builtins even though it'd be ;; possible to do so sometimes (e.g. STRING) for two ;; reasons: @@ -931,20 +931,8 @@ expansion happened." ;; a) From a user's point of view, CL types are opaque. ;; ;; b) so (EQUAL (TYPEXPAND 'STRING) (TYPEXPAND-ALL 'STRING)) - (values nil nil)) - ((symbolp spec) - (values (info :type :expander spec) spec)) - ((and (consp spec) (symbolp (car spec)) (info :type :builtin (car spec))) - ;; see above - (values nil nil)) - ((and (consp spec) (symbolp (car spec))) - (values (info :type :expander (car spec)) spec)) - (t nil))) - (if expander - (values (funcall expander (if (symbolp lspec) - (list lspec) - lspec)) - t) + (if (and expander (not (info :type :builtin atom))) + (values (funcall expander (if (symbolp spec) (list spec) spec)) t) (values type-specifier nil)))) (defun typexpand (type-specifier &optional env) -- 2.11.4.GIT