destructuring-bind on an atom results in wrong error message

Bug #1814376 reported by Michael Fiano
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Undecided
Douglas Katzman

Bug Description

(defun foo ()
  (let ((bar 42))
    (destructuring-bind (&key baz) bar
      baz)))

; error while parsing arguments to NIL DESTRUCTURING-BIND:
; dotted keyword/value list: 42

The error message should be fixed, since 42 is not a dotted list.
The value is constant and destructuring-bind could emit a compile-time warning.
I believe destructuring-bind needs to be updated for the case when its second argument is constantp.

macro expansion:
(defun foo ()
  (let ((bar 42))
    (LET* ((#:G557 (SB-C::CHECK-DS-LIST/&KEY BAR 0 0 '(&KEY BAZ) #(:BAZ)))
           (#:G558 (SB-C::DS-GETF #:G557 ':BAZ))
           (BAZ
            (IF (NOT (EQL #:G558 0))
                (CAR (TRULY-THE CONS #:G558)))))
      BAZ)))

Revision history for this message
Douglas Katzman (dougk) wrote :

Changed the error message in https://sourceforge.net/p/sbcl/sbcl/ci/143d47eeca22fad26404f26101510d613bda20ad/

Not sure what "updated for the case when ... constantp" means - the macro works fine.
("could" and "needs to" are quite different claims).

Changed in sbcl:
assignee: nobody → Douglas Katzman (dougk)
status: New → Fix Committed
Stas Boukarev (stassats)
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.