unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#69108: false-positive warning "variable ‘_’ not left unused" in if-let* and if-let
@ 2024-02-13 21:21 Konstantin Kharlamov
  2024-02-14  1:01 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 14+ messages in thread
From: Konstantin Kharlamov @ 2024-02-13 21:21 UTC (permalink / raw)
  To: 69108

I've been writing an answer for a question on emacs.stackexchange¹ and to avoid
nested `if` and `let` clauses I used a `if-let*`, and result of one of the checks I
assigned to a `_` variable, because the variable would be left unused, it's only the
check being non-nil that mattered.

But when byte-compiled that triggered a:

    test.el:6:9: Warning: variable ‘_’ not left unused

…which is untrue, because it is unused.

The problem is present in both `if-let` and `if-let*`

# Steps to reproduce

1. Create test.el with the following code:

    ;;; -*- lexical-binding: t -*-
    (if-let*
        ((_ nil))
        (print "then clause")
      (print "else clause"))

2. M-x byte-compile test.el

## Expected

It byte-compiles with no warnings

## Actual

It compiles with a warning:

    test.el:3:7: Warning: variable ‘_’ not left unused

# Additional information

Emacs version: commit d4d5830f8a0 built two weeks ago from master.

1: https://emacs.stackexchange.com/questions/80351/delete-prettify-symbol





^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-02-25  7:42 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-13 21:21 bug#69108: false-positive warning "variable ‘_’ not left unused" in if-let* and if-let Konstantin Kharlamov
2024-02-14  1:01 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-17  0:28   ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-17  8:04     ` Eli Zaretskii
2024-02-17  9:20       ` Konstantin Kharlamov
2024-02-17 11:45         ` Ihor Radchenko
2024-02-17 10:09           ` Konstantin Kharlamov
2024-02-19 12:37             ` Ihor Radchenko
2024-02-19 13:44               ` Konstantin Kharlamov
2024-02-17 21:46         ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-17 22:02       ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-18  6:53         ` Eli Zaretskii
2024-02-25  1:54           ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-25  7:42             ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).