X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fclos.impure.lisp;fp=tests%2Fclos.impure.lisp;h=0838bd662ad3a0d5217ac9b27cef1be4acada9e0;hb=6c296da561efd25c22e051a1e55080d9689f3ecc;hp=11c6323f4c1ea306c7d8917fe22913b1593233b5;hpb=b08c57465f30c0d1632a5ad47a247453698c3bcc;p=sbcl.git diff --git a/tests/clos.impure.lisp b/tests/clos.impure.lisp index 11c6323..0838bd6 100644 --- a/tests/clos.impure.lisp +++ b/tests/clos.impure.lisp @@ -2032,4 +2032,38 @@ (assert (eql (slot-value (make-1099708c-list-1) 'slot-1099708c-list) (slot-value (make-1099708c-list-2) 'slot-1099708c-list)))) +;;; bug-1179858 + +;;; Define a class and force the "fallback" constructor generator to be +;;; used by having a HAIRY-AROUND-OR-NONSTANDARD-PRIMARY-METHOD-P on +;;; SHARED-INITIALIZE. +(defclass bug-1179858 () + ((foo :initarg :foo :reader bug-1179858-foo)) + (:default-initargs :foo (error "Should not be evaluated"))) +(defmethod shared-initialize :around ((instance bug-1179858) (slot-names t) &key) + (call-next-method)) + +(with-test (:name (make-instance :fallback-generator-initarg-handling + :bug-1179858)) + ;; Now compile a lambda containing MAKE-INSTANCE to exercise the + ;; fallback constructor generator. Call the resulting compiled + ;; function to trigger the bug. + (funcall (compile nil '(lambda () (make-instance 'bug-1179858 :foo t))))) + +;;; Other brokenness, found while investigating: fallback-generator +;;; handling of non-keyword initialization arguments +(defclass bug-1179858b () + ((foo :initarg foo :reader bug-1179858b-foo)) + (:default-initargs foo 14)) +(defmethod shared-initialize :around ((instance bug-1179858b) (slot-names t) &key) + (call-next-method)) + +(with-test (:name (make-instance :fallback-generator-non-keyword-initarg + :bug-1179858)) + (flet ((foo= (n i) (= (bug-1179858b-foo i) n))) + (assert + (foo= 14 (funcall (compile nil '(lambda () (make-instance 'bug-1179858b)))))) + (assert + (foo= 15 (funcall (compile nil '(lambda () (make-instance 'bug-1179858b 'foo 15)))))))) + ;;;; success