cherry
cherry copied to clipboard
Solve: Issue 57
I've got this from running the tests:
Testing cherry.compiler-test
FAIL in (return-test) (Error:NaN:NaN)
Uncaught exception, not in assertion.
expected: nil
actual: #object[Error Error: vector is not ISeqable]
FAIL in (let-test) (:47:7)
expected: (= 7 (jsv! (quote (let [{:keys [a b]} {:a 1, :b (+ 1 2 3)}] (+ a b)))))
actual: #object[Error Error: arrayMap is not ISeqable]
FAIL in (let-test) (:49:7)
expected: (= 8 (jsv! (quote (+ 1 (let [{:keys [a b]} {:a 1, :b (+ 1 2 3)}] (+ a b))))))
actual: #object[Error Error: arrayMap is not ISeqable]
FAIL in (let-shadow-test) (Error:NaN:NaN)
Uncaught exception, not in assertion.
expected: nil
actual: #object[Error Error: vector is not ISeqable]
FAIL in (destructure-test) (:78:9)
expected: (= 6 (js/eval s))
actual: #object[ReferenceError ReferenceError: __destructure_map is not defined]
FAIL in (fn-varargs-test) (:96:7)
expected: (= (quote (3 4)) (jsv! (quote (let [f (fn foo [x y & zs] zs)] (f 1 2 3 4)))))
actual: #object[Error Error: truth_ is not ISeqable]
FAIL in (fn-varargs-test) (:97:7)
expected: (nil? (jsv! (quote (let [f (fn foo [x y & zs] zs)] (f 1 2)))))
actual: #object[Error Error: truth_ is not ISeqable]
FAIL in (fn-multi-arity-test) (:100:7)
expected: (= 1 (jsv! (quote (let [f (fn foo ([x] x) ([x y] y))] (f 1)))))
actual: #object[ReferenceError ReferenceError: alength is not defined]
FAIL in (fn-multi-arity-test) (:101:7)
expected: (= 2 (jsv! (quote (let [f (fn foo ([x] x) ([x y] y))] (f 1 2)))))
actual: #object[ReferenceError ReferenceError: alength is not defined]
FAIL in (fn-multi-varargs-test) (:104:7)
expected: (= 1 (jsv! (quote (let [f (fn foo ([x] x) ([x y & zs] zs))] (f 1)))))
actual: #object[Error Error: truth_ is not ISeqable]
FAIL in (fn-multi-varargs-test) (:105:7)
expected: (= (quote (3 4)) (jsv! (quote (let [f (fn foo ([x] x) ([x y & zs] zs))] (f 1 2 3 4)))))
actual: #object[Error Error: truth_ is not ISeqable]
FAIL in (fn-multi-varargs-test) (:106:7)
expected: (nil? (jsv! (quote (let [f (fn foo ([x] x) ([x y & zs] zs))] (f 1 2)))))
actual: #object[Error Error: truth_ is not ISeqable]
FAIL in (defn-test) (Error:NaN:NaN)
Uncaught exception, not in assertion.
expected: nil
actual: #object[Error Error: arrayMap is not ISeqable]
FAIL in (defn-multi-arity-test) (:127:7)
expected: (= 1 (jsv! (quote (do (defn foo ([x] x) ([x y] y)) (foo 1)))))
actual: #object[ReferenceError ReferenceError: alength is not defined]
FAIL in (defn-multi-arity-test) (:130:7)
expected: (= 2 (jsv! (quote (do (defn foo ([x] 1) ([x y] y)) (foo 1 2)))))
actual: #object[ReferenceError ReferenceError: alength is not defined]
FAIL in (defn-recur-test) (Error:NaN:NaN)
Uncaught exception, not in assertion.
expected: nil
actual: #object[Error Error: truth_ is not ISeqable]
FAIL in (defn-varargs-test) (Error:NaN:NaN)
Uncaught exception, not in assertion.
expected: nil
actual: #object[Error Error: truth_ is not ISeqable]
FAIL in (defn-multi-varargs-test) (:147:7)
expected: (= [1 [1 2 (quote (3 4))]] (js/eval (jss! (quote (do (defn foo ([x] x) ([x y & args] [x y args])) [(foo 1) (foo 1 2 3 4)])))))
actual: #object[Error Error: truth_ is not ISeqable]
FAIL in (loop-test) (Error:NaN:NaN)
Uncaught exception, not in assertion.
expected: nil
actual: #object[Error Error: truth_ is not ISeqable]
FAIL in (if-test) (:165:7)
expected: (true? (jsv! "(if 0 true false)"))
actual: #object[Error Error: truth_ is not ISeqable]
FAIL in (if-test) (Error:NaN:NaN)
Uncaught exception, not in assertion.
expected: nil
actual: #object[Error Error: vector is not ISeqable]
FAIL in (doseq-test) (Error:NaN:NaN)
Uncaught exception, not in assertion.
expected: nil
actual: #object[Error Error: vector is not ISeqable]
FAIL in (for-test) (Error:NaN:NaN)
Uncaught exception, not in assertion.
expected: nil
actual: #object[Error Error: truth_ is not ISeqable]
FAIL in (regex-test) (:195:7)
expected: (= (quote ("foo" "foo")) (jsv! (quote (re-seq #"foo" "foo foo"))))
actual: #object[ReferenceError ReferenceError: re_seq is not defined]
FAIL in (new-test) (:199:7)
expected: (= "hello" (jsv! (quote (str (js/String. "hello")))))
actual: #object[ReferenceError ReferenceError: str is not defined]
FAIL in (quote-test) (:202:7)
expected: (= (quote {x 1}) (jsv! (list (quote quote) (quote {x 1}))))
actual: #object[Error Error: arrayMap is not ISeqable]
FAIL in (quote-test) (:203:7)
expected: (= (quote (def x 1)) (jsv! (list (quote quote) (quote (def x 1)))))
actual: #object[ReferenceError ReferenceError: list is not defined]
FAIL in (case-test) (Error:NaN:NaN)
Uncaught exception, not in assertion.
expected: nil
actual: #object[Error Error: truth_ is not ISeqable]
FAIL in (dot-test) (Error:NaN:NaN)
Uncaught exception, not in assertion.
expected: nil
actual: #object[Error Error: vector is not ISeqable]
FAIL in (backtick-test) (:246:7)
expected: (= (quote (assoc {} :foo :bar)) (jsv! "`(assoc {} :foo :bar)"))
actual: #object[ReferenceError ReferenceError: sequence is not defined]
FAIL in (munged-core-name-test) (:249:7)
expected: (jsv! (quote (boolean 1)))
actual: #object[ReferenceError ReferenceError: boolean$ is not defined]
FAIL in (defprotocol-extend-type-string-test) (:252:7)
expected: (= :foo (jsv! (quote (do (defprotocol IFoo (foo [_])) (extend-type string IFoo (foo [_] :foo)) (foo "bar")))))
actual: #object[Error Error: truth_ is not ISeqable]
FAIL in (deftype-test) (:255:7)
expected: (= 1 (jsv! (quote (do (deftype Foo [x]) (.-x (->Foo 1))))))
actual: #object[Error Error: vector is not ISeqable]
FAIL in (deftype-test) (:256:7)
expected: (= [:foo :bar] (jsv! (quote (do (defprotocol IFoo (foo [_]) (bar [_])) (deftype Foo [x] IFoo (foo [_] :foo) (bar [_] :bar)) (let [x (->Foo 1)] [(foo x) (bar x)])))))
actual: #object[Error Error: truth_ is not ISeqable]
FAIL in (deftype-test) (:263:7)
expected: (= [:foo 2] (jsv! (quote (do (defprotocol IFoo (foo [_]) (bar [_])) (deftype Foo [x] IFoo (foo [_] [:foo x]) (bar [_] :bar)) (def x (->Foo 1)) (set! (.-x x) 2) (foo x)))))
actual: #object[Error Error: truth_ is not ISeqable]
FAIL in (set-test) (:274:7)
expected: (= #{1 4 6 3 2 5} (jsv! (quote (into #{1 3 2} #{4 6 5}))))
actual: #object[Error Error: hash_set is not ISeqable]
I'm not sure where to start debugging or how to connect to a repl in this project. Could you enlighten me @borkdude ? I'm still getting used to the project setup and would like to just be able to navigate the code and eval stuff
Unfortunately a REPL doesn't work with the ES6 target of shadow-cljs, so the way you can debug this is sprinkle printlns etc and the run test expressions from the command line.
Meanwhile, I'm having thoughts of unifying the cherry and squint compiler code (perhaps cherry can depend on squint or vice versa or extract the code into a common project) so we don't have to port these commits. As I'm now working on the squint REPL, it becomes more and more annoying to have to port these commits so I think it's better go move into the unified direction.
Hey @borkdude, does this PR still make sense? Should I try to fix it?
Hi @tiagodalloca - thanks for the help. This PR is a bit stale, now that I'm in the process of unifying the compiler code between cherry and squint in the compiler-common repository.