]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Fix a bug
authorArtur Malabarba <bruce.connor.am@gmail.com>
Sat, 7 Nov 2015 11:25:31 +0000 (11:25 +0000)
committerArtur Malabarba <bruce.connor.am@gmail.com>
Sat, 7 Nov 2015 13:55:16 +0000 (13:55 +0000)
The defsubst was being created as:
    (cl-defsubst name (args) ("DOC") ...)

* test/automated/cl-lib-tests.el (cl-lib-struct-constructors): Add test

lisp/emacs-lisp/cl-macs.el
test/automated/cl-lib-tests.el

index c42094f0f0c5e52a90301205636863ad5563d014..80f0cd73ceed61769f205d40505727988df85c9d 100644 (file)
@@ -2730,7 +2730,7 @@ non-nil value, that slot cannot be set via `setf'.
                            slots defaults)))
        (push `(cl-defsubst ,cname
                    (&cl-defs (nil ,@descs) ,@args)
-                 ,(if (stringp doc) (list doc)
+                 ,(if (stringp doc) doc
                     (format "Constructor for objects of type `%s'." name))
                  ,@(if (cl--safe-expr-p `(progn ,@(mapcar #'cl-second descs)))
                        '((declare (side-effect-free t))))
index 1bdc6d7ca09b001d94f7e8cbef588295871c4dc1..b31622fdc339cd40c43b1af936b2bb3fdd25f6e4 100644 (file)
 
 (cl-defstruct (mystruct
                (:constructor cl-lib--con-1 (&aux (abc 1)))
-               (:constructor cl-lib--con-2 (&optional def)))
+               (:constructor cl-lib--con-2 (&optional def) "Constructor docstring."))
+  "General docstring."
   (abc 5 :readonly t) (def nil))
 (ert-deftest cl-lib-struct-accessors ()
   (let ((x (make-mystruct :abc 1 :def 2)))
               (`((cl-tag-slot) (abc 5 :readonly t)
                  (def . ,(or `nil `(nil))))
                t)))))
+(ert-deftest cl-lib-struct-constructors ()
+  (should (equal (documentation 'cl-lib--con-2 t)
+                 "Constructor docstring."))
+  (should (mystruct-p (cl-lib--con-1)))
+  (should (mystruct-p (cl-lib--con-2))))
 
 (ert-deftest cl-lib-arglist-performance ()
   ;; An `&aux' should not cause lambda's arglist to be turned into an &rest