From: Stefan Monnier Date: Thu, 16 May 2019 21:16:36 +0000 (-0400) Subject: * cl-macs-tests.el (cl-macs-test--symbol-macrolet): New test X-Git-Tag: emacs-27.0.90~2869 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9ed0b55848ce8a3049fd82e42cd9ea274410d426;p=emacs.git * cl-macs-tests.el (cl-macs-test--symbol-macrolet): New test --- diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index 989553bd7bd..09ce660a2fd 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el @@ -513,4 +513,21 @@ collection clause." (macroexpand '(cl-defstruct (hash-table (:predicate hash-table-p)))) :type 'wrong-type-argument)) +(ert-deftest cl-macs-test--symbol-macrolet () + ;; A `setq' shouldn't be converted to a `setf' just because it occurs within + ;; a symbol-macrolet! + (should-error + ;; Use `eval' so the error is signaled when running the test rather than + ;; when macroexpanding it. + (eval '(let ((l (list 1))) (cl-symbol-macrolet ((x 1)) (setq (car l) 0))))) + ;; Make sure `gv-synthetic-place' isn't macro-expanded before `setf' gets to + ;; see its `gv-expander'. + (should (equal (let ((l '(0))) + (let ((cl (car l))) + (cl-symbol-macrolet + ((p (gv-synthetic-place cl (lambda (v) `(setcar l ,v))))) + (cl-incf p))) + l) + '(1)))) + ;;; cl-macs-tests.el ends here