X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fcompiler.pure.lisp;h=130a5af0f735075fa892447cb1ebb698853bc702;hb=3a8bfcb01abe4d8eeb9ef1343d623dbbf57c19d9;hp=608015926538f691a519fa98befb0f92864e840f;hpb=a7c2a16d0c2be6709becc962be1cb5e0aeda68c6;p=sbcl.git diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index 6080159..130a5af 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -292,3 +292,32 @@ (declare (optimize speed (safety 0))) (typecase a (array (loop (print (car a))))))))) + +;;; Bug reported by Robert E. Brown sbcl-devel 2003-02-02: compiler +;;; failure +(compile nil + '(lambda (key tree collect-path-p) + (let ((lessp (key-lessp tree)) + (equalp (key-equalp tree))) + (declare (type (function (t t) boolean) lessp equalp)) + (let ((path '(nil))) + (loop for node = (root-node tree) + then (if (funcall lessp key (node-key node)) + (left-child node) + (right-child node)) + when (null node) + do (return (values nil nil nil)) + do (when collect-path-p + (push node path)) + (when (funcall equalp key (node-key node)) + (return (values node path t)))))))) + +;;; CONSTANTLY should return a side-effect-free function (bug caught +;;; by Paul Dietz' test suite) +(let ((i 0)) + (let ((fn (constantly (progn (incf i) 1)))) + (assert (= i 1)) + (assert (= (funcall fn) 1)) + (assert (= i 1)) + (assert (= (funcall fn) 1)) + (assert (= i 1))))