Subject: Re: bug#23495: byte-compile-file return t when there is "XXX can't use lexical var" error

From: Michael Heerdegen <[email-masked]>
Date: Tue, 10 May 2016 20:23:43 +0200

Yuta Yamada <[email-masked]> writes:

> ---- code ----
> ;; -*- lexical-binding: t; -*-
> (defun foo ()
>   (let* ((a nil))
>     (add-to-list 'a "foo")))
>
> (provide 'foo)
> ---- code end ----
>
> In *Compile-Log* buffer, I got:
>
> ---- log ----
> Compiling /home/uta/local/vcs/github.com/yuutayamada/emacs.d/elisp/self/hoge/foo.el...
>
> In foo:
> foo.el:6:13:Error: `add-to-list' can't use lexical var `a'; use `push' or
>     `cl-pushnew'
> ---- log end ----
>
> But actually `byte-compile-file' return `t'.

AFAICT technically this is only a warning (displayed with
`display-warning' and level :error).  So compiling does indeed succeed I
think.

See the compiler macro defined in the defun of `add-to-list' for
internals.

Michael.