I am using Clojure 1.10.0
Basic example for the issue is:
(let [x 42] :clojure.spec.alpha/invalid)
This will result in the following exception:
2. Unhandled clojure.lang.Compiler$CompilerException
1. Caused by clojure.lang.ExceptionInfo
Call to clojure.core/let did not conform to spec.
#:clojure.spec.alpha{:problems
[{:path [:body],
:pred clojure.core/any?,
:val :clojure.spec.alpha/invalid,
:via [],
:in [1]}],
:spec
#object[clojure.spec.alpha$regex_spec_impl$reify__2509 0x3358b4c5
"clojure.spec.alpha$regex_spec_impl$reify__2509@3358b4c5"],
:value ([x 42] :clojure.spec.alpha/invalid),
:args ([x 42] :clojure.spec.alpha/invalid)}
Couple of workarounds I've been told:
(let [x 42] (identity :clojure.spec.alpha/invalid))
(def invalid :clojure.spec.alpha/invalid))
(let [x 42] invalid)
Also, interestingly the error is only with the let macro (and some others in clojure.core), special forms (like if) are seemingly unaffected:
(let [x 42] (if (= 42 x) :clojure.spec.alpha/invalid))
Therefore I assume this is unintended, is a bug, and hopefully be fixed in the future.
Regards,
Daniel