clj-refactor.el
clj-refactor.el copied to clipboard
Inline-symbol fails when core.async rewrites the code
I guess the major rewrites of code that core.async does is a major hurdle for clj-refactor, quite possibly insurmountable. Here is an issue either way. Reproduce like this:
(ns example
(:require [clojure.core.async :refer [timeout go <!]]))
(go
(loop []
(<! (timeout 10))
(let [foos [1 2 3]]
(doseq [foo foos]
(prn foo)))))
Try to inline the foos
symbol, get let*: Wrong type argument: hash-table-p, nil
that may be fixed when find-macros
branch get merged into master of refactor-nrepl, not sure tho...
This is a bug in find-symbol
which cljr-inline-symbol
relies on. If you run find-usages
on the final foos
you'll get:
src/refactor_nrepl/test.clj:9: (doseq [foo foos]
src/refactor_nrepl/test.clj:9: (doseq [foo foos]
This bug will not be fixed in the find-macros
branch which is only concerned with finding macro definitions and usages and not the occurrences of regular symbols in the bodies of macros.
@benedekfazekas can you take a look at this? I don't understand why it doesn't find foos
. go
does some pretty nasty re-rewriting, but if you expand that macro there's obviously a let binding matching foos
in there and that should be found, right?