GNU bug report logs -
#28107
26.0.50; Byte compilation shows an unused var warning for an used variable
Previous Next
Reported by: Tino Calancha <tino.calancha <at> gmail.com>
Date: Wed, 16 Aug 2017 06:13:02 UTC
Severity: minor
Tags: notabug
Found in version 26.0.50
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On Thu, 17 Aug 2017, Glenn Morris wrote:
> Tino Calancha wrote:
>
>> ;; Warning: value returned from (cdr x) is unused
>> (defun test2 ()
>> (let ((alist (list (cons "foo" 1) (cons "bar" 2))))
>> (dolist (x alist)
>> (when (cdr x)
>> (equal (cdr x) (alist-get (car x) alist))))))
>
> Isn't this function a no-op?
> Eg dolist does not return the last value from the body.
> So a smaller example of the same thing is:
>
> (dolist (x '(1))
> (equal (+ x 2) 3))
>
> which returns nil.
Even without the dolist we get such warning:
$> cat /tmp/test.el
;; -*- lexical-binding: t; -*-
(let ((x 1))
(and (equal (+ x 2) 3)))
M-x byte-compile-file RET /tmp/test RET
Compiling file /tmp/test.el at Fri Aug 18 02:30:59 2017
test.el:2:1:Warning: value returned from (+ x 2) is unused
test.el:2:1:Warning: value returned from (+ x 2) is unused
I used (+ x 2) as 1st argument for `equal'. What more should i do to
use it? Maybe invite (+ x 2) to the cinema?
I hope (+ x 2) will pay, cinema it's too expensive here.
This bug report was last modified 5 years and 350 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.