So says CLHS.
When there is no format control and *PRINT-ESCAPE* is false,
signal an error.
variable reference to refer to a variable not in scope, causing an error
during physical environment analysis when attempting to close over the
variable. (lp#551227)
+ * bug fix: SIMPLE-CONDITION :FORMAT-CONTROL defaults to NIL.
changes in sbcl-1.0.46 relative to sbcl-1.0.45:
* enhancement: largefile support on Solaris.
;;; The current code doesn't seem to quite match that.
(def!method print-object ((x condition) stream)
(if *print-escape*
- (if (and (typep x 'simple-condition) (slot-boundp x 'format-control))
+ (if (and (typep x 'simple-condition) (slot-value x 'format-control))
(print-unreadable-object (x stream :type t :identity t)
- (format stream "~S" (simple-condition-format-control x)))
+ (write (simple-condition-format-control x)
+ :stream stream
+ :lines 1))
(print-unreadable-object (x stream :type t :identity t)))
;; KLUDGE: A comment from CMU CL here said
;; 7/13/98 BUG? CPL is not sorted and results here depend on order of
(define-condition style-warning (warning) ())
(defun simple-condition-printer (condition stream)
- (apply #'format
- stream
- (simple-condition-format-control condition)
- (simple-condition-format-arguments condition)))
+ (let ((control (simple-condition-format-control condition)))
+ (if control
+ (apply #'format stream
+ control
+ (simple-condition-format-arguments condition))
+ (error "No format-control for ~S" condition))))
(define-condition simple-condition ()
((format-control :reader simple-condition-format-control
:initarg :format-control
+ :initform nil
:type format-control)
(format-arguments :reader simple-condition-format-arguments
:initarg :format-arguments
- :initform '()
+ :initform nil
:type list))
(:report simple-condition-printer))
(defknown method-combination-error (format-control &rest t) *)
(defknown signal (t &rest t) null)
(defknown simple-condition-format-control (condition)
- format-control)
+ (or null format-control))
(defknown simple-condition-format-arguments (condition)
list)
(defknown warn (t &rest t) null)
(assert (equal '(restart-case (foo :report "quux" (quux)))
(simple-condition-format-arguments e)))
:ok)))))
+
+(with-test (:name :simple-condition-without-args)
+ (let ((sc (make-condition 'simple-condition)))
+ (assert (not (simple-condition-format-control sc)))
+ (assert (not (simple-condition-format-arguments sc)))
+ (assert (stringp (prin1-to-string sc)))
+ (assert
+ (eq :ok
+ (handler-case
+ (princ-to-string sc)
+ (simple-error (c)
+ (when (and (equal "No format-control for ~S"
+ (simple-condition-format-control c))
+ (eq sc (car
+ (simple-condition-format-arguments c))))
+ :ok)))))))
;;; 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".)
-"1.0.46.36"
+"1.0.46.37"