From: Philipp Stephani <p.stephani2@gmail.com>
To: 42672@debbugs.gnu.org
Subject: bug#42672: 28.0.50; cl-defgeneric with :method generates incorrect Edebug symbols
Date: Sun, 2 Aug 2020 13:40:50 +0200 [thread overview]
Message-ID: <CAArVCkRSHF-XKuqjb5ftjF3BBxkJNd6_V_s-1FbYJqdNZXaiAw@mail.gmail.com> (raw)
In-Reply-To: <wvr47duhxptm.fsf@gmail.com>
Am So., 2. Aug. 2020 um 13:15 Uhr schrieb Philipp Stephani
<p.stephani2@gmail.com>:
>
>
> Create a file /tmp/defmethod.el:
>
> $ cat /tmp/defmethod.el
> (cl-defgeneric foo (_)
> (:method ((_ number)) 1))
>
> Visit the file in Emacs:
>
> $ emacs -Q /tmp/defmethod.el
>
> Instrument the `cl-defgeneric' form using C-u C-M-x. The *Messages*
> buffer now contains
>
> Edebug: nil ((_ number))
> Edebug: foo
>
> The second line is for the generic function itself. The first line,
> however, is for the method defined by the `:method' form. But its name
> should be `foo ((_ number))', not `nil ((_ number))'. This becomes a
> problem if there are multiple such generic functions with different
> names but identical signatures, because Edebug will then generate
> duplicate symbols. This breaks e.g. coverage instrumentation because
> the instrumented frequencies will be attached to the wrong symbol.
>
> Implementation-wise, I guess this is a problem with
> `edebug-match-cl-generic-method-args'. That function contains the
> snippet
>
> ;; Append the arguments to edebug-def-name.
> (setq edebug-def-name
> (intern (format "%s %s" edebug-def-name args)))
>
> However, `edebug-def-name' is only non-nil when using `cl-defmethod',
> not when using `cl-defgeneric' with `:method'.
>
The code in edebug.el is somewhat obscure, but I think one piece of
the problem is that `edebug-make-form-wrapper' unconditionally binds
`edebug-def-name' to nil, so such Edebug specifications don't really
work the way they are intended to work. There's some commented-out
binding of `edebug-containing-def-name' in that function, indicating
that the function is incomplete/buggy, and the corrected
implementation was intended to cover this case (and similar cases with
nested definitions such as `cl-flet').
next prev parent reply other threads:[~2020-08-02 11:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-02 11:14 bug#42672: 28.0.50; cl-defgeneric with :method generates incorrect Edebug symbols Philipp Stephani
2020-08-02 11:40 ` Philipp Stephani [this message]
2020-08-02 20:01 ` Philipp Stephani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAArVCkRSHF-XKuqjb5ftjF3BBxkJNd6_V_s-1FbYJqdNZXaiAw@mail.gmail.com \
--to=p.stephani2@gmail.com \
--cc=42672@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.