GNU bug report logs -
#38206
26.1; cl-prettyexpand incorrectly expands pushing to structures
Previous Next
Reported by: Braun Gábor <braungb88 <at> gmail.com>
Date: Thu, 14 Nov 2019 08:21:02 UTC
Severity: normal
Tags: fixed
Found in version 26.1
Fixed in version 27.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Braun Gábor <braungb88 <at> gmail.com> writes:
> (let* ((v test-slot)
> (v (or (cl-block test-p
> (and (memq (type-of foo) cl-struct-test-tags) t))
> (signal 'wrong-type-argument (list 'test foo))))
> (v (aref foo 1)))
> (\(setf\ cl-block\) (cons 1 (cl-block v v v)) v v v))
>
> The form in the output is obviously an incorrect expansion of
> (push 1 (test-slot foo)).
Yup. However, if we give a FULL parameter to the function, it gives the
correct results:
(cl-prettyexpand '(push 1 (test-slot foo)) t)
=>
(progn
(or (and (memq (type-of foo) cl-struct-test-tags) t)
(signal 'wrong-type-argument (list 'test foo)))
(let* ((v foo))
(aset v 1 (cons 1 (aref v 1)))))
The definition is
(defun cl-prettyexpand (form &optional full)
"Expand macros in FORM and insert the pretty-printed result.
Optional argument FULL non-nil means to expand all macros,
including `cl-block' and `cl-eval-when'."
[...]
(setq form (macroexpand-all form
(and (not full) '((cl-block) (cl-eval-when)))))
The bug was introduced by a rewrite in 2012, I think, which changed the
implementation radically, which made it pass in that list as a totally
bogus ENVIRONMENT to macroexpand-all.
I think the right change here is to just deprecate the FULL parameter
and remove the
(and (not full) '((cl-block) (cl-eval-when)))))
bit. Stefan?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 5 years and 179 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.