这是最小的情况,但它似乎无论提供多少其他参数数量,或者使用列表或向量语法来指定参数数量都会发生。
user=> (clojure-version)
"1.12.0-rc1"
user=> (defn f [&form])
Unexpected error (IndexOutOfBoundsException) macroexpanding defn at (REPL:1:1).
null
user=> *e
#error {
:cause nil
:via
[{:type clojure.lang.Compiler$CompilerException
:message "Unexpected error macroexpanding defn at (1:1)."
:data #:clojure.error{:phase :macroexpansion, :line 1, :column 1, :source "NO_SOURCE_PATH", :symbol defn}
:at [clojure.lang.Compiler macroexpand1 "Compiler.java" 7551]}
{:type java.lang.IndexOutOfBoundsException
:message nil
:at [clojure.lang.RT subvec "RT.java" 1634]}]
:trace
[[clojure.lang.RT subvec "RT.java" 1634]
[clojure.core$sigs$asig__5505 invoke "core.clj" 235]
[clojure.core$sigs invokeStatic "core.clj" 259]
[clojure.core$defn__5514 invokeStatic "core.clj" 317]
[clojure.core$defn__5514 doInvoke "core.clj" 294]
[clojure.lang.RestFn applyTo "RestFn.java" 149]
[clojure.lang.Var applyTo "Var.java" 707]
[clojure.lang.Compiler macroexpand1 "Compiler.java" 7525]
[clojure.lang.Compiler macroexpand "Compiler.java" 7598]
[clojure.lang.Compiler eval "Compiler.java" 7684]
[clojure.lang.Compiler eval "Compiler.java" 7655]
[clojure.core$eval invokeStatic "core.clj" 3232]
[clojure.core$eval invoke "core.clj" 3228]
[clojure.main$repl$read_eval_print__9240$fn__9243 invoke "main.clj" 437]
[clojure.main$repl$read_eval_print__9240 invoke "main.clj" 437]
[clojure.main$repl$fn__9249 invoke "main.clj" 459]
[clojure.main$repl invokeStatic "main.clj" 459]
[clojure.main$repl_opt invokeStatic "main.clj" 523]
[clojure.main$main invokeStatic "main.clj" 668]
[clojure.main$main doInvoke "main.clj" 617]
[clojure.lang.RestFn invoke "RestFn.java" 400]
[clojure.lang.AFn applyToHelper "AFn.java" 152]
[clojure.lang.RestFn applyTo "RestFn.java" 135]
[clojure.lang.Var applyTo "Var.java" 707]
[clojure.main main "main.java" 40]]}