From 4217b453466d3f3f3a91f2bff02fc2bd62d160b1 Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Fri, 15 Apr 2005 21:28:50 +0000 Subject: [PATCH] 0.8.21.44: Fix bug reported by Cyrus Harmon sbcl-devel 2005-04-14 ... remove AVER CLASS and AVER BUILT-IN-TYPE, because those can be tickled by wrong but well-intentioned user code. --- src/pcl/boot.lisp | 12 +++++++----- tests/clos.impure.lisp | 9 +++++++++ version.lisp-expr | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/pcl/boot.lisp b/src/pcl/boot.lisp index 638f6a9..b277f87 100644 --- a/src/pcl/boot.lisp +++ b/src/pcl/boot.lisp @@ -616,12 +616,14 @@ bootstrapping. (ecase kind ((:primitive) `(type ,specializer ,parameter)) ((:defined) - ;; some BUILT-IN-CLASSes (e.g. REAL) are also :DEFINED - ;; types. Nothing else should be. (let ((class (find-class specializer nil))) - (aver class) - (aver (typep class 'built-in-class))) - `(type ,specializer ,parameter)) + ;; CLASS can be null here if the user has erroneously + ;; tried to use a defined type as a specializer; it + ;; can be a non-BUILT-IN-CLASS if the user defines a + ;; type and calls (SETF FIND-CLASS) in a consistent + ;; way. + (when (and class (typep class 'built-in-class)) + `(type ,specializer ,parameter)))) ((:instance nil) (let ((class (find-class specializer nil))) (cond diff --git a/tests/clos.impure.lisp b/tests/clos.impure.lisp index 731cfdf..b4393ca 100644 --- a/tests/clos.impure.lisp +++ b/tests/clos.impure.lisp @@ -911,5 +911,14 @@ (load "package-ctor-bug.lisp") (assert (= (package-ctor-bug:test) 3)) +(deftype defined-type () 'integer) +(assert (raises-error? + (defmethod method-on-defined-type ((x defined-type)) x))) +(deftype defined-type-and-class () 'integer) +(setf (find-class 'defined-type-and-class) (find-class 'integer)) +(defmethod method-on-defined-type-and-class ((x defined-type-and-class)) + (1+ x)) +(assert (= (method-on-defined-type-and-class 3) 4)) + ;;;; success (sb-ext:quit :unix-status 104) diff --git a/version.lisp-expr b/version.lisp-expr index af26ab4..e081594 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.8.21.43" +"0.8.21.44" -- 1.7.10.4