bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#28107: 26.0.50; Byte compilation shows an unused var warning for an


From: Tino Calancha
Subject: bug#28107: 26.0.50; Byte compilation shows an unused var warning for an used variable
Date: Fri, 18 Aug 2017 02:32:59 +0900 (JST)
User-agent: Alpine 2.20 (DEB 67 2015-01-07)



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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]