::defn-args spec incorrectly parses map body as a prepost rather than function body

Description

Reported by in #clojure-spec:

user> (s/conform :clojure.core.specs/defn-args '(foo [bar] {:baz 42})) {:name foo, :bs [:arity-1 {:args {:args [[:sym bar]]}, :prepost {:baz 42}}]}

The current spec conforms function bodies with single maps as prepost conditions rather than function bodies, after the patch:

user=> (s/conform :clojure.core.specs/defn-args '(foo [bar] {:baz 42})) {:name foo, :bs [:arity-1 {:args {:args [[:sym bar]]}, :body [:body [{:baz 42}]]}]} user=> (s/conform :clojure.core.specs/defn-args '(foo [bar] {:baz 42} 1)) {:name foo, :bs [:arity-1 {:args {:args [[:sym bar]]}, :body [:prepost+body {:prepost {:baz 42}, :body [1]}]}]}

Patch: 0001-CLJ-2144-conform-map-fn-bodies-as-body-rather-than-a.patch

Screened by: Alex Miller

Environment

None

Attachments

1
  • 16 Feb 2017, 11:36 PM

Activity

Show:

Nicola Mometto February 16, 2017 at 11:42 PM

An open question is whether we also want to make `face with tonguerepost` stricter as part of this patch, so that it will ensure that `face with tonguere` and `face with tongueost` are a collection

Completed

Details

Assignee

Reporter

Labels

Approval

Ok

Patch

Code

Priority

Affects versions

Fix versions

Created February 16, 2017 at 11:34 PM
Updated March 14, 2017 at 11:57 AM
Resolved March 14, 2017 at 11:57 AM

Flag notifications