destructuring-bind on an atom results in wrong error message

Bug #1814376 reported by Michael Fiano on 2019-02-02
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

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

; 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))
            (IF (NOT (EQL #:G558 0))
                (CAR (TRULY-THE CONS #:G558)))))

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers