unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Pogonyshev <pogonyshev@gmail.com>
To: 26068@debbugs.gnu.org
Subject: bug#26068: [PATCH] bug in generator function with pcase
Date: Sun, 12 Mar 2017 09:51:23 +0100	[thread overview]
Message-ID: <CAG7BpaotL45JjnFAmk8XORJHxVDCvNzpEkMQWNgHtHSeA+nrMw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 398 bytes --]

To reproduce:

(iter-next (funcall (iter-lambda () (pcase (list 1 2)
                                      (`(,a ,b) (iter-yield (+ a b)))))))

Patch is attached. I have no idea if it affects something else, but
matching symbols with `eq' on their names (`eq' on strings?!) seems
outright wrong to me.

On a side note: bug report I sent yesterday with M-x report-emacs-bug
was silently lost.

Paul

[-- Attachment #2: cl-macs.diff --]
[-- Type: text/plain, Size: 1841 bytes --]

diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 40342f3fe4..58bcdd52ac 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -2059,8 +2059,8 @@ except that it additionally expands symbol macros."
           (pcase exp
             ((pred symbolp)
              ;; Perform symbol-macro expansion.
-             (when (cdr (assq (symbol-name exp) env))
-               (setq exp (cadr (assq (symbol-name exp) env)))))
+             (when (cdr (assq exp env))
+               (setq exp (cadr (assq exp env)))))
             (`(setq . ,_)
              ;; Convert setq to setf if required by symbol-macro expansion.
              (let* ((args (mapcar (lambda (f) (cl--sm-macroexpand f env))
@@ -2078,7 +2078,7 @@ except that it additionally expands symbol macros."
              (let ((letf nil) (found nil) (nbs ()))
                (dolist (binding bindings)
                  (let* ((var (if (symbolp binding) binding (car binding)))
-                        (sm (assq (symbol-name var) env)))
+                        (sm (assq var env)))
                    (push (if (not (cdr sm))
                              binding
                            (let ((nexp (cadr sm)))
@@ -2149,7 +2149,7 @@ by EXPANSION, and (setq NAME ...) will act like (setf EXPANSION ...).
             (let ((expansion
                    ;; FIXME: For N bindings, this will traverse `body' N times!
                    (macroexpand-all (macroexp-progn body)
-                                    (cons (list (symbol-name (caar bindings))
+                                    (cons (list (caar bindings)
                                                 (cl-cadar bindings))
                                           macroexpand-all-environment))))
               (if (or (null (cdar bindings)) (cl-cddar bindings))

             reply	other threads:[~2017-03-12  8:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-12  8:51 Paul Pogonyshev [this message]
2017-03-19 19:18 ` bug#26068: [PATCH] bug in generator function with pcase Mark Oteiza
2017-04-01 13:08 ` Tino Calancha
2017-04-01 13:44   ` Paul Pogonyshev
2017-04-01 16:12     ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAG7BpaotL45JjnFAmk8XORJHxVDCvNzpEkMQWNgHtHSeA+nrMw@mail.gmail.com \
    --to=pogonyshev@gmail.com \
    --cc=26068@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).