cloroutine icon indicating copy to clipboard operation
cloroutine copied to clipboard

[cljs] Warning when specter's setval is used in async

Open Wonko7 opened this issue 4 years ago • 2 comments

Hi!

When specter's setval is called within an async block the following warning appears:

------ WARNING #1 - :redef-in-file ---------------------------------------------
 File: /tmp/naked/src/naked/core.cljs:11:22
--------------------------------------------------------------------------------
   8 | (defn start []
   9 |   (async
  10 |     (let [user-info  {:hello {:thing "hihi"}}
  11 |           user-info2 (setval [:hello :thing] "haha" user-info)]
----------------------------^---------------------------------------------------
 pathcache26917 at line 11 is being replaced
--------------------------------------------------------------------------------
  12 |       (println user-info)
  13 |       (println user-info2))))
  14 |
--------------------------------------------------------------------------------

There are no warnings inside a go block, see master vs go branch: https://github.com/Wonko7/warning-specter-async

Wonko7 avatar Sep 03 '19 12:09 Wonko7

setval emits a def, then cr wraps it in a letfn, and this combination seems to confuse the compiler. I filed an issue with a minimal repro.

leonoel avatar Sep 13 '19 17:09 leonoel

Thanks!

Wonko7 avatar Sep 18 '19 09:09 Wonko7