Uploaded image for project: 'ClojureScript'
  1. CLJS-2940

Can't define nilable spec on undefined pred

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Completed
    • Affects versions: None
    • Fix versions: None
    • Labels:

      Description

      This fails in ClojureScript but works in Clojure:

      (s/def ::foo (s/cat :bar (s/nilable ::foo)))
      

      Note: While this spec seems silly and is valid for things like [nil], [[nil]], it is just a minimal repro, where larger specs might exhibit a similar shape.

      Repro:

      $ clj -m cljs.main
      ClojureScript 1.10.339
      cljs.user=> (require '[clojure.spec.alpha :as s])
      
      cljs.user=> (s/def ::foo (s/cat :bar (s/nilable ::foo)))
      Error: Unable to resolve spec: :cljs.user/foo
      	 cljs.spec.alpha/reg-resolve! (cljs/spec/alpha.cljs:71:18)
      	 cljs$spec$alpha$Specize$specize_STAR_$arity$2 (cljs/spec/alpha.cljs:129:31)
      	 cljs$core$IFn$_invoke$arity$2 (cljs/spec/alpha.cljs:124:18)
      	 cljs.spec.alpha/specize* (cljs/spec/alpha.cljs:123:1)
      	 cljs$core$IFn$_invoke$arity$2 (cljs/spec/alpha.cljs:142:30)
      	 cljs.spec.alpha/specize (cljs/spec/alpha.cljs:140:1)
      	 cljs$spec$alpha$nilable_impl (cljs/spec/alpha.cljs:1360:15)
      

        Attachments

          Activity

            People

            • Assignee:
              dnolen David Nolen
              Reporter:
              mfikes Mike Fikes
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: