From c34d88b5fb3e8a27a3ac5605f96ddd77aa29ae3b Mon Sep 17 00:00:00 2001 From: Raymond Toy <toy.raymond@gmail.com> Date: Mon, 12 May 2014 20:06:36 -0700 Subject: [PATCH] Fix bug in printing most-negative-fixnum * src/code/print.lisp: * Type declaration in {{{SUB-OUTPUT-INTEGER}}} was incorrect because we want to be able to print {{{(- most-negative-fixnum)}}}. * tests/printer.lisp: * Add test for this. --- src/code/print.lisp | 2 +- tests/printer.lisp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/code/print.lisp b/src/code/print.lisp index 999bc943c..f2a1205db 100644 --- a/src/code/print.lisp +++ b/src/code/print.lisp @@ -1297,7 +1297,7 @@ (write-char #\. stream))) (defun sub-output-integer (integer stream) - (declare (type (and fixnum unsigned-byte) integer)) + (declare (type (integer 0 #.(- most-negative-fixnum)) integer)) (let ((quotient 0) (remainder 0)) (declare (fixnum quotient remainder)) diff --git a/tests/printer.lisp b/tests/printer.lisp index b511f0bc5..5c958448a 100644 --- a/tests/printer.lisp +++ b/tests/printer.lisp @@ -111,3 +111,5 @@ (assert-equal "Scale factor 6: | 314159.0e-05|" (test-scale 11)) (assert-equal "Scale factor 7: | 3141590.e-06|" (test-scale 12)))) +(define-test sub-output-integer.1 + (assert-prints "-536870912" (princ most-negative-fixnum))) -- GitLab