Subject: Re: bug#35186: 26.1; confusing error message and location on eager dotted pair evaluation

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 20 Aug 2020 18:28:11 +0200

Michael Heerdegen <[email-masked]> writes:

> Lars Ingebrigtsen <[email-masked]> writes:
>
>> I've tried sprinkling some messaging liberally over cconv-analyze-form,
>> and I'm unable to make it trigger in the test case.  It does seem likely
>> that the error is from a dolist somewhere, but it seems to happen before
>> we get to that function...
>
> Did you enable lexical-binding mode?  I guess it will make a difference.
> A had done it AFAIR.

Ah, yes, that made a difference.  With the following patch I get:

larsi@xo:~/src/emacs/trunk$ emake ; ./src/emacs -Q --batch -f batch-byte-compile /tmp/r.el
  ELC      emacs-lisp/cconv.elc

In toplevel form:
/tmp/r.el:3:1: Error: Wrong type argument: proper-list-p, (a . b)

Does this makes sense to everybody?

diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el
index 351a097ad1..c024cda876 100644
--- a/lisp/emacs-lisp/cconv.el
+++ b/lisp/emacs-lisp/cconv.el
@@ -750,6 +750,8 @@ cconv-analyze-form
     ;; (`(declare . ,_) nil)               ;The args don't contain code.
 
     (`(,_ . ,body-forms)    ; First element is a function or whatever.
+     (unless (listp body-forms)
+       (signal 'wrong-type-argument (list 'proper-list-p form)))
      (dolist (form body-forms) (cconv-analyze-form form env)))
 
     ((pred symbolp)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no