1.0.1.35: propagate (EQL X Y) constraints symmetrically
authorGabor Melis <mega@hotpop.com>
Tue, 23 Jan 2007 16:04:53 +0000 (16:04 +0000)
committerGabor Melis <mega@hotpop.com>
Tue, 23 Jan 2007 16:04:53 +0000 (16:04 +0000)
  After an (EQL X Y) test both X and Y shall inherit the constraints
  of the other. Thanks to jsnell for spotting this.

src/compiler/constraint.lisp
tests/compiler.pure.lisp
version.lisp-expr

index 3bc7362..9f1e1f0 100644 (file)
       (do-eql-vars (var2 (var2 constraints))
         (inherit-constraints var1 var2 constraints target))
       (do-eql-vars (var1 (var1 constraints))
-        (inherit-constraints var1 var2 constraints target))
+        (inherit-constraints var2 var1 constraints target))
       t)))
 
 ;; Add an (EQL LAMBDA-VAR LAMBDA-VAR) constraint on VAR and LVAR's
index 7db4d3a..7952ae1 100644 (file)
       (compiler-note () (throw :note nil)))
     (error "Unreachable code undetected.")))
 
+(with-test (:name (:compiler :constraint-propagation :var-eql-to-var-1))
+  (catch :note
+    (handler-case
+        (compile nil '(lambda (x y)
+                        (when (typep y 'fixnum)
+                          (when (eql x y)
+                            (unless (typep x 'fixnum)
+                              (error "This is unreachable"))
+                            (setq y nil)))))
+      (compiler-note () (throw :note nil)))
+    (error "Unreachable code undetected.")))
+
+(with-test (:name (:compiler :constraint-propagation :var-eql-to-var-2))
+  (catch :note
+    (handler-case
+        (compile nil '(lambda (x y)
+                        (when (typep y 'fixnum)
+                          (when (eql y x)
+                            (unless (typep x 'fixnum)
+                              (error "This is unreachable"))
+                            (setq y nil)))))
+      (compiler-note () (throw :note nil)))
+    (error "Unreachable code undetected.")))
+
 ;; Reported by John Wiseman, sbcl-devel
 ;; Subject: [Sbcl-devel] float type derivation bug?
 ;; Date: Tue, 4 Apr 2006 15:28:15 -0700
index 23c8902..6b82152 100644 (file)
@@ -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".)
-"1.0.1.34"
+"1.0.1.35"