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

From: Stefan Monnier <[email-masked]>
Date: Sat, 01 Apr 2017 12:12:15 -0400

> +;; Bug #26068.  The problem is that `pcase' uses several `x' symbols,
> +;; which are not identical, but have the same name.
> +(ert-deftest cps-test-symbols-with-same-name ()
> +  (should (equal (iter-next (funcall (iter-lambda () (pcase (list 1 2)
> +                                                       (`(,a ,b) (iter-yield (+ a b)))))))
> +                 3)))

Right.  I guess the core if the issue would be reproduced with something like

    (defmacro cl-lib-symbol-macrolet-4+5 ()
      (let* ((sname "x")
             (s1 (make-symbol sname))
             (s2 (make-symbol sname)))
        `(cl-symbol-macrolet ((,s1 4)
                              (,s2 5))
           (+ ,s1 ,s2))))
    (ert-deftest cl-lib-symbol-macrolet-2 ()
      (should (equal (cl-lib-symbol-macrolet-4+5) (+ 4 5))))

Before your patch, the macro's code returned 10 rather than 9.

I installed this test in cl-lib-tests.el.

        Stefan