GNU bug report logs - #74920
31.0.50; 'should' defeats warning from set-advertised-calling-convention

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefankangas <at> gmail.com>

Date: Mon, 16 Dec 2024 23:49:02 UTC

Severity: minor

Found in version 31.0.50

Full log


View this message in rfc822 format

From: "Basil L. Contovounesios" <basil <at> contovou.net>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 74920 <at> debbugs.gnu.org
Subject: bug#74920: 31.0.50; 'should' defeats warning from set-advertised-calling-convention
Date: Sun, 02 Feb 2025 19:27:43 +0100
Stefan Kangas [2024-12-16 23:47 +0000] wrote:

> Create a file foo.el with this content:
>
>     ;; -*- lexical-binding: t; -*-
>     (defun foo (&optional a) a)
>     (set-advertised-calling-convention 'foo '(a) '"31.1")
>     (foo)
>
> Create a second file bar.el with this:
>
>     ;; -*- lexical-binding: t; -*-
>     (load "foo")
>     (require 'ert)
>     (foo)
>     (should (foo))
>
> Byte-compile bar.el and observe that there is only one warning:
>
> bar.el:4:2: Warning: ‘foo’ called with 0 arguments, but requires 1
>
> Expected is two warnings, like this:
>
> bar.el:4:2: Warning: ‘foo’ called with 0 arguments, but requires 1
> bar.el:5:2: Warning: ‘foo’ called with 0 arguments, but requires 1

It's not just 'should', and not just set-advertised-calling-convention:

  ;; -*- lexical-binding: t -*-
  (require 'cl-lib)
  (require 'ert)
  (defun       foo () (cl-nreconc '(1 2 3) '(4 5 6)))
  (ert-deftest foo () (cl-nreconc '(a b c) '(d e f)))

Byte-compiling this gives only one 'cl-nreconc on constant list' warning
instead of two.

The macroexpansion of (should (cl-nreconc '(a b c) '(d e f))) gives some
hints as to why the warning could be lost, since the direct call to
cl-nreconc is turned into an indirect one.

But ERT seems to give rise to false negatives regardless of 'should'.

-- 
Basil




This bug report was last modified 121 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.