[spec] ::defn-args spec does not capture type hint on return value

Description

Conforming a defn to the ::defn-args spec correctly preserves any type hint given to the inputs, but incorrectly loses the type hint given to the return value.

1 2 3 4 5 6 7 8 9 10 user=> (require '[clojure.spec.alpha :as s] '[clojure.core.specs.alpha :as ss]) nil user=> (def c '(f ^double [^long x] 0.0)) #'user/c user=> (binding [*print-meta* true] (prn c)) ^{:line 10, :column 9} (f ^double [^long x] 0.0) nil user=> (binding [*print-meta* true] (prn (s/conform ::ss/defn-args c))) {:name f, :bs [:arity-1 {:args {:args [[:sym ^long x]]}, :body [:body [0.0]]}]} nil

Cause: Conformed regex specs do not retain meta on their conformed value (coll specs do):

1 2 3 4 5 user=> (binding [*print-meta* true] (prn (s/conform (s/coll-of int?) ^{:hi :there} [1]))) ^{:hi :there} [1] user=> (binding [*print-meta* true] (prn (s/conform (s/* int?) ^{:hi :there} [1]))) [1]

The particular spec where this comes up here is :clojure.core.specs.alpha/arg-list, which is an s/*.

Environment

Windows, Java 1.8

Status

Assignee

Unassigned

Reporter

Mark Engelberg

Labels

Approval

Triaged

Patch

None

Affects versions

Release 1.9

Priority

Major