Commit 9c4e3097 authored by Philipp Stephani's avatar Philipp Stephani
Browse files

Check that variable lists are actually lists

'let' and 'let*' document that their first argument has to be a list,
but don't check for that; instead, they allow (and silently ignore)
other types.  Introduce an explicit type check.

* src/eval.c (Flet, FletX): Check that the variable list is indeed a
* test/src/eval-tests.el: Add unit tests.
parent 8c0fcaf6
......@@ -857,6 +857,7 @@ usage: (let* VARLIST BODY...) */)
lexenv = Vinternal_interpreter_environment;
varlist = XCAR (args);
CHECK_LIST (varlist);
while (CONSP (varlist))
......@@ -917,6 +918,7 @@ usage: (let VARLIST BODY...) */)
varlist = XCAR (args);
CHECK_LIST (varlist);
/* Make space to hold the values to give the bound variables. */
elt = Flength (varlist);
......@@ -47,4 +47,14 @@ Bug#24912 and Bug#24913."
(let ((byte-compile-debug t))
(should-error (eval `(byte-compile (lambda ,args)) t)))))
(dolist (form '(let let*))
(dolist (arg '(1 "a" [a]))
`(ert-deftest ,(intern (format "eval-tests--%s--%s" form (type-of arg))) ()
,(format "Check that the first argument of `%s' cannot be a %s"
form (type-of arg))
(should-error (,form ,arg) :type 'wrong-type-argument))
;;; eval-tests.el ends here
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment