Uploaded image for project: 'Clojure'
  1. CLJ-2079

[spec] Generator overrides for spec aliases are not respected

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects versions: Release 1.9
    • Fix versions: Release 1.11
    • 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
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              nwjsmith NateS
            • Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated: