Inspector shows wrong array element type

Bug #1835934 reported by Richard M Kreuter on 2019-07-09
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Jan Moringen

Bug Description

The inspector claims all arrays have element type NIL. Example from today's git master:

$ sh ./ --no-userinit --no-sysinit
This is SBCL, an implementation of ANSI Common Lisp.
More information about SBCL is available at <>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (inspect (make-array '() :element-type t))

The object is an ARRAY of NIL.
Its dimensions are NIL.
0. [] : 0

I expected it to say the object is an array of T.

The fix is trivial: the arguments to the format string in the INSPECTED-PARTS method for ARRAY are in the wrong order (and the format directive that's meant to distinguish displaced arrays is logically inverted). Patch attached. Here are some rudimentary tests.

(let ((string (with-output-to-string (*standard-output*)
                (with-input-from-string (*standard-input* "q")
                  (inspect (make-array '()))))))
  (assert (search "an ARRAY of T" string)))

(let ((string (with-output-to-string (*standard-output*)
                (with-input-from-string (*standard-input* "q")
                  (inspect (make-array '() :element-type 'fixnum))))))
  (assert (search "an ARRAY of FIXNUM" string)))

(let ((string (with-output-to-string (*standard-output*)
                (with-input-from-string (*standard-input* "q")
                  (let ((a (make-array ())))
                    (inspect (make-array '() :displaced-to a)))))))
  (assert (search "a displaced ARRAY of T" string)))

Jan Moringen (scymtym) on 2019-07-11
Changed in sbcl:
status: New → Confirmed
assignee: nobody → Jan Moringen (scymtym)
importance: Undecided → Low
Jan Moringen (scymtym) on 2019-07-12
Changed in sbcl:
status: Confirmed → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers