From 989580141ab01d799365be12642e54b5d7c83136 Mon Sep 17 00:00:00 2001 From: Alexey Dejneka Date: Fri, 11 Oct 2002 02:11:06 +0000 Subject: [PATCH] 0.7.8.26: Fixed bug 48c: SYMBOL-MACROLET should signal PROGRAM-ERROR if the introduced macro has a bound SPECIAL declaration. --- BUGS | 5 ----- NEWS | 2 ++ src/code/defmacro.lisp | 2 ++ src/compiler/ir1-translators.lisp | 18 ++++++++++-------- src/compiler/main.lisp | 12 +++++++----- tests/compiler.pure.lisp | 10 ++++++++++ version.lisp-expr | 2 +- 7 files changed, 32 insertions(+), 19 deletions(-) diff --git a/BUGS b/BUGS index 4c07d1d..e932280 100644 --- a/BUGS +++ b/BUGS @@ -264,11 +264,6 @@ WORKAROUND: d: (DEFGENERIC IF (X)) should signal a PROGRAM-ERROR, but instead causes a COMPILER-ERROR. -48: - SYMBOL-MACROLET bugs reported by Peter Van Eynde July 25, 2000: - c: SYMBOL-MACROLET should signal PROGRAM-ERROR if something - it binds is declared SPECIAL inside. - 51: miscellaneous errors reported by Peter Van Eynde July 25, 2000: a: (PROGN diff --git a/NEWS b/NEWS index f29756b..9603f80 100644 --- a/NEWS +++ b/NEWS @@ -1319,6 +1319,8 @@ changes in sbcl-0.7.9 relative to sbcl-0.7.8: so it can be non-toplevel. * fixed bugs 46h and 46i: TWO-WAY- and CONCATENATED-STREAM creation functions now check the types of their inputs as required by ANSI. + * fixed bug 48c: SYMBOL-MACROLET signals PROGRAM-ERROR when an + introduced symbol is DECLAREd to be SPECIAL. planned incompatible changes in 0.7.x: * When the profiling interface settles down, maybe in 0.7.x, maybe diff --git a/src/code/defmacro.lisp b/src/code/defmacro.lisp index b93621b..2bc701b 100644 --- a/src/code/defmacro.lisp +++ b/src/code/defmacro.lisp @@ -42,6 +42,8 @@ ;; old note (ca. 1985, maybe:-): "Eventually %%DEFMACRO ;; should deal with clearing old compiler information for ;; the functional value." + ,@(unless set-args-p + '((declare (ignore lambda-list)))) (ecase (info :function :kind name) ((nil)) (:function diff --git a/src/compiler/ir1-translators.lisp b/src/compiler/ir1-translators.lisp index f2e860e..2298154 100644 --- a/src/compiler/ir1-translators.lisp +++ b/src/compiler/ir1-translators.lisp @@ -250,7 +250,7 @@ (compiler-style-warn "duplicate definitions in ~S" definitions)) (let* ((processed-definitions (mapcar definitionize-fun definitions)) (*lexenv* (make-lexenv definitionize-keyword processed-definitions))) - (funcall fun))) + (funcall fun definitionize-keyword processed-definitions))) ;;; Tweak *LEXENV* to include the DEFINITIONS from a MACROLET, then ;;; call FUN (with no arguments). @@ -292,9 +292,11 @@ defined. Name is the local macro name, Lambda-List is the DEFMACRO style destructuring lambda list, and the Forms evaluate to the expansion. The Forms are evaluated in the null environment." - (funcall-in-macrolet-lexenv definitions - (lambda () - (ir1-translate-locally body start cont)))) + (funcall-in-macrolet-lexenv + definitions + (lambda (&key funs) + (declare (ignore funs)) + (ir1-translate-locally body start cont)))) (defun funcall-in-symbol-macrolet-lexenv (definitions fun) (%funcall-in-foomacrolet-lexenv @@ -321,8 +323,8 @@ body, references to a Name will effectively be replaced with the Expansion." (funcall-in-symbol-macrolet-lexenv macrobindings - (lambda () - (ir1-translate-locally body start cont)))) + (lambda (&key vars) + (ir1-translate-locally body start cont :vars vars)))) ;;; not really a special form, but.. (def-ir1-translator declare ((&rest stuff) start cont) @@ -579,10 +581,10 @@ ;;; but we don't need to worry about that within an IR1 translator, ;;; since toplevel-formness is picked off by PROCESS-TOPLEVEL-FOO ;;; forms before we hit the IR1 transform level. -(defun ir1-translate-locally (body start cont) +(defun ir1-translate-locally (body start cont &key vars funs) (declare (type list body) (type continuation start cont)) (multiple-value-bind (forms decls) (parse-body body nil) - (let ((*lexenv* (process-decls decls nil nil cont))) + (let ((*lexenv* (process-decls decls vars funs cont))) (ir1-convert-aux-bindings start cont forms nil nil)))) (def-ir1-translator locally ((&body body) start cont) diff --git a/src/compiler/main.lisp b/src/compiler/main.lisp index e297258..fd27819 100644 --- a/src/compiler/main.lisp +++ b/src/compiler/main.lisp @@ -799,11 +799,11 @@ ;;; Process a top level use of LOCALLY, or anything else (e.g. ;;; MACROLET) at top level which has declarations and ordinary forms. ;;; We parse declarations and then recursively process the body. -(defun process-toplevel-locally (body path compile-time-too) +(defun process-toplevel-locally (body path compile-time-too &key vars funs) (declare (list path)) (multiple-value-bind (forms decls) (parse-body body nil) (let* ((*lexenv* - (process-decls decls nil nil (make-continuation))) + (process-decls decls vars funs (make-continuation))) ;; Binding *POLICY* is pretty much of a hack, since it ;; causes LOCALLY to "capture" enclosed proclamations. It ;; is necessary because CONVERT-AND-MAYBE-COMPILE uses the @@ -1113,17 +1113,19 @@ ((macrolet) (funcall-in-macrolet-lexenv magic - (lambda () + (lambda (&key funs) + (declare (ignore funs)) (process-toplevel-locally body path compile-time-too)))) ((symbol-macrolet) (funcall-in-symbol-macrolet-lexenv magic - (lambda () + (lambda (&key vars) (process-toplevel-locally body path - compile-time-too))))))) + compile-time-too + :vars vars))))))) ((locally) (process-toplevel-locally (rest form) path compile-time-too)) ((progn) diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index c36dbea..58baf1f 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -211,3 +211,13 @@ (list (mext '(1 2)) (mint (1 2))))) '((:MEXT 1 2) (:MINT (:MEXT 1 2))))) + +;;; bug 48c: SYMBOL-MACROLET should signal PROGRAM-ERROR if introduced +;;; symbol is declared to be SPECIAL +(multiple-value-bind (result error) + (ignore-errors (funcall (lambda () + (symbol-macrolet ((s '(1 2))) + (declare (special s)) + s)))) + (assert (null result)) + (assert (typep error 'program-error))) diff --git a/version.lisp-expr b/version.lisp-expr index 47c9931..2dcb0b8 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -18,4 +18,4 @@ ;;; internal versions off the main CVS branch, it gets hairier, e.g. ;;; "0.pre7.14.flaky4.13".) -"0.7.8.25" +"0.7.8.26" -- 1.7.10.4