[core.specs] fn specs don't catch vectors as arity definitions

Description

Examples like these:

are invalid, and fail, but only on the macroexpansion (destructuring into a let), not on the fn form, despite there being a spec for fn that should fail.

Example:

The reason for this is that the :clojure.core.specs.alpha/params+body is a regex spec and any sequential collection will pass so (fn [[x] 6] [[x] 7]) is treated like (fn ([x] 6) ([x] 7)) which is a syntactically but not semantically valid multi-arity definition. (If you try this, you get an error from fn macro that you can't overload an arity.)

If you add a check to :arams+body to also check seq?, you get a better indication of the invalid syntax:

This is kind of the flipside of the known "vcat" issue, where only structured vectors are allowed, not seqs (we have cases of this in the core specs too).

Environment

None

Assignee

Unassigned

Reporter

Alex Miller

Labels

Approval

Triaged

Patch

None

Affects versions

Priority

Major
Configure