This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-02
Channels
- # announcements (3)
- # beginners (28)
- # calva (5)
- # clj-kondo (17)
- # cljsrn (1)
- # clojure (69)
- # clojure-dev (23)
- # clojure-europe (1)
- # clojure-italy (27)
- # clojure-japan (1)
- # clojure-nl (5)
- # clojure-spec (34)
- # clojure-uk (87)
- # cursive (93)
- # datomic (15)
- # duct (6)
- # emacs (3)
- # events (2)
- # garden (1)
- # graalvm (4)
- # jobs (3)
- # malli (1)
- # off-topic (13)
- # onyx (1)
- # pathom (8)
- # pedestal (2)
- # re-frame (13)
- # reitit (5)
- # shadow-cljs (13)
- # sql (13)
- # test-check (5)
- # testing (3)
- # yada (1)
I am getting this exception "Additional data must be non-nil."
when using st/check
on my function. I have gotten this before and then it mysteriously went away. I am now getting it constantly and am curious what is going on. It is coming from these Spec lines: https://github.com/clojure/spec.alpha/blob/5228bb75fa10b7b13ea088d84f4d031cce74a969/src/main/clojure/clojure/spec/test/alpha.clj#L278-L284.
Working on that. It's pretty coupled to this code but I should be able to pull something out.
this has been reported before, but AFAIK there's not a deterministically reproducible case
the error occurs when you try to create an ex-info with nil data. the case where this happens here is when spec validation fails, but explain-data succeeds (which ideally should never happen). usually, this is a bug in spec. occasionally, it's a bad predicate in user code.
well the error should never happen
I pulled some code out to get a repro case and was running st/check on it. It failed with a regular specification error. I thought that was weird because it hasn't failed yet. Turned on instrumentation and ran again and got the "Additional data must be non-nil." message. May be related to instrument.
this won't help you, but I've made a change in spec-alpha2 to better report this case
Alright, here's a repro: https://gist.github.com/kennyjwilli/f324b94eaadc404cb72fdfe41067b469. Not minimal but I've gotta go make some food. Within 3 or so runs of (st/check
formula->fn)`, it will get the exception.
so I misdiagnosed above - even more subtle... s/conform and s/valid? are returning different answers when run on the same input
which is because the spec is an fspec, which generates its own source of random inputs
this is a known issue and generally we've been suggesting people don't use fspec because it has all these unexpected consequences
unfortunately it's not even easy to override in a spec alias or anything
yes, it is significantly harder to use it in check. I'm not saying any of this is good.
this is a known area I'm hoping to spend some rethink time on in spec 2, but we're going to overhaul the function return value stuff first
I don't think I have any simple advice for you, other than to remove your :ret spec :(
no, the :ret on the fdef
that is an fspec
I was trying to add some gen improvements to clojure.spec.alpha
but I cannot load the ns in a REPL. I get
CompilerException java.lang.Exception: #object[clojure.spec.alpha$and_spec_impl$reify__2171 0x4a332076 "[email protected]"] is not a fn, expected predicate fn, compiling:(/home/kenny/Forks/spec.alpha/src/main/clojure/clojure/spec/alpha.clj:78:1)
Is there some magic that needs to happen to have a REPL with Spec itself?hi gents! How I can define spec of vector where I know only first element and don’t know length of vector. For example [:in 1 2 3 4]
it would be great to use something like
(s/tuple #{:in :or} & nat-int?)
(s/cat :in #{:in :or} :nums (s/* nat-int?))
this is exactly the job the regex ops are made for
I see, thank you!