make sure LVAR-EXTERNALLY-CHECKABLE-TYPE always returns a type
authorNikodemus Siivola <nikodemus@sb-studio.net>
Wed, 27 Jul 2011 12:46:06 +0000 (15:46 +0300)
committerNikodemus Siivola <nikodemus@sb-studio.net>
Wed, 27 Jul 2011 13:21:52 +0000 (16:21 +0300)
  Fixes bug reported by Eric Marsden on sbcl-devel.

NEWS
src/compiler/ir1opt.lisp
tests/compiler.pure.lisp

diff --git a/NEWS b/NEWS
index 13d8c9d..2d22de9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ changes relative to sbcl-1.0.50:
     instructions. (lp#814688)
   * bug fix: COERCE to unfinalized extended sequence classes now works.
     (reported by Jan Moringen; lp#815155)
+  * bug fix: a compiler error during typecheck generation, reported by Eric
+    Marsden.
 
 changes in sbcl-1.0.50 relative to sbcl-1.0.49:
   * enhancement: errors from FD handlers now provide a restart to remove
index 59b6bfd..5c4a4ae 100644 (file)
                                 it (coerce-to-values type)))
                               (t (coerce-to-values type)))))
                dest)))))
-  (lvar-%externally-checkable-type lvar))
+  (or (lvar-%externally-checkable-type lvar) *wild-type*))
 #!-sb-fluid(declaim (inline flush-lvar-externally-checkable-type))
 (defun flush-lvar-externally-checkable-type (lvar)
   (declare (type lvar lvar))
index a9ad0d8..d88203e 100644 (file)
                              (= #C(2d0 3d0) (the (complex double-float) x))))))
     (assert (funcall foo #C(2d0 3d0)))
     (assert (not (funcall foo #C(1d0 2d0))))))
+
+(with-test (:name :lvar-externally-checkable-type-nil)
+  ;; Used to signal a BUG during compilation.
+  (let ((fun (compile nil `(lambda (a) (parse-integer "12321321" (the (member :start) a) 1)))))
+    (multiple-value-bind (i p) (funcall fun :start)
+      (assert (= 2321321 i))
+      (assert (= 8 p)))
+    (multiple-value-bind (i e) (ignore-errors (funcall fun :end))
+      (assert (not i))
+      (assert (typep e 'type-error)))))