Fork me on GitHub
#boot
<
2018-01-10
>
Petrus Theron12:01:17

Accidentally had the symbol "true" inside a boot comp task. Took me 2 hours to find it, because this is the error I got:

Starting reload server on 
                              java.lang.Thread.run              Thread.java:  748
java.util.concurrent.ThreadPoolExecutor$Worker.run  ThreadPoolExecutor.java:  624
 java.util.concurrent.ThreadPoolExecutor.runWorker  ThreadPoolExecutor.java: 1149
               java.util.concurrent.FutureTask.run          FutureTask.java:  266
                                               ...                               
               clojure.core/binding-conveyor-fn/fn                 core.clj: 2022
                                 boot.core/boot/fn                 core.clj: 1031
                               boot.core/run-tasks                 core.clj: 1021
                              clojure.core/comp/fn                 core.clj: 2561 (repeats 7 times)
java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn
  clojure.lang.ExceptionInfo: java.lang.Boolean cannot be cast to clojure.lang.IFn
    line: 265
Because I'm using system.repl and component, was really hard to diagnose 😕 Hoping spec can help here

Alex Miller (Clojure team)17:01:14

did “line: 265” point to the line of the error? would be curious if the non-prettified version of this is actually a better locator

Petrus Theron08:01:45

thx but no, line: 265 is not from my build.boot file

Alex Miller (Clojure team)14:01:11

I would expect that to refer to a line of code but I’m not sure in what file

Alex Miller (Clojure team)17:01:57

a spec for comp would detect this. you can try it yourself!

martinklepsch17:01:27

@petrus for the non-prettified version use boot -vv

Alex Miller (Clojure team)17:01:57

user=> (require '[clojure.spec.alpha :as s] '[clojure.spec.test.alpha :as stest])
nil
user=> (s/fdef clojure.core/comp :args (s/* ifn?) :ret ifn?)
clojure.core/comp
user=> (stest/instrument 'clojure.core/comp)
[clojure.core/comp]
user=> (comp count true)
ExceptionInfo Call to #'clojure.core/comp did not conform to spec:
In: [1] val: true fails at: [:args] predicate: ifn?
  clojure.core/ex-info (core.clj:4739)

Petrus Theron08:01:06

spec is awesome. Is there work happening to spec out all the core fn's like this?