From: Stas Boukarev Date: Mon, 3 Jun 2013 16:40:59 +0000 (+0400) Subject: Uninitialized type-error conditions can now be printed. X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=8c6e2e85859766d2c4c6a272b952de2ebe467487;p=sbcl.git Uninitialized type-error conditions can now be printed. (print (make-condition 'simple-type-error)) signalled an unbound slot error. Reported by Eric Marsden, fixes lp#1184586. --- diff --git a/NEWS b/NEWS index 4da7f8c..391d0b3 100644 --- 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 diff --git a/src/code/condition.lisp b/src/code/condition.lisp index caca67a..81a0ce7 100644 --- a/src/code/condition.lisp +++ b/src/code/condition.lisp @@ -623,7 +623,9 @@ (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)))) diff --git a/tests/condition.pure.lisp b/tests/condition.pure.lisp index 0b071d8..5dca9a4 100644 --- a/tests/condition.pure.lisp +++ b/tests/condition.pure.lisp @@ -189,3 +189,6 @@ (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)))