This seems to happen in class-readers-and-accessors during the for writers = ... portion of the code. When there is a writer defined with :writer in defclass, closer-mop:slot-definition-writers returns a single symbole, not a list.
(defun class-readers-and-accessors (class-name &key (ignore-symbol-p 'starts-with-percent-p))
(let* ((class (find-class class-name))
(slots (class-direct-slots class)))
(loop for slot in slots
for readers = (remove-if ignore-symbol-p
(slot-definition-readers slot))
for writers = (remove-if ignore-symbol-p
(mapcar #'second
(slot-definition-writers slot)))
append readers into all-readers
append writers into all-writers
finally (return (values (sort all-readers
#'string<)
(sort all-writers
#'string<))))))
steps to reproduce... load this code:
(ql:quickload :40ants-doc)
(ql:quickload :40ants-doc-full)
(ql:quickload :40ants-doc/autodoc)
(asdf:defsystem "foobar-manual"
:class :package-inferred-system
:components ((:file autodoc-test)))
(defpackage #:foobar-manual
(:use #:common-lisp
#:40ants-doc)
(:export foobar))
(in-package foobar-manual)
(defclass foobar ()
((slot1 :initarg :slot1
:accessor slot1)
(slot2 :initarg :slot2
:writer set-slot2)))
(defmethod slot1 ((f foobar))
"slot 1 getter"
(slot-value f 'slot1))
(defmethod (setf slot1) ((f foobar) obj)
"slot 1 setter"
(setf (slot-value f 'slot1) obj))
(defmethod set-slot2 ((f foobar) obj)
"slot 2 setter"
(setf (slot-value f 'slot2) obj))
(defun test-foobar ()
(let ((f (make-instance 'foobar :slot1 10 :slot2 20)))
(format t "~%slot1: ~S | slot2: ~S" (slot1 f) (slot-value f 'slot2))
(setf (slot1 f) 100)
(set-slot2 200 f)
(format t "~%slot1: ~S | slot2: ~S" (slot1 f) (slot-value f 'slot2))))
(40ants-doc/autodoc:defautodoc @foobar-docs-auto (:system :foobar-manual))
(40ants-doc-full/builder:render-to-files
@foobar-docs-auto
:format :html)
This seems to happen in
class-readers-and-accessorsduring thefor writers = ...portion of the code. When there is a writer defined with :writer in defclass, closer-mop:slot-definition-writers returns a single symbole, not a list.steps to reproduce... load this code: