diff --git a/src/CHANGELOG b/src/CHANGELOG index ed5ec00aa..673894928 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -82,6 +82,8 @@ ECL 0.9l-p1: - Inline/not-inline declarations for SETF-functions are not ignored (Josh Elsasser). + - When a SETF place is a macro, it has to be expanded with MACROEXPAND-1. + ;;; Local Variables: *** ;;; mode:text *** ;;; fill-column:79 *** diff --git a/src/lsp/setf.lsp b/src/lsp/setf.lsp index 56b681c75..2ec6b3f52 100644 --- a/src/lsp/setf.lsp +++ b/src/lsp/setf.lsp @@ -110,8 +110,10 @@ Does not check if the third gang is a single-element list." (push item names)) (push item all-args)) (values (gensym) (nreverse names) (nreverse values) (nreverse all-args)))) + ;; Note that macroexpansion of SETF arguments can only be done via + ;; MACROEXPAND-1 [ANSI 5.1.2.7] (cond ((symbolp form) - (if (and (setq f (macroexpand form env)) (not (equal f form))) + (if (and (setq f (macroexpand-1 form env)) (not (equal f form))) (get-setf-expansion f env) (let ((store (gensym))) (values nil nil (list store) `(setq ,form ,store) form)))) @@ -130,7 +132,7 @@ Does not check if the third gang is a single-element list." (setf-structure-access (car all) (car f) (cdr f) store)) ((setq f (get-sysprop (car form) 'SETF-LAMBDA)) (apply f store all)) - ((and (setq f (macroexpand form env)) (not (equal f form))) + ((and (setq f (macroexpand-1 f env)) (not (equal f form))) (return-from get-setf-expansion (get-setf-expansion f env))) (t