We're updating the issue view to help you get more done. 

Need to reject incorrect fn with fixed arity of more params than variadic

Description

1 2 3 4 5 6 7 ClojureScript 1.10.339 cljs.user=> (defn foo ([x] [:single x]) ([& xs] [:variadic xs])) #'cljs.user/foo cljs.user=> (foo 1) [:single 1] cljs.user=> (foo 1 2) [:variadic 1]

Note that the variadic call provides the wrong answer.

It appears that the right thing to do is not "make it work" but to reject the code as incorrect. See Clojure:

1 2 user=> (defn foo ([x] [:single x]) ([& xs] [:variadic xs])) CompilerException java.lang.RuntimeException: Can't have fixed arity function with more params than variadic function, compiling:(NO_SOURCE_PATH:1:1)

Environment

None

Status

Assignee

Unassigned

Reporter

Mike Fikes

Labels

None

Approval

None

Patch

None

Priority

Major