From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#68113: Wrong error message triggered in cl--generic-standard-method-combination Date: Fri, 29 Dec 2023 12:24:36 -0500 Message-ID: References: Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30713"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 68113@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 29 18:25:24 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 1rJGbr-0007mN-OJ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 29 Dec 2023 18:25:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rJGbb-00082S-PS; Fri, 29 Dec 2023 12:25:07 -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 1rJGbW-00082C-Ke for bug-gnu-emacs@gnu.org; Fri, 29 Dec 2023 12:25:03 -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 1rJGbW-0006Ke-94 for bug-gnu-emacs@gnu.org; Fri, 29 Dec 2023 12:25:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rJGbV-0000jO-Px for bug-gnu-emacs@gnu.org; Fri, 29 Dec 2023 12:25:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Dec 2023 17:25:01 +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.17038706872779 (code B ref 68113); Fri, 29 Dec 2023 17:25:01 +0000 Original-Received: (at 68113) by debbugs.gnu.org; 29 Dec 2023 17:24:47 +0000 Original-Received: from localhost ([127.0.0.1]:42189 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rJGbG-0000ij-RS for submit@debbugs.gnu.org; Fri, 29 Dec 2023 12:24:47 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:30867) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rJGbE-0000iV-GO for 68113@debbugs.gnu.org; Fri, 29 Dec 2023 12:24:45 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id A4A8C1000EF; Fri, 29 Dec 2023 12:24:38 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1703870677; bh=0eLAiwwOUPCv4UIrE3+zMySQVLGQI34orHkDCqLNwV8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=NWmFVUV/odHe/kmlAcoxQ01MvT9wfTDk2jlXTQJwCChmzIguhcyDoSBUYQAGQ9cni dBPiEpf5CDs1G7URJNKS3xmt8AurLsZY9iZpeKuLWFNkERfBcZk8Z2cy3NdZtT6oGZ e2e9Ib9eku+uUuT+7ok+d6jVH/CGPIgHld4pou00kk7Wzv+nLpmev6f5hWNRp4jg+P fkeHJKxRKD6gXh7VhphPe2ROyuvO8HOB2tEVdmFcln8p5hcQS5dYo/xAKUUPf9+OOy Sq95HrIxiHuUwJxqJ6ZRu+od3+l0j4GRPLB3jKMvFLd5RNiUIAv+aa/bZo1N/Uxpnd jPPpYzQr19qeA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id A18B1100054; Fri, 29 Dec 2023 12:24:37 -0500 (EST) Original-Received: from alfajor (unknown [23.233.149.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 81AAC121155; Fri, 29 Dec 2023 12:24:37 -0500 (EST) In-Reply-To: (Alan Mackenzie's message of "Fri, 29 Dec 2023 16:50:17 +0000") 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:277028 Archived-At: 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)) 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)) 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. ] Stefan