Update of /cvsroot/sbcl/sbcl/tests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16014/tests
Modified Files:
mop.impure.lisp
Log Message:
0.9.4.56:
Make VALIDATE-SUPERCLASS obey the rules.
... ah, but we need an additional constraint for CLOS classes
to behave: F-S-Cs must have FUNCTION in their CPL, while
S-Cs mustn't. Otherwise you end up with things which
are functions but whose type-of isn't subtypep
function, and similar disasters.
... document this additional constraint.
Index: mop.impure.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/tests/mop.impure.lisp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- mop.impure.lisp 26 Aug 2005 21:09:04 -0000 1.26
+++ mop.impure.lisp 9 Sep 2005 17:43:45 -0000 1.27
@@ -16,7 +16,7 @@
;;;; no regressions.
(defpackage "MOP-TEST"
- (:use "CL" "SB-MOP"))
+ (:use "CL" "SB-MOP" "ASSERTOID"))
(in-package "MOP-TEST")
@@ -429,4 +429,37 @@
(:metaclass custom-default-initargs-class))
(assert (eq (slot-value (make-instance 'extra-initarg) 'slot) 'extra))
+;;; STANDARD-CLASS valid as a superclass for FUNCALLABLE-STANDARD-CLASS
+(defclass standard-class-for-fsc ()
+ ((scforfsc-slot :initarg :scforfsc-slot :accessor scforfsc-slot)))
+(defvar *standard-class-for-fsc*
+ (make-instance 'standard-class-for-fsc :scforfsc-slot 1))
+(defclass fsc-with-standard-class-superclass
+ (standard-class-for-fsc funcallable-standard-object)
+ ((fsc-slot :initarg :fsc-slot :accessor fsc-slot))
+ (:metaclass funcallable-standard-class))
+(defvar *fsc/scs*
+ (make-instance 'fsc-with-standard-class-superclass
+ :scforfsc-slot 2
+ :fsc-slot 3))
+(assert (= (scforfsc-slot *standard-class-for-fsc*) 1))
+(assert (= (scforfsc-slot *fsc/scs*) 2))
+(assert (= (fsc-slot *fsc/scs*) 3))
+(assert (subtypep 'fsc-with-standard-class-superclass 'function))
+(assert (not (subtypep 'standard-class-for-fsc 'function)))
+
+;;; also check that our sanity check for functionness is good
+(assert (raises-error?
+ (progn
+ (defclass bad-standard-class (funcallable-standard-object)
+ ()
+ (:metaclass standard-class))
+ (make-instance 'bad-standard-class))))
+(assert (raises-error?
+ (progn
+ (defclass bad-funcallable-standard-class (standard-object)
+ ()
+ (:metaclass funcallable-standard-class))
+ (make-instance 'bad-funcallable-standard-class))))
+
;;;; success
|