Welcome! Please see the About page for a little more info on how this works.

0 votes
ago in Spec by

I was trying to exercise a spec which is a union of two others with a selection

(ns example
(:require [clojure.alpha.spec :as s]))
(s/def ::val1 int?)
(s/def ::foo (s/schema [::val1]))

(s/def ::val2 int?)
(s/def ::bar (s/schema [::val2]))
(s/def ::foobar (s/union ::foo ::bar))

(s/exercise (s/select ::foobar [::val1]))

But this throws an error.

No implementation of method: :keyspecs* of protocol:
#'clojure.alpha.spec.protocols/Schema found for class:
clojure.alpha.spec.impl$union_impl$reify__7091

Should select work for this? Or am I doing something wrong?

I am using

org.clojure/alpha.spec {:git/url "https://github.com/clojure/spec-alpha2.git"
                             :sha "495e5ac3238be002b4de72d1c48479f6bec06bb3"}

1 Answer

+1 vote
ago by
selected ago by
 
Best answer

Just a bug, fixed now in master.

ago by
Thanks for the fast reply and fix. Works now for me :)
...