From d3c56c291d4d4eff8c3ec234d5ed904fe5b55df4 Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Thu, 9 Oct 2003 15:47:16 +0000 Subject: [PATCH] 0.8.4.14: Fix suboptimality reported by piso on #lisp ... catch bogus types like (fixnum 10) before they get too far in the type system ... doesn't work for logically-built-in-but-made-by-PCL types (yet) Comment out newly-broken assertion that constant multiplies don't produce compiler-notes ... if that's all that broke, count your lucky stars :-) --- NEWS | 3 +++ src/code/early-type.lisp | 7 ++++--- tests/arith.pure.lisp | 6 +++++- tests/type.impure.lisp | 10 ++++++++++ version.lisp-expr | 2 +- 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index d57ed10..eea0087 100644 --- a/NEWS +++ b/NEWS @@ -2119,6 +2119,9 @@ changes in sbcl-0.8.5 relative to sbcl-0.8.4: #lisp) * fixed bug 141b: printing backquoted information readably and prettily inserts a space where necessary. + * bug fix: obviously wrong type specifiers such as (FIXNUM 1) or + (CHARACTER 10) are now reported as errors, rather than propagated + as unknown types. (reported by piso on #lisp) * compiler enhancement: SIGNUM is now better able to derive the type of its result. * fixed some bugs revealed by Paul Dietz' test suite: diff --git a/src/code/early-type.lisp b/src/code/early-type.lisp index 6679a42..56aac8c 100644 --- a/src/code/early-type.lisp +++ b/src/code/early-type.lisp @@ -499,8 +499,9 @@ (fun (info :type :translator (car lspec)))) (cond (fun (funcall fun lspec)) - ((or (and (consp spec) (symbolp (car spec))) - (symbolp spec)) + ((or (and (consp spec) (symbolp (car spec)) + (not (info :type :builtin (car spec)))) + (and (symbolp spec) (not (info :type :builtin spec)))) (when (and *type-system-initialized* (not (eq (info :type :kind spec) :forthcoming-defclass-type))) @@ -534,7 +535,7 @@ (let ((def (cond ((symbolp form) (info :type :expander form)) ((and (consp form) (symbolp (car form))) - (info :type :expander (car form))) + (info :type :expander (car form))) (t nil)))) (if def (type-expand (funcall def (if (consp form) form (list form)))) diff --git a/tests/arith.pure.lisp b/tests/arith.pure.lisp index 959e2c1..624abd3 100644 --- a/tests/arith.pure.lisp +++ b/tests/arith.pure.lisp @@ -106,7 +106,11 @@ (let* ((x (random most-positive-fixnum)) (x2 (* x 2)) (x3 (* x 3))) - (let ((fn (handler-bind ((sb-ext:compiler-note #'error)) + (let ((fn (handler-bind (;; broken by rearrangement of + ;; multiplication strength reduction in + ;; sbcl-0.8.4.12 + #+nil + (sb-ext:compiler-note #'error)) (compile nil `(lambda (y) (declare (optimize speed) (type (integer 0 3) y)) diff --git a/tests/type.impure.lisp b/tests/type.impure.lisp index 38cee27..02ee7f7 100644 --- a/tests/type.impure.lisp +++ b/tests/type.impure.lisp @@ -109,6 +109,16 @@ (assert (raises-error? (typep 11 'eql))) (assert (raises-error? (typep 11 'satisfies))) (assert (raises-error? (typep 11 'not))) +;;; and while it doesn't specifically disallow illegal compound +;;; specifiers from the CL package, we don't have any. +(assert (raises-error? (subtypep 'fixnum '(fixnum 1)))) +(assert (raises-error? (subtypep 'class '(list)))) +(assert (raises-error? (subtypep 'foo '(ratio 1/2 3/2)))) +(assert (raises-error? (subtypep 'character '(character 10)))) +#+nil ; doesn't yet work on PCL-derived internal types +(assert (raises-error? (subtypep 'lisp '(class)))) +#+nil +(assert (raises-error? (subtypep 'bar '(method number number)))) ;;; Of course empty lists of subtypes are still OK. (assert (typep 11 '(and))) diff --git a/version.lisp-expr b/version.lisp-expr index 9f02057..9885cbd 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.4.13" +"0.8.4.14" -- 1.7.10.4