metosin / spec-tools

Clojure(Script) tools for clojure.spec
Eclipse Public License 2.0
592 stars 94 forks source link

adding spec-tools 0.8.3 to a blank project causes exception #170

Closed colliderwriter closed 5 years ago

colliderwriter commented 5 years ago

With clojure 1.10.0,lein new test In test/project.clj, add spec-tools 0.8.3 to :dependencies. In test/src/test/core.clj, make the ns look like

(ns test.core
  (:require [clojure.spec.alpha :as s]
            [metosin/spec-tools :as st]))

then lein repl.

I get this exception:

#error {
 :cause Call to clojure.core/ns did not conform to spec.
 :data #:clojure.spec.alpha{:problems [{:path [], :reason Extra input, :pred (clojure.spec.alpha/cat :docstring (clojure.spec.alpha/? clojure.core/string?) :attr-map (clojure.spec.alpha/? clojure.core/map?) :ns-clauses :clojure.core.specs.alpha/ns-clauses), :val ((:require [clojure.spec.alpha :as s] [metosin/spec-tools :as st])), :via [:clojure.core.specs.alpha/ns-form], :in [1]}], :spec #object[clojure.spec.alpha$regex_spec_impl$reify__2509 0x4b45dcb8 clojure.spec.alpha$regex_spec_impl$reify__2509@4b45dcb8], :value (test.core (:require [clojure.spec.alpha :as s] [metosin/spec-tools :as st])), :args (test.core (:require [clojure.spec.alpha :as s] [metosin/spec-tools :as st]))}
 :via
 [{:type clojure.lang.Compiler$CompilerException
   :message Syntax error macroexpanding clojure.core/ns at (test/core.clj:1:1).
   :data #:clojure.error{:phase :macro-syntax-check, :line 1, :column 1, :source test/core.clj, :symbol clojure.core/ns}
   :at [clojure.lang.Compiler checkSpecs Compiler.java 6971]}
  {:type clojure.lang.ExceptionInfo
   :message Call to clojure.core/ns did not conform to spec.
   :data #:clojure.spec.alpha{:problems [{:path [], :reason Extra input, :pred (clojure.spec.alpha/cat :docstring (clojure.spec.alpha/? clojure.core/string?) :attr-map (clojure.spec.alpha/? clojure.core/map?) :ns-clauses :clojure.core.specs.alpha/ns-clauses), :val ((:require [clojure.spec.alpha :as s] [metosin/spec-tools :as st])), :via [:clojure.core.specs.alpha/ns-form], :in [1]}], :spec #object[clojure.spec.alpha$regex_spec_impl$reify__2509 0x4b45dcb8 clojure.spec.alpha$regex_spec_impl$reify__2509@4b45dcb8], :value (test.core (:require [clojure.spec.alpha :as s] [metosin/spec-tools :as st])), :args (test.core (:require [clojure.spec.alpha :as s] [metosin/spec-tools :as st]))}
   :at [clojure.spec.alpha$macroexpand_check invokeStatic alpha.clj 705]}]
 :trace

trace snipped

miikka commented 5 years ago

Hi! The problem is with the :require form – the require for spec-tools should be [spec-tools.core :as st], not [metosin/spec-tools :as st]. I believe that all the examples in README use the correct require form, but if the broken one is mentioned somewhere in the docs, please let me know.

colliderwriter commented 5 years ago

You are correct. Sorry for the wasted bandwidth and thanks for your response.