1.0.43.59: fix DEFSETF to reject non-symbols as functions names
authorNikodemus Siivola <nikodemus@random-state.net>
Thu, 14 Oct 2010 19:36:59 +0000 (19:36 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Thu, 14 Oct 2010 19:36:59 +0000 (19:36 +0000)
  The short form of DEFSETF requires the second argument to be a
  symbol.  Added the appropriate check and a test case.

  See also the section 5.3 in CLHS.

  Patch by Roman Marynchak.

src/code/early-setf.lisp
tests/setf.impure.lisp
version.lisp-expr

index da208b9..ddd4755 100644 (file)
@@ -393,7 +393,7 @@ GET-SETF-EXPANSION directly."
   #!+sb-doc
   "Associates a SETF update function or macro with the specified access
   function or macro. The format is complex. See the manual for details."
-  (cond ((not (listp (car rest)))
+  (cond ((and (not (listp (car rest))) (symbolp (car rest)))
          `(eval-when (:load-toplevel :compile-toplevel :execute)
             (assign-setf-macro ',access-fn
                                nil
index cd13d8d..b34349a 100644 (file)
     (assert (equal `(funcall #'(setf foo) ,@stores 1 2 3) set))
     (assert (equal '(foo 1 2 3) get))))
 
+(with-test (:name :update-fn-should-be-a-symbol-in-defsetf)
+  (assert (eq :error
+            (handler-case
+                (eval '(defsetf access-fn 5))
+              (error ()
+                :error)))))
+
 ;;; success
index cef832a..bfc1939 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.43.58"
+"1.0.43.59"