Clojure

[spec] Generator overrides for spec aliases are not respected

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: Release 1.9
  • Fix Version/s: Release 1.11
  • Component/s: None
  • Labels:
  • Approval:
    Vetted

Description

Generator overrides for spec aliases are not respected.

(require '[clojure.spec :as s])
(require '[clojure.spec.gen :as gen])
(s/def ::original number?)
(s/def ::alias ::original)

(every? double? (gen/sample (s/gen ::alias {::alias gen/double})))
;; => false

Providing a generator override for the original spec works as expected:

(every? double? (gen/sample (s/gen ::alias {::original gen/double})))
;; => true

Activity

People

Vote (8)
Watch (8)

Dates

  • Created:
    Updated: