Subject: bug#26068: closed (Re: bug#26068: [PATCH] bug in generator function with pcase)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 19 Mar 2017 19:19:02 +0000

Your bug report

#26068: [PATCH] bug in generator function with pcase

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
26068: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=26068
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#26068: [PATCH] bug in generator function with pcase
From: Mark Oteiza <[email-masked]>
To: Paul Pogonyshev <[email-masked]>
Cc: [email-masked]
Date: Sun, 19 Mar 2017 15:18:47 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Paul Pogonyshev <[email-masked]> writes:

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

Applied as 0d112c00.

Subject: [PATCH] bug in generator function with pcase
From: Paul Pogonyshev <[email-masked]>
To: [email-masked]
Date: Sun, 12 Mar 2017 09:51:23 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

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
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))