在这个示例中,将一个不符合要求的值传递给 conform 函数,该函数应该返回 ::s/invalid,但实际抛出了 StackOverflow。
`
(s/conform (s/ (s/alt :n (s/ number?) :s (s/* string?))) [[1 2 3]])
编译器异常 java.lang.StackOverflowError,编译位置:( /Users/alex/code/clojure.spec/src/spec/examples/tree.clj:44:1 )
clojure.lang.Compiler.load (Compiler.java:7415)
user/eval2674 (form-init3668332544888233146.clj:1)
user/eval2674 (form-init3668332544888233146.clj:1)
clojure.lang.Compiler.eval (Compiler.java:6951)
clojure.lang.Compiler.eval (Compiler.java:6914)
clojure.core/eval (core.clj:3187)
clojure.core/eval (core.clj:3183)
clojure.main/repl/read-eval-print--9692/fn--9695 (main.clj:241)
clojure.main/repl/read-eval-print--9692 (main.clj:241)
clojure.main/repl/fn--9701 (main.clj:259)
clojure.main/repl (main.clj:259)
clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn--675 (interruptible_eval.clj:69)
原因
StackOverflowError
clojure.spec/deriv (spec.clj:1296)
clojure.spec/deriv (spec.clj:1311)
clojure.spec/deriv/fn--13794 (spec.clj:1312)
clojure.core/map/fn--6680 (core.clj:2728)
clojure.lang.LazySeq.sval (LazySeq.java:40)
clojure.lang.LazySeq.seq (LazySeq.java:49)
clojure.lang.RT.seq (RT.java:525)
clojure.core/seq--6221 (core.clj:137)
clojure.core/map/fn--6687 (core.clj:2736)
clojure.lang.LazySeq.sval (LazySeq.java:40)
clojure.lang.LazySeq.seq (LazySeq.java:49)
clojure.lang.RT.seq (RT.java:525)
`