From b83353d9f998e5c0e34604b5593df70c66d2c510 Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Sun, 13 Oct 2013 21:04:30 +0400 Subject: [PATCH] Fix (compile '(setf function)). COMPILE was defined as (name &optional (definition (or (macro-function name) (fdefinition name)))) The call to macro-function caused an error when called on '(setf x). Change it to (or (and (symbolp name) (macro-function name)) (fdefinition name)) Reported by Douglas Katzman. --- NEWS | 2 ++ src/compiler/target-main.lisp | 3 ++- tests/compiler.impure.lisp | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 34cb3f8..714bf18 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,8 @@ changes relative to sbcl-1.1.12: from the same location. (patch by Douglas Katzman, lp#1042405) * bug fix: Create vectors of proper internal length when reading literal vectors from FASLs. (Reported by Jan Moringen) + * bug fix: COMPILE can now succefully compile setf functions. + (Reported by Douglas Katzman) changes in sbcl-1.1.12 relative to sbcl-1.1.11: * enhancement: Add sb-bsd-sockets:socket-shutdown, for calling diff --git a/src/compiler/target-main.lisp b/src/compiler/target-main.lisp index 791c2d4..0b11bda 100644 --- a/src/compiler/target-main.lisp +++ b/src/compiler/target-main.lisp @@ -151,7 +151,8 @@ (t (values compiled-definition warnings-p failure-p))))) -(defun compile (name &optional (definition (or (macro-function name) +(defun compile (name &optional (definition (or (and (symbolp name) + (macro-function name)) (fdefinition name)))) #!+sb-doc "Produce a compiled function from DEFINITION. If DEFINITION is a diff --git a/tests/compiler.impure.lisp b/tests/compiler.impure.lisp index 7ab3ee5..c0f5b0a 100644 --- a/tests/compiler.impure.lisp +++ b/tests/compiler.impure.lisp @@ -1431,6 +1431,12 @@ (defun (setf test-984) ()) nil) (style-warning () t)))) + +(with-test (:name :compile-setf-function) + (defun (setf compile-setf) ()) + (assert (equal (compile '(setf compile-setf)) + '(setf compile-setf)))) + ;;;; tests not in the problem domain, but of the consistency of the ;;;; compiler machinery itself -- 1.7.10.4