From 46c2f716d2ea2290951a30a39c7356ca51d247f1 Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Sun, 29 Jan 2006 22:15:26 +0000 Subject: [PATCH] 0.9.9.10: Fix a bug in ctor optimization reported by kpreid on #lisp ... quote the ctor-initarg keys in the fallback (unoptimized) constructor too. --- NEWS | 4 ++++ src/pcl/ctor.lisp | 3 ++- tests/clos.impure.lisp | 13 +++++++++++++ version.lisp-expr | 2 +- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 9b03a4f..920fd6d 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,10 @@ changes in sbcl-0.9.10 relative to sbcl-0.9.9: * fixed bug: DOCUMENTATION on structures no longer signals an error if no structure type of the right name exists. (reported by Glenn Ehrlich) + * fixed bug: compiled calls to MAKE-INSTANCE where there is an + applicable non-standard primary or :AROUND method on + INITIALIZE-INSTANCE or SHARED-INITIALIZE and a non-keyword initarg + no longer cause unbound variable errors. (reported by Kevin Reid) changes in sbcl-0.9.9 relative to sbcl-0.9.8: * new platform: experimental support for the Windows operating diff --git a/src/pcl/ctor.lisp b/src/pcl/ctor.lisp index 9ae7add..68ab005 100644 --- a/src/pcl/ctor.lisp +++ b/src/pcl/ctor.lisp @@ -351,7 +351,8 @@ ;; calling it with a class, as here, we inhibit the optimization, ;; so removing the possibility of endless recursion. -- CSR, ;; 2004-07-12 - (make-instance ,(ctor-class ctor) ,@(ctor-initargs ctor)))) + (make-instance ,(ctor-class ctor) + ,@(quote-plist-keys (ctor-initargs ctor))))) (defun optimizing-generator (ctor ii-methods si-methods) (multiple-value-bind (locations names body before-method-p) diff --git a/tests/clos.impure.lisp b/tests/clos.impure.lisp index 100407d..19c9102 100644 --- a/tests/clos.impure.lisp +++ b/tests/clos.impure.lisp @@ -1231,4 +1231,17 @@ (let ((instance (make-instance 'slot-type-subclass))) (setf (slot-value instance 'slot) 3)) +;;; ctors where there's a non-standard SHARED-INITIALIZE method and an +;;; initarg which isn't self-evaluating (kpreid on #lisp 2006-01-29) +(defclass kpreid-enode () + ((slot :initarg not-a-keyword))) +(defmethod shared-initialize ((o kpreid-enode) slots &key &allow-other-keys) + (call-next-method)) +(defun make-kpreid-enode () + (make-instance 'kpreid-enode 'not-a-keyword 3)) +(with-test (:name (:ctor :non-keyword-initarg)) + (let ((x (make-kpreid-enode)) + (y (make-kpreid-enode))) + (= (slot-value x 'slot) (slot-value y 'slot)))) + ;;;; success diff --git a/version.lisp-expr b/version.lisp-expr index 3c0c9de..f703cd9 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.9.9.9" +"0.9.9.10" -- 1.7.10.4