clj-commons / kibit

There's a function for that!
1.76k stars 135 forks source link

Kibit fails with an exception #213

Open achikin opened 6 years ago

achikin commented 6 years ago

Only happens in lein kibit --replace --interactive mode. lein-kibit "0.1.5" I've scrampled keyword name and file path a bit.

~ (kibit-cleanup) → lein kibit --replace --interactive
Would you like to replace
  (fn [db] (:some-fancy-keyword db))
 with
  :some-fancy-keyword
in /some/path/somefile.cljs:130? [yes/no] y
Exception in thread "main" java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to clojure.lang.IObj, compiling:(/private/var/folders/mn/0f7zlp491dqcs8kd61wsddd00000gn/T/form-init8942110484698608728.clj:1:125)
    at clojure.lang.Compiler.load(Compiler.java:7391)
    at clojure.lang.Compiler.loadFile(Compiler.java:7317)
    at clojure.main$load_script.invokeStatic(main.clj:275)
    at clojure.main$init_opt.invokeStatic(main.clj:277)
    at clojure.main$init_opt.invoke(main.clj:277)
    at clojure.main$initialize.invokeStatic(main.clj:308)
    at clojure.main$null_opt.invokeStatic(main.clj:342)
    at clojure.main$null_opt.invoke(main.clj:339)
    at clojure.main$main.invokeStatic(main.clj:421)
    at clojure.main$main.doInvoke(main.clj:384)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:383)
    at clojure.lang.AFn.applyToHelper(AFn.java:156)
    at clojure.lang.Var.applyTo(Var.java:700)
    at clojure.main.main(main.java:37)
Caused by: java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to clojure.lang.IObj
    at clojure.core$with_meta__4375.invokeStatic(core.clj:217)
    at clojure.core$vary_meta.invokeStatic(core.clj:656)
    at clojure.core$vary_meta.doInvoke(core.clj:656)
    at clojure.lang.RestFn.invoke(RestFn.java:425)
    at kibit.replace$replace_zipper_STAR_$_replace_zipper__6376.invoke(replace.clj:74)
    at clojure.lang.AFn.applyToHelper(AFn.java:154)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.core$apply.invokeStatic(core.clj:648)
    at clojure.core$apply.invoke(core.clj:641)
    at rewrite_clj.zip.edit$edit$fn__5854.invoke(edit.clj:34)
    at rewrite_clj.zip.edit$edit_node.invokeStatic(edit.clj:26)
    at rewrite_clj.zip.edit$edit_node.invoke(edit.clj:21)
    at clojure.lang.AFn.applyToHelper(AFn.java:156)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.core$apply.invokeStatic(core.clj:648)
    at clojure.zip$edit.invokeStatic(zip.clj:210)
    at clojure.zip$edit.doInvoke(zip.clj:210)
    at clojure.lang.RestFn.invoke(RestFn.java:442)
    at rewrite_clj.zip.edit$edit.invokeStatic(edit.clj:34)
    at rewrite_clj.zip.edit$edit.doInvoke(edit.clj:29)
    at clojure.lang.RestFn.invoke(RestFn.java:425)
    at kibit.replace$replace_zipper_STAR_.invokeStatic(replace.clj:72)
    at kibit.replace$replace_zipper_STAR_.invoke(replace.clj:61)
    at kibit.replace$replace_zipper.invokeStatic(replace.clj:89)
    at kibit.replace$replace_zipper.doInvoke(replace.clj:84)
    at clojure.lang.RestFn.applyTo(RestFn.java:139)
    at clojure.core$apply.invokeStatic(core.clj:652)
    at clojure.core$apply.invoke(core.clj:641)
    at kibit.replace$replace_file$_replace_zipper__6386.invoke(replace.clj:126)
    at rewrite_clj.zip.walk$postwalk_subtree.invokeStatic(walk.clj:34)
    at rewrite_clj.zip.walk$postwalk_subtree.invoke(walk.clj:27)
    at rewrite_clj.zip.walk$postwalk_subtree.invokeStatic(walk.clj:32)
    at rewrite_clj.zip.walk$postwalk_subtree.invoke(walk.clj:27)
    at rewrite_clj.zip.walk$postwalk_subtree.invokeStatic(walk.clj:32)
    at rewrite_clj.zip.walk$postwalk_subtree.invoke(walk.clj:27)
    at rewrite_clj.zip.walk$postwalk_subtree.invokeStatic(walk.clj:32)
    at rewrite_clj.zip.walk$postwalk_subtree.invoke(walk.clj:27)
    at rewrite_clj.zip.walk$postwalk$fn__6042.invoke(walk.clj:43)
    at rewrite_clj.zip.subedit$subedit_node.invokeStatic(subedit.clj:69)
    at rewrite_clj.zip.subedit$subedit_node.invoke(subedit.clj:65)
    at rewrite_clj.zip.walk$postwalk.invokeStatic(walk.clj:43)
    at rewrite_clj.zip.walk$postwalk.invoke(walk.clj:37)
    at kibit.replace$map_zipper.invokeStatic(replace.clj:53)
    at kibit.replace$map_zipper.invoke(replace.clj:49)
    at kibit.replace$replace_file.invokeStatic(replace.clj:125)
    at kibit.replace$replace_file.doInvoke(replace.clj:114)
    at clojure.lang.RestFn.invoke(RestFn.java:486)
    at kibit.driver$run_replace.invokeStatic(driver.clj:46)
    at kibit.driver$run_replace.invoke(driver.clj:44)
    at kibit.driver$run.invokeStatic(driver.clj:74)
    at kibit.driver$run.doInvoke(driver.clj:61)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invokeStatic(core.clj:650)
    at clojure.core$apply.invoke(core.clj:641)
    at kibit.driver$external_run.invokeStatic(driver.clj:80)
    at kibit.driver$external_run.doInvoke(driver.clj:77)
    at clojure.lang.RestFn.invoke(RestFn.java:464)
    at user$eval6436.invokeStatic(form-init8942110484698608728.clj:1)
    at user$eval6436.invoke(form-init8942110484698608728.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6927)
    at clojure.lang.Compiler.eval(Compiler.java:6917)
    at clojure.lang.Compiler.load(Compiler.java:7379)
    ... 14 more
achikin commented 6 years ago

Just FYI - it has happened inside re-frame.core/reg-sub (re-frame.core/reg-sub ::some-sub (fn [db] (:some-sub db)))

oscarkilhed commented 6 years ago

Getting the same error, also with reg-sub