ClojureScript

Can't spec generate non-vector collections

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code and Test

Description

If you use cljs.spec/coll-of with non-vector :kind, you can't exercise the spec.

Repro:

$ java -jar cljs.jar -m cljs.repl.node
ClojureScript Node.js REPL server listening on 58736
To quit, type: :cljs/quit
cljs.user=> (require '[clojure.spec :as s] 'clojure.test.check.generators)
true
cljs.user=> (s/exercise (s/coll-of string? :kind set?))
Error: Couldn't satisfy such-that predicate after 100 tries.
...

Activity

Hide
Mike Fikes added a comment - - edited
Show
Mike Fikes added a comment - - edited This is a cut-n-dry defect simply involving missing this Clojure deletion: https://github.com/clojure/clojure/commit/23e3ec3f8bceeedee70beed7a17846c25eba05a6#diff-b0f91f319d0c76aadf667da929b08d37L1208 in this ClojureScript tracking change here: https://github.com/clojure/clojurescript/commit/cd43ec9bf40605e230dc8858c2855f9ad85b39d8#diff-5c48ec6d047e1ea6fdcdd00b4f09f45eL702 The consequence is that gen-into is always non-nil (set to []) and then kind is not made use of here: https://github.com/clojure/clojurescript/blob/627f7fd513d928531db48392d8f52142fea5eb38/src/main/cljs/cljs/spec.cljs#L890-L891

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: