After upgrading from core.async version 1.5.648 to v1.6.673 a test case suddenly triggers:
Unexpected error (NoSuchFieldError) macroexpanding async/go at (leads/message_bus_test.clj:63:7).
__thunk__0__
Full report at:
/tmp/clojure-7375904424694936670.edn
Tests failed.
I see the following in the core.async Changelog:
> Perf improvements in go macro compilation
But no notes about what to do for upgrading.
Anyone has an idea about why?I tried reading the "Full report" but I don't understand it 😢
And the full application works as expected
Test case looks like the following:
(deftest message-bus-loop
;; Start the message bus, as needed by the dispatch handler
(mount/start #'sut/message-bus)
(let [test-out (async/chan)]
(async/tap (:broadcast sut/message-bus) test-out)
(testing "Received request on in channel and response on broadcast channel"
(async/go (async/>! (:in sut/message-bus) {:event "ping"
:audit (audit/info)})) ; Line 63
(is (= {:event "pong"}
(async/<!! test-out))))
)
(mount/stop))Are you using lein?
This is probably an issue with aot compilation order as the ioc-macros namespace is now dynaloaded
Several other people have reported this
Adding clojure.core.async.impl.ioc-macros to the top of your aot compilation list will probably fix it if so
Yes, I am using lein
I didn't know I had an "aot compilation list"... but I'll look into it
did you run lein clean after you updated the library version?
yes
still failing
just making sure 🤷♂️
Try adding clojure.core.async.impl.ioc-macros as the first require in the namespace where the test fails?
hmm still fails... like this, right?:
(ns leads.message-bus-test
(:require [clojure.core.async.impl.ioc-macros]
[clojure.core.async :as async]
...Only setting :main in a Leining project.clj causes a warning:
> Warning: specified :main without including it in :aot.
> Implicit AOT of :main will be removed in Leiningen 3.0.0.
But including the main namespace in :aot as well, causes lein test to fail with:
Syntax error (NoSuchFieldError) compiling at ...
__thunk__0__
I've removed it from :aot for now, and "replaced it" with a comment about why.
Thanks for your help pplIt also fixed the issue when I also included core async ns as Alex suggested:
:aot [clojure.core.async.impl.ioc-macros my-ns]
But I'd rather leave as much of these settings to "default" instead of pretending to know what I am doing, overwriting stuff left and right.