Take pointer, not word count, as upper limit in verify_space()
[sbcl.git] / tests / mop-22.impure-cload.lisp
blob53dd00df7b9a202378d61bb3010fca369f5ff377
1 ;;;; miscellaneous side-effectful tests of the MOP
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.
14 ;;; Forward-referenced classes as specializers.
16 (defpackage "MOP-22"
17 (:use "CL" "SB-MOP"))
19 (in-package "MOP-22")
21 ;;; It's generally unclear to me whether this should be allowed. On
22 ;;; the one hand, FORWARD-REFERENCED-CLASS is a subclass of CLASS and
23 ;;; hence of SPECIALIZER, and AMOP specifies that as-yet-undefined
24 ;;; superclasses of STANDARD-CLASSes are FORWARD-REFERENCED-CLASSes of
25 ;;; the appropriate proper name. On the other hand, ANSI specifies
26 ;;; that DEFCLASS defines _a_ class, and that classes should be
27 ;;; defined before they can be used as specializers in DEFMETHOD forms
28 ;;; (though ANSI also allows implementations to extend the object
29 ;;; system in this last respect). Future maintainers should feel free
30 ;;; to cause this test to fail if it improves the lot of some other
31 ;;; codepath. -- CSR, 2006-08-09
33 (defclass incomplete (forward) ())
35 (defgeneric incomplete/1 (x)
36 (:method ((x incomplete)) 'incomplete))
38 (defgeneric forward/1 (x)
39 (:method ((x forward)) 'forward))
41 ;;; with many arguments to avoid the precomputed discriminating
42 ;;; function generators
43 (defgeneric incomplete/7 (a b c d e f g)
44 (:method ((a incomplete) (b forward)
45 c (d integer) (e condition) (f class) g) t))
47 (defclass forward () ())
49 (assert (eq (incomplete/1 (make-instance 'incomplete)) 'incomplete))
50 (assert (eq (forward/1 (make-instance 'forward)) 'forward))
51 (assert (eq (incomplete/7 (make-instance 'incomplete)
52 (make-instance 'incomplete)
53 t 1 (make-condition 'error)
54 (find-class 'incomplete) 3)
55 t))