diff options
| -rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 2 | ||||
| -rw-r--r-- | test/automated/cl-lib-tests.el | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index c42094f0f0c..80f0cd73cee 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el | |||
| @@ -2730,7 +2730,7 @@ non-nil value, that slot cannot be set via `setf'. | |||
| 2730 | slots defaults))) | 2730 | slots defaults))) |
| 2731 | (push `(cl-defsubst ,cname | 2731 | (push `(cl-defsubst ,cname |
| 2732 | (&cl-defs (nil ,@descs) ,@args) | 2732 | (&cl-defs (nil ,@descs) ,@args) |
| 2733 | ,(if (stringp doc) (list doc) | 2733 | ,(if (stringp doc) doc |
| 2734 | (format "Constructor for objects of type `%s'." name)) | 2734 | (format "Constructor for objects of type `%s'." name)) |
| 2735 | ,@(if (cl--safe-expr-p `(progn ,@(mapcar #'cl-second descs))) | 2735 | ,@(if (cl--safe-expr-p `(progn ,@(mapcar #'cl-second descs))) |
| 2736 | '((declare (side-effect-free t)))) | 2736 | '((declare (side-effect-free t)))) |
diff --git a/test/automated/cl-lib-tests.el b/test/automated/cl-lib-tests.el index 1bdc6d7ca09..b31622fdc33 100644 --- a/test/automated/cl-lib-tests.el +++ b/test/automated/cl-lib-tests.el | |||
| @@ -206,7 +206,8 @@ | |||
| 206 | 206 | ||
| 207 | (cl-defstruct (mystruct | 207 | (cl-defstruct (mystruct |
| 208 | (:constructor cl-lib--con-1 (&aux (abc 1))) | 208 | (:constructor cl-lib--con-1 (&aux (abc 1))) |
| 209 | (:constructor cl-lib--con-2 (&optional def))) | 209 | (:constructor cl-lib--con-2 (&optional def) "Constructor docstring.")) |
| 210 | "General docstring." | ||
| 210 | (abc 5 :readonly t) (def nil)) | 211 | (abc 5 :readonly t) (def nil)) |
| 211 | (ert-deftest cl-lib-struct-accessors () | 212 | (ert-deftest cl-lib-struct-accessors () |
| 212 | (let ((x (make-mystruct :abc 1 :def 2))) | 213 | (let ((x (make-mystruct :abc 1 :def 2))) |
| @@ -220,6 +221,11 @@ | |||
| 220 | (`((cl-tag-slot) (abc 5 :readonly t) | 221 | (`((cl-tag-slot) (abc 5 :readonly t) |
| 221 | (def . ,(or `nil `(nil)))) | 222 | (def . ,(or `nil `(nil)))) |
| 222 | t))))) | 223 | t))))) |
| 224 | (ert-deftest cl-lib-struct-constructors () | ||
| 225 | (should (equal (documentation 'cl-lib--con-2 t) | ||
| 226 | "Constructor docstring.")) | ||
| 227 | (should (mystruct-p (cl-lib--con-1))) | ||
| 228 | (should (mystruct-p (cl-lib--con-2)))) | ||
| 223 | 229 | ||
| 224 | (ert-deftest cl-lib-arglist-performance () | 230 | (ert-deftest cl-lib-arglist-performance () |
| 225 | ;; An `&aux' should not cause lambda's arglist to be turned into an &rest | 231 | ;; An `&aux' should not cause lambda's arglist to be turned into an &rest |