From: Christophe Rhodes Date: Fri, 7 Oct 2005 04:57:09 +0000 (+0000) Subject: 0.9.5.29: X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=65e947c7a90df88e0691e664f3387ccb35d390d9;p=sbcl.git 0.9.5.29: Fix bug reported by Matthew D Swank on comp.lang.lisp ... macroexpand-1 shouldn't expand a global symbol macro if there's a local binding in the environment. ... (setf wasn't getting this wrong, because it was converting immediately to setq, but push was, because it calls get-setf-expansion) --- diff --git a/NEWS b/NEWS index 968c8ed..c666ace 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ changes in sbcl-0.9.6 relative to sbcl-0.9.5: (thanks to Svein Ove Aas) * bug fix: Unicode symbols are correctly printed in LDB backtraces (thanks to David Lichteblau) + * bug fix: local bindings shadow global symbol macros for + macroexpansion. (reported by Matthew D Swank on comp.lang.lisp) * optimization: non-open coded uses of numeric comparison operators (e.g. >) no longer cons when called with more than one parameter on platforms supporting dynamic-extent allocation. diff --git a/src/code/macroexpand.lisp b/src/code/macroexpand.lisp index 9a94350..ca38c6c 100644 --- a/src/code/macroexpand.lisp +++ b/src/code/macroexpand.lisp @@ -58,6 +58,8 @@ (cond ((and (consp local-def) (eq (car local-def) 'macro)) (values (cdr local-def) t)) + (local-def + (values form nil)) ((eq (info :variable :kind form) :macro) (values (info :variable :macro-expansion form) t)) (t diff --git a/tests/macroexpand.impure.lisp b/tests/macroexpand.impure.lisp new file mode 100644 index 0000000..6f5863d --- /dev/null +++ b/tests/macroexpand.impure.lisp @@ -0,0 +1,29 @@ +;;;; This file is for macroexpander tests which have side effects + +;;;; This software is part of the SBCL system. See the README file for +;;;; more information. +;;;; +;;;; While most of SBCL is derived from the CMU CL system, the test +;;;; files (like this one) were written from scratch after the fork +;;;; from CMU CL. +;;;; +;;;; This software is in the public domain and is provided with +;;;; absolutely no warranty. See the COPYING and CREDITS files for +;;;; more information. + +;;; From Matthew Swank on cll 2005-10-06 + +(defmacro defglobal (name &optional value) + (let ((internal (gensym))) + `(progn + (defparameter ,internal ,value) + (define-symbol-macro ,name ,internal)))) + +(defglobal glob) + +(assert (= (let ((glob 4)) glob))) +(assert (null glob)) +(assert (equal (let ((glob nil)) (setf glob (cons 'foo glob)) glob) '(foo))) +(assert (null glob)) +(assert (equal (let ((glob nil)) (push 'foo glob) glob) '(foo))) +(assert (null glob)) diff --git a/version.lisp-expr b/version.lisp-expr index f1d8d07..2541d65 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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".) -"0.9.5.27" +"0.9.5.29"