Fix make-array transforms.
[sbcl.git] / tests / mop-26.impure.lisp
1 ;;;; miscellaneous side-effectful tests of the MOP
2
3 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; more information.
5 ;;;;
6 ;;;; While most of SBCL is derived from the CMU CL system, the test
7 ;;;; files (like this one) were written from scratch after the fork
8 ;;;; from CMU CL.
9 ;;;;
10 ;;;; This software is in the public domain and is provided with
11 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
12 ;;;; more information.
13
14 ;;; This isn't really a test of the MOP per se.  PCL historically has
15 ;;; a CLASS-EQ specializer, which it uses internally to achieve
16 ;;; certain effects.  There's no particular reason that it should be
17 ;;; exposed to the user, except that some people have asked for it at
18 ;;; some point; however, there is also no particular reason that code
19 ;;; using it should be gratuitously broken, as it was for a while by
20 ;;; the SB-PCL::PARAMETER-SPECIALIZER-DECLARATION-IN-DEFMETHOD
21 ;;; function.  So it's fine if this test starts failing, as long as
22 ;;; it's deliberate.
23
24 (in-package "CL-USER")
25
26 (defclass super () ())
27 (defclass sub (super) ())
28
29 (defgeneric test (x))
30
31 (defmethod test ((x t)) nil)
32 (let ((spec (sb-pcl::class-eq-specializer (find-class 'super))))
33   (eval `(defmethod test ((x ,spec)) t)))
34
35 (assert (test (make-instance 'super)))
36 (assert (null (test (make-instance 'sub))))
37
38 (let ((spec (sb-pcl::class-eq-specializer (find-class 't))))
39   (eval `(defmethod test ((x ,spec)) (class-of x))))
40
41 (assert (test (make-instance 'super)))
42 (assert (null (test (make-instance 'sub))))