fix compile-time bug compiling (+ "foo" " bar")
authorAndy Wingo <wingo@pobox.com>
Sun, 6 Sep 2009 12:13:48 +0000 (14:13 +0200)
committerAndy Wingo <wingo@pobox.com>
Sun, 6 Sep 2009 12:15:45 +0000 (14:15 +0200)
* module/language/tree-il/primitives.scm (+, -): Avoid calling exact? on
  non-numeric args.

module/language/tree-il/primitives.scm

index 955c7bf..98633f0 100644 (file)
   (x) x
   (x y) (if (and (const? y)
                  (let ((y (const-exp y)))
-                   (and (exact? y) (= y 1))))
+                   (and (number? y) (exact? y) (= y 1))))
             (1+ x)
             (if (and (const? x)
                      (let ((x (const-exp x)))
-                       (and (exact? x) (= x 1))))
+                       (and (number? y) (exact? x) (= x 1))))
                 (1+ y)
                 (+ x y)))
   (x y z . rest) (+ x (+ y z . rest)))
   (x) (- 0 x)
   (x y) (if (and (const? y)
                  (let ((y (const-exp y)))
-                   (and (exact? y) (= y 1))))
+                   (and (number? y) (exact? y) (= y 1))))
             (1- x)
             (- x y))
   (x y z . rest) (- x (+ y z . rest)))