Fork me on GitHub
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.util.concurrent.ThreadPoolExecutor$  624
 java.util.concurrent.ThreadPoolExecutor.runWorker 1149
               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


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


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


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


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


user=> (require '[clojure.spec.alpha :as s] '[clojure.spec.test.alpha :as stest])
user=> (s/fdef clojure.core/comp :args (s/* ifn?) :ret ifn?)
user=> (stest/instrument '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?