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

To reply to this bug, email your comments to 74920 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#74920; Package emacs. (Mon, 16 Dec 2024 23:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Kangas <stefankangas <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 16 Dec 2024 23:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50;
 'should' defeats warning from set-advertised-calling-convention
Date: Mon, 16 Dec 2024 23:47:52 +0000
Severity: minor

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74920; Package emacs. (Sun, 02 Feb 2025 18:28:02 GMT) Full text and rfc822 format available.

Message #8 received at 74920 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <basil <at> contovou.net>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 74920 <at> debbugs.gnu.org
Subject: Re: 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74920; Package emacs. (Mon, 03 Feb 2025 08:54:02 GMT) Full text and rfc822 format available.

Message #11 received at 74920 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <basil <at> contovou.net>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 74920 <at> debbugs.gnu.org
Subject: Re: bug#74920: 31.0.50; 'should' defeats warning from
 set-advertised-calling-convention
Date: Mon, 03 Feb 2025 09:53:13 +0100
Basil L. Contovounesios [2025-02-02 19:27 +0100] wrote:

> 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'.

Ah, I think the case of cl-nreconc is affected by it being proclaimed as
inline in cl-macs.el.

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74920; Package emacs. (Thu, 13 Feb 2025 17:52:02 GMT) Full text and rfc822 format available.

Message #14 received at 74920 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <basil <at> contovou.net>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 74920 <at> debbugs.gnu.org
Subject: Re: bug#74920: 31.0.50; 'should' defeats warning from
 set-advertised-calling-convention
Date: Thu, 13 Feb 2025 18:51:21 +0100
Basil L. Contovounesios [2025-02-02 19:27 +0100] wrote:

>   ;; -*- 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.

Fixed one instance of this in our test suite:

 Fix uncaught cl-nreconc on constant list
 b8c8ae92dba 2025-02-13 18:40:26 +0100
 https://git.sv.gnu.org/cgit/emacs.git/commit/?id=b8c8ae92dba

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74920; Package emacs. (Thu, 13 Feb 2025 18:07:02 GMT) Full text and rfc822 format available.

Message #17 received at 74920 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: "Basil L. Contovounesios" <basil <at> contovou.net>
Cc: 74920 <at> debbugs.gnu.org
Subject: Re: bug#74920: 31.0.50;
 'should' defeats warning from set-advertised-calling-convention
Date: Thu, 13 Feb 2025 10:06:40 -0800
"Basil L. Contovounesios" <basil <at> contovou.net> writes:

> Basil L. Contovounesios [2025-02-02 19:27 +0100] wrote:
>
>>   ;; -*- 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.
>
> Fixed one instance of this in our test suite:
>
>  Fix uncaught cl-nreconc on constant list
>  b8c8ae92dba 2025-02-13 18:40:26 +0100
>  https://git.sv.gnu.org/cgit/emacs.git/commit/?id=b8c8ae92dba

Thanks for looking into this, and for the above fix.




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.