Uninitialized type-error conditions can now be printed.
authorStas Boukarev <stassats@gmail.com>
Mon, 3 Jun 2013 16:40:59 +0000 (20:40 +0400)
committerStas Boukarev <stassats@gmail.com>
Mon, 3 Jun 2013 16:40:59 +0000 (20:40 +0400)
(print (make-condition 'simple-type-error)) signalled an unbound slot
error.

Reported by Eric Marsden, fixes lp#1184586.

NEWS
src/code/condition.lisp
tests/condition.pure.lisp

diff --git a/NEWS b/NEWS
index 4da7f8c..391d0b3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,8 @@ changes relative to sbcl-1.1.8:
     types.  (reported by Vsevolod Dyomkin)
   * bug fix: sb-bsd-sockets has correct declaration of the canonname field of
     addrinfo. (lp#1187041, patch by Jerry James)
+  * bug fix: uninitialized type-error conditions can now be printed.
+    (lp#1184586)
   
 changes in sbcl-1.1.8 relative to sbcl-1.1.7:
   * notice: The implementation of MAP-ALLOCATED-OBJECTS (the heart of
index caca67a..81a0ce7 100644 (file)
              (type-error-expected-type condition)))))
 
 (def!method print-object ((condition type-error) stream)
-  (if *print-escape*
+  (if (and *print-escape*
+           (slot-boundp condition 'expected-type)
+           (slot-boundp condition 'datum))
       (flet ((maybe-string (thing)
                (ignore-errors
                  (write-to-string thing :lines 1 :readably nil :array nil :pretty t))))
index 0b071d8..5dca9a4 100644 (file)
                   (when (and (eq 'list (type-error-expected-type e))
                              (eql 8 (type-error-datum e)))
                     :type-error))))))
+
+(with-test (:name (:printing-unintitialized-condition :bug-1184586))
+  (prin1-to-string (make-condition 'simple-type-error)))