Skip to content

Commit

Permalink
Use constant nil gen
Browse files Browse the repository at this point in the history
  • Loading branch information
bsless committed Sep 5, 2023
1 parent 15b71d5 commit 729c150
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/malli/generator.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@

(defmethod -schema-generator :maybe [schema options]
(let [g (-> schema (m/children options) first (generator options) -not-unreachable)]
(gen-one-of (cond-> [(gen/return nil)]
(gen-one-of (cond-> [nil-gen]
g (conj g)))))

(defmethod -schema-generator :tuple [schema options]
Expand All @@ -446,7 +446,7 @@
#?(:clj (defmethod -schema-generator :re [schema options] (-re-gen schema options)))
(defmethod -schema-generator :any [_ _] (ga/gen-for-pred any?))
(defmethod -schema-generator :some [_ _] gen/any-printable)
(defmethod -schema-generator :nil [_ _] (gen/return nil))
(defmethod -schema-generator :nil [_ _] nil-gen)
(defmethod -schema-generator :string [schema options] (-string-gen schema options))
(defmethod -schema-generator :int [schema options] (gen/large-integer* (-min-max schema options)))
(defmethod -schema-generator :double [schema options]
Expand Down Expand Up @@ -514,7 +514,7 @@
(-create-from-elements props)
(-create-from-schema props options)
(-create-from-gen props schema options)
(gen/return nil)))))
nil-gen))))

(defn- -create [schema options]
(let [props (-merge (m/type-properties schema)
Expand Down

0 comments on commit 729c150

Please sign in to comment.