From f3b213e5fea9992b3a9a1f2a6c482239a1aff3c1 Mon Sep 17 00:00:00 2001 From: William Harold Newman Date: Wed, 30 Oct 2002 16:30:31 +0000 Subject: [PATCH] 0.7.9.19: fixed new type inference bug as per CSR's hint on IRC --- BUGS | 11 ----------- src/code/late-type.lisp | 6 ++---- tests/compiler.impure.lisp | 8 +++++++- tests/type.pure.lisp | 5 +++++ version.lisp-expr | 2 +- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/BUGS b/BUGS index 1a3138c..937549c 100644 --- a/BUGS +++ b/BUGS @@ -1305,17 +1305,6 @@ WORKAROUND: arguments, but it could be tricky to check result types of PROG1, IF etc. -221: - Sometime between sbcl-0.7.8.51 and sbcl-0.7.9.5 the system lost the - ability to compile - (declaim (ftype (function (fixnum) (values package boolean)) f1)) - (declaim (ftype (function (t) (values package boolean)) f2)) - (defun ow (b x) - (funcall (if b #'f1 #'f2) x)) - Now the compiler dies with - SUBTYPEP is illegal on this type: (VALUES PACKAGE (MEMBER T NIL)) - apparently when attempting to infer the type of the IF expression. - DEFUNCT CATEGORIES OF BUGS IR1-#: diff --git a/src/code/late-type.lisp b/src/code/late-type.lisp index 70ccba2..f3f7f0d 100644 --- a/src/code/late-type.lisp +++ b/src/code/late-type.lisp @@ -213,8 +213,6 @@ (type-specifier (fun-type-returns type))))) -;;; Since all function types are equivalent to FUNCTION, they are all -;;; subtypes of each other. (!define-type-method (function :simple-subtypep) (type1 type2) (flet ((fun-type-simple-p (type) (not (or (fun-type-rest type) @@ -237,8 +235,8 @@ (if (and val1 val2) (values t t) (values nil (or win1 win2)))))))) - (3and (csubtypep (fun-type-returns type1) - (fun-type-returns type2)) + (3and (values-subtypep (fun-type-returns type1) + (fun-type-returns type2)) (cond ((fun-type-wild-args type2) (values t t)) ((fun-type-wild-args type1) diff --git a/tests/compiler.impure.lisp b/tests/compiler.impure.lisp index f128f15..c583b22 100644 --- a/tests/compiler.impure.lisp +++ b/tests/compiler.impure.lisp @@ -564,9 +564,15 @@ BUG 48c, not yet fixed: (etypecase x (character (write-char x s)) (integer (write-byte x s))))) - (bug217-1 #\1 *standard-output*) + +;;; bug 221: tried and died on CSUBTYPEP (not VALUES-SUBTYPEP) of the +;;; function return types when inferring the type of the IF expression +(declaim (ftype (function (fixnum) (values package boolean)) bug221f1)) +(declaim (ftype (function (t) (values package boolean)) bug221f2)) +(defun bug221 (b x) + (funcall (if b #'bug221f1 #'bug221f2) x)) ;;;; tests not in the problem domain, but of the consistency of the ;;;; compiler machinery itself diff --git a/tests/type.pure.lisp b/tests/type.pure.lisp index 920a910..fcda6d6 100644 --- a/tests/type.pure.lisp +++ b/tests/type.pure.lisp @@ -156,3 +156,8 @@ (format t "~&~S~%" type) (assert (not (sb-kernel:unknown-type-p (sb-kernel:specifier-type type)))) (assert (atom (sb-kernel:type-specifier (sb-kernel:specifier-type type)))))) + +;;; a bug underlying the reported bug #221: The SB-KERNEL type code +;;; signalled an error on this expression. +(subtypep '(function (fixnum) (values package boolean)) + '(function (t) (values package boolean))) diff --git a/version.lisp-expr b/version.lisp-expr index 4c8916b..5d32582 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -18,4 +18,4 @@ ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.7.9.18" +"0.7.9.19" -- 1.7.10.4