type of a variable or bind a constant is made.
* bug fix: SET signals an error when an attempt to violate declared
type of a variable is made.
+ * bug fix: restart computation during the execution of a restart
+ test function no longer causes infinite recursion. (reported by
+ Michael Weber)
changes in sbcl-1.0.19 relative to 1.0.18:
* new feature: user-customizable variable SB-EXT:*MUFFLED-WARNINGS*;
(prin1 (restart-name restart) stream))
(restart-report restart stream)))
+(defvar *restart-test-stack* nil)
+
(defun compute-restarts (&optional condition)
#!+sb-doc
"Return a list of all the currently active restarts ordered from most recently
(setq associated (cdr alist))
(setq other (append (cdr alist) other))))
(collect ((res))
- (dolist (restart-cluster *restart-clusters*)
- (dolist (restart restart-cluster)
- (when (and (or (not condition)
- (member restart associated)
- (not (member restart other)))
- (funcall (restart-test-function restart) condition))
- (res restart))))
+ (let ((stack *restart-test-stack*))
+ (declare (optimize sb!c::stack-allocate-dynamic-extent))
+ (dolist (restart-cluster *restart-clusters*)
+ (dolist (restart restart-cluster)
+ (when (and (or (not condition)
+ (memq restart associated)
+ (not (memq restart other)))
+ ;; A call to COMPUTE-RESTARTS -- from an error, from
+ ;; user code, whatever -- inside the test function
+ ;; would cause infinite recursion here, so we disable
+ ;; each restart using *restart-test-stack* for the
+ ;; duraction of the test call.
+ (not (memq restart stack))
+ (let ((*restart-test-stack* (cons restart stack)))
+ (declare (dynamic-extent *restart-test-stack*))
+ (funcall (restart-test-function restart) condition)))
+ (res restart)))))
(res))))
#!+sb-doc
;; whether escaped or not
(dolist (*print-escape* '(nil t))
(write c :stream (make-string-output-stream)))))
+
+;;; Reported by Michael Weber: restart computation in :TEST-FUNCTION used to
+;;; cause infinite recursion.
+(defun restart-test-finds-restarts ()
+ (restart-bind
+ ((bar (lambda ()
+ (return-from restart-test-finds-restarts 42))
+ :test-function
+ (lambda (condition)
+ (find-restart 'qux))))
+ (when (find-restart 'bar)
+ (invoke-restart 'bar))))
+(assert (not (restart-test-finds-restarts)))