diff --git a/src/promise.lisp b/src/promise.lisp index de65595..3f6b4f6 100644 --- a/src/promise.lisp +++ b/src/promise.lisp @@ -262,7 +262,12 @@ If `object' is a chain, call `fulfilledp' on the chained object. If `object' is not a promise and not a chain, return true." (declare #.*normal-optimize*) (typecase object - (promise-base (not (eq (result object) +no-result+))) + (promise-base (let ((result (result object))) + (if (eq result +no-result+) + nil + (typecase (first result) + (%chain (fulfilledp (chain-object (first result)))) + (otherwise t))))) (%chain (fulfilledp (chain-object object))) (otherwise t))) diff --git a/test/promise-test.lisp b/test/promise-test.lisp index 303bd4a..11701d5 100644 --- a/test/promise-test.lisp +++ b/test/promise-test.lisp @@ -75,7 +75,14 @@ (b (chain a))) (fulfill b 3) (is (eql 3 (force b))) - (is (eql 3 (force a))))) + (is (eql 3 (force a)))) + (let* ((a (promise)) + (b (promise))) + (fulfill b (chain a)) + (is (not (fulfilledp b))) + (fulfill a 17) + (is (fulfilledp a)) + (is (fulfilledp b)))) (full-test force-chain-test (let ((f (delay (chain (delay 3)))))