unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#26068: [PATCH] bug in generator function with pcase
@ 2017-03-12  8:51 Paul Pogonyshev
  2017-03-19 19:18 ` Mark Oteiza
  2017-04-01 13:08 ` Tino Calancha
  0 siblings, 2 replies; 5+ messages in thread
From: Paul Pogonyshev @ 2017-03-12  8:51 UTC (permalink / raw)
  To: 26068

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-04-01 16:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-12  8:51 bug#26068: [PATCH] bug in generator function with pcase Paul Pogonyshev
2017-03-19 19:18 ` Mark Oteiza
2017-04-01 13:08 ` Tino Calancha
2017-04-01 13:44   ` Paul Pogonyshev
2017-04-01 16:12     ` Stefan Monnier

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