From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#68113: Wrong error message triggered in cl--generic-standard-method-combination Date: Sat, 30 Dec 2023 10:46:42 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30756"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68113@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 30 11:47:22 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rJWsE-0007s4-6E for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 30 Dec 2023 11:47:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rJWry-0002Aw-2m; Sat, 30 Dec 2023 05:47:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rJWru-0002AW-Jw for bug-gnu-emacs@gnu.org; Sat, 30 Dec 2023 05:47:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rJWru-0001W7-Bl for bug-gnu-emacs@gnu.org; Sat, 30 Dec 2023 05:47:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rJWru-0008PV-Pz for bug-gnu-emacs@gnu.org; Sat, 30 Dec 2023 05:47:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Dec 2023 10:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68113 X-GNU-PR-Package: emacs Original-Received: via spool by 68113-submit@debbugs.gnu.org id=B68113.170393321332286 (code B ref 68113); Sat, 30 Dec 2023 10:47:02 +0000 Original-Received: (at 68113) by debbugs.gnu.org; 30 Dec 2023 10:46:53 +0000 Original-Received: from localhost ([127.0.0.1]:43120 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rJWrl-0008Of-AT for submit@debbugs.gnu.org; Sat, 30 Dec 2023 05:46:53 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:27835) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rJWrj-0008OR-7f for 68113@debbugs.gnu.org; Sat, 30 Dec 2023 05:46:52 -0500 Original-Received: (qmail 4061 invoked by uid 3782); 30 Dec 2023 11:46:43 +0100 Original-Received: from acm.muc.de (p4fe1573b.dip0.t-ipconnect.de [79.225.87.59]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 30 Dec 2023 11:46:43 +0100 Original-Received: (qmail 5293 invoked by uid 1000); 30 Dec 2023 10:46:42 -0000 Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:277075 Archived-At: Hello, Stefan. Thanks for the quick reply yesterday. On Fri, Dec 29, 2023 at 12:24:36 -0500, Stefan Monnier wrote: > Hi Alan, > > In my development version of Emacs (based on the master branch) I get a > > backtrace with the error message being: > > Error: wrong-type-argument (symbolp mets-by-qual) > > This occurs during the execution of cl-generic-combine-methods, whose > > code starts: > > (defun cl--generic-standard-method-combination (generic methods) > > (let ((mets-by-qual ())) > > (dolist (method methods) > > (let ((qualifiers (cl-method-qualifiers method))) > > (if (eq (car qualifiers) :extra) (setq qualifiers (cddr qualifiers))) > > (unless (member qualifiers '(() (:after) (:before) (:around))) > > (error "Unsupported qualifiers in function %S: %S" > > (cl--generic-name generic) qualifiers)) > > (push method (alist-get (car qualifiers) mets-by-qual)))) > > It is the last line that is signalling the error. The pertinent line > > from the backtrace which is the expansion of that last line reads: > > (let* ((k (car qualifiers)) (p (assq k mets-by-qual)) (v (cons method (cdr p)))) (progn (if p (setcdr p v) (progn (signal 'wrong-type-argument (list 'symbolp 'mets-by-qual)))) v)) > > .. The error is, in actual fact, the failure to find an entry for (car > > qualifiers) in the alist mets-by-qual. The error message given is > > rubbish and more than a little misleading. mets-by-qual is clearly a > > symbol. > [ Side note: not finding an entry for (car qualifiers) in the above code > is perfectly normal (it's the most common case, even). The code only > finds such an entry when there are several applicable methods (and > they have the same set of qualifiers). ] > Hmm... the error occurs during macroexpansion, because the > macroexpansion of the `push` above should be (and is, normally): > ELISP> (macroexpand '(push method (alist-get (car qualifiers) mets-by-qual))) > (let* > ((k (car qualifiers)) (p (assq k mets-by-qual)) > (v (cons method (cdr p)))) > (progn > (if p (setcdr p v) > (setq mets-by-qual (cons (setq p (cons k v)) mets-by-qual))) > v)) This was a good hint, thanks. The most likely source of the (signal .....) form would seem to be the clause handling `setq' in macroexp--expand-all. I suspected it might be caused, somehow, by symbolp not recognising symbols with position as symbols. But I tightened up all the entry points, and disabled SWPs, and I still can't get the code in macroexp--expand-all to printf a message for mets-by-qual. > ELISP> > I don't know why you're not getting that expansion, and I don't know > either why you're getting that > (signal 'wrong-type-argument (list 'symbolp 'mets-by-qual)) I don't know, either. :-( As I say, I've tried instrumenting the `setq' handling code in macroexp--expand-all, but haven't managed to get anything pertinent output. > AFAICT this weird code is likely generated by `gv-delay-error` but > according to `grep` it's only used in `map-elt` so I can't see why it's > showing up here. > I'd start debugging this with something like `M-x trace-function RET > gv-get RET` and `M-x debug-on-entry RET gv-delay-error RET`. > [ Tho, presumably you're seeing this during the bootstrap, so you'll > probably want to add `message/debug` calls in the code instead. ] I am indeed seeing this in bootstrap, so it's message and a bit of prin1. > Stefan -- Alan Mackenzie (Nuremberg, Germany).