From: Douglas K. <sn...@us...> - 2014-05-06 23:58:04
|
The branch "master" has been updated in SBCL: via 98d39c09c35c237c4c86a8346cbfd4e0c2e1e71e (commit) from f6b4604f3bfc7f1d3c125605eda9ecc9591a65ed (commit) - Log ----------------------------------------------------------------- commit 98d39c09c35c237c4c86a8346cbfd4e0c2e1e71e Author: Douglas Katzman <do...@go...> Date: Tue May 6 19:56:39 2014 -0400 DEFCONSTANT should remove a symbol-macro expansion --- src/compiler/defconstant.lisp | 7 +++++++ tests/compiler-2.impure-cload.lisp | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 0 deletions(-) diff --git a/src/compiler/defconstant.lisp b/src/compiler/defconstant.lisp index 76bd47f..9a90707 100644 --- a/src/compiler/defconstant.lisp +++ b/src/compiler/defconstant.lisp @@ -82,6 +82,13 @@ ;; don't warn or error or anything, just fall through.) ) (t (warn "redefining ~(~A~) ~S to be a constant" kind name)))) + ;; We ought to be consistent in treating any change of :VARIABLE :KIND + ;; as a continuable error. The above CASE expression pre-dates the + ;; existence of symbol-macros (I believe), but at a bare minimum, + ;; INFO should return NIL for its second value if requesting the + ;; :macro-expansion of something that is getting defined as constant. + (clear-info :variable :macro-expansion name) + (clear-info :source-location :symbol-macro name) (when doc (setf (fdocumentation name 'variable) doc)) #-sb-xc-host diff --git a/tests/compiler-2.impure-cload.lisp b/tests/compiler-2.impure-cload.lisp index 815a695..9aec729 100644 --- a/tests/compiler-2.impure-cload.lisp +++ b/tests/compiler-2.impure-cload.lisp @@ -64,3 +64,17 @@ (aref x y))) (assert (raises-error? (bubblesort (make-array 10) 9))) + +(define-symbol-macro %trash% what) +(locally + ;; just in case we get so smart that INFO becomes foldable + (declare (notinline sb-int:info)) + (assert (eq (sb-int:info :variable :kind '%trash%) :macro)) + (assert (eq (sb-int:info :variable :macro-expansion '%trash%) 'what)) + (assert (sb-int:info :source-location :symbol-macro '%trash%))) +(let () + (declare (notinline sb-int:info)) + (defconstant %trash% 9) ; this is non-toplevel + (multiple-value-bind (val foundp) + (sb-int:info :variable :macro-expansion '%trash%) + (assert (and (not val) (not foundp))))) ----------------------------------------------------------------------- hooks/post-receive -- SBCL |