]> gitweb.factorcode.org Git - factor.git/commitdiff
compiler.tree.propagation: ensure that we don't call 'equal?' or 'hashcode' on litera...
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sat, 16 Jan 2010 07:00:48 +0000 (20:00 +1300)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sat, 16 Jan 2010 07:00:48 +0000 (20:00 +1300)
basis/compiler/tree/propagation/info/info.factor
basis/compiler/tree/propagation/propagation-tests.factor

index 6dcf6f7317e2353d10a57bcb2e5f80240f9e8198..28ffb96f8fe83bb1452f7726438429737db17f8d 100644 (file)
@@ -312,16 +312,12 @@ SYMBOL: value-infos
     value-info >literal< ;
 
 : possible-boolean-values ( info -- values )
-    dup literal?>> [
-        literal>> 1array
-    ] [
-        class>> {
-            { [ dup null-class? ] [ { } ] }
-            { [ dup true-class? ] [ { t } ] }
-            { [ dup false-class? ] [ { f } ] }
-            [ { t f } ]
-        } cond nip
-    ] if ;
+    class>> {
+        { [ dup null-class? ] [ { } ] }
+        { [ dup true-class? ] [ { t } ] }
+        { [ dup false-class? ] [ { f } ] }
+        [ { t f } ]
+    } cond nip ;
 
 : node-value-info ( node value -- info )
     swap info>> at* [ drop null-info ] unless ;
index 2c80b87e76096ec0d79143946baaba672f9fc72a..ad17ccc1c95f32e373ea069a72514c30950d407e 100644 (file)
@@ -946,3 +946,9 @@ M: tuple-with-read-only-slot clone
 
 [ t ] [ [ { float float } declare max ] { max } inlined? ] unit-test
 [ f ] [ [ { float float } declare max ] { float-max } inlined? ] unit-test
+
+! Propagation should not call equal?, hashcode, etc on literals in user code
+[ V{ } ] [ [ 4 <reversed> [ 2drop ] with each ] final-info ] unit-test
+
+! Reduction
+[ 1 ] [ [ 4 <reversed> [ nth-unsafe ] [ ] unless ] final-info length ] unit-test