I wrote up more details of this error on StackOverflow:

https://stackoverflow.com/questions/53149344/what-causes-error-no-protocol-method-xxx-yyy-defined-for-type-undefined-in-clo


These errors are particularly insidious since the error message is so
vague, and there was no reference to the offending file & line. In face, in
this case it was caused by a chain of references across 4 files:

tst.tupelo.core -> tupelo.core -> tupelo.impl -> tupelo.schema


On Mon, Nov 5, 2018 at 7:15 AM Alan Thompson <clooj...@gmail.com> wrote:

> OK, I found the cause of the error.  In a dependent namespace, I had
> defined some schemas:
>
> (ns tupelo.schema
>   "Prismatic Schema type definitions"
>   (:require [schema.core :as s])
>   #?(:clj (:import [java.util HashSet] ))
>   #?(:clj (:gen-class)))
>
> (def Set
>   "Either a Clojure hash-set or a java.util.HashSet"
>   (s/either #{s/Any}
>     *#?(:clj* java.util.HashSet*)*))      ; <= *This was missing the
> #?(:clj ...)*   and caused the error
>
>
>
>
> On Mon, Nov 5, 2018 at 7:15 AM Alan Thompson <clooj...@gmail.com> wrote:
>
>> Copied from the Clojure mailing list
>> ----------------------------------------------------
>>
>> I am seeing the following errors in CLJS, but not in CLJ:
>>
>> ERROR in (dotest-line-695) (schema/core.js:33:64)
>> expected: (clojure.core/= (t/thru 9) (t/glue-rows data))
>>   actual: #object[Error Error: No protocol method Schema.spec defined for
>> type undefined: ]
>>
>>
>> The errors disappear if I remove Plumatic Schema elements of the function
>> definition:
>>
>> ; this one produces the error in clojurescript (clojure runs fine)
>> (s/defn glue-rows  :- tsk/List
>>   [coll-2d :- tsk/List]
>> ...
>>
>> ; this one works fine in both clojure and clojurescript
>> (s/defn glue-rows  :- tsk/List
>>   [coll-2d :- tsk/List]
>> ...
>>
>>
>> Any clues as to the cause of this behavior?
>> Alan
>>
>>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to